Skip to content

Commit

Permalink
Initial commit of react template
Browse files Browse the repository at this point in the history
  • Loading branch information
Jagoda11 committed Jul 4, 2024
0 parents commit 07b9f72
Show file tree
Hide file tree
Showing 30 changed files with 13,984 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
env:
browser: true
es2021: true
jest: true
extends:
- eslint:recommended
- plugin:react/recommended
- plugin:@typescript-eslint/recommended
- plugin:jest/recommended
- plugin:prettier/recommended
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: latest
sourceType: 'module'
plugins:
- '@typescript-eslint'
- jest
- prettier
- react-hooks
rules:
prettier/prettier: 'error' # Enforce Prettier formatting
react/jsx-filename-extension:
- 1
- { extensions: ['.tsx'] } # Enforce the use of .tsx extension for JSX files
'@typescript-eslint/explicit-module-boundary-types': 'warn' # Ensure functions have explicit return types
'@typescript-eslint/no-unused-vars': 'warn' # Warn about unused variables
'@typescript-eslint/no-explicit-any': 'warn' # Warn about usage of the any type
'no-console': 'warn'
'jest/no-disabled-tests': 'warn' # Warn about disabled tests
'jest/no-focused-tests': 'error' # Error on focused tests
'jest/no-identical-title': 'error'
react-hooks/rules-of-hooks: 'error'
react-hooks/exhaustive-deps: 'warn'
settings:
react:
version: 'detect'
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---

**Describe the bug 🪲**
A clear and concise description of what the bug is.

**To Reproduce 📝**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

**Expected behavior 🌟**
A clear and concise description of what you expected to happen.

**Screenshots 📸**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS 🖥️: [e.g. iOS]
- Browser 🌐: [e.g. chrome, safari]
- Version 🆚: [e.g. 22]

**Smartphone (please complete the following information):**

- Device 📱: [e.g. iPhone6]
- OS 📱: [e.g. iOS8.1]
- Browser 🌐: [e.g. stock browser, safari]
- Version 🆚: [e.g. 22]

**Additional context 🗒️**
Add any other context about the problem here.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/custom_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Custom issue
about: Describe this issue template's purpose here.
title: '[CUSTOM] '
labels: ''
assignees: ''
---

**Describe your issue 📝**
A clear and concise description of what the issue is.

**Additional context 🗒️**
Add any other context or screenshots about the issue here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[FEATURE] '
labels: enhancement
assignees: ''
---

**Is your feature request related to a problem? Please describe. 🙋‍♂️**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like 🛠️**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered 🔍**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context 🗒️**
Add any other context or screenshots about the feature request here.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [21.x]

steps:
- uses: actions/checkout@v2
- name: 🛠️ Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: 📦 Install dependencies
run: npm ci
- name: 🧹 Lint code
run: npm run lint
- name: 🔨 Build
run: npm run build
- name: 🧪 Test with coverage
run: npm run test
36 changes: 36 additions & 0 deletions .github/workflows/close-merged-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Close Merged Pull Requests

on:
pull_request:
types: [closed]

permissions:
issues: write
pull-requests: write

jobs:
close-issues:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Mask GitHub Token
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"

- name: Close linked issues
uses: actions/github-script@v5
with:
script: |
const pull_request = context.payload.pull_request;
const repo = context.repo.repo;
const owner = context.repo.owner;
const issues = pull_request.body.match(/#[0-9]+/g) || [];
for (const issue of issues) {
const issue_number = issue.replace('#', '');
await github.rest.issues.update({
owner,
repo,
issue_number,
state: 'closed'
});
}
github-token: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/close-stale-issues-and-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Close Stale Issues and PRs

on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: 🎭 Mask GitHub Token
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"

- name: Close stale issues and PRs 🕒
uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically closed due to inactivity. Please reopen if you still need assistance.'
stale-pr-message: 'This pull request has been automatically closed due to inactivity. Please reopen if you still need assistance.'
days-before-stale: 30 # Number of days of inactivity before marking as stale
days-before-close: 7 # Number of days to wait after marking as stale before closing
31 changes: 31 additions & 0 deletions .github/workflows/label-new-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Label New Pull Requests

on:
pull_request:
types: [opened]

permissions:
pull-requests: write

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: 🎭 Mask GitHub Token
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"

- name: Add label to new pull request 🏷️
uses: actions/github-script@v5
with:
script: |
const pr_number = context.payload.pull_request.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
const labels = ['new-pr']; // Replace 'new-pr' with your desired label
await github.rest.issues.addLabels({
owner,
repo,
issue_number: pr_number,
labels
});
github-token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/thank-contributors-on-issue-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Thank Contributors for Closing Issues

on:
issues:
types: [closed]

permissions:
issues: write

jobs:
thank:
runs-on: ubuntu-latest
steps:
- name: Mask GitHub Token
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"

- name: Post thank you message 🙏
uses: actions/github-script@v5
with:
script: |
const issue_number = context.issue.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
const body = ':tada: :sparkles: Thanks for closing this issue! Your contribution helps keep the project moving forward. :rocket:';
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body
});
github-token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/welcome-new-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Welcome New Pull Requests

on:
pull_request:
types: [opened]

permissions:
pull-requests: write

jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: 🎭 Mask GitHub Token
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"

- name: Post welcome message 📨
uses: actions/github-script@v5
with:
script: |
const pr_number = context.payload.pull_request.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
const body = ':tada: :sparkles: Thanks for opening this pull request! We will review🧐 it soon. :rocket:';
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr_number,
body
});
github-token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/welcome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Welcome New Contributors

on:
issues:
types: [opened]

permissions:
issues: write

jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: 🎭 Mask GitHub Token
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"
- name: Post welcome message 📨
uses: actions/github-script@v5
with:
script: |
const issue_number = context.issue.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
const body = ':tada: :sparkles: Hello, thanks for opening this issue! We will review it soon. :rocket:';
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body
});
github-token: ${{secrets.GITHUB_TOKEN}}
Loading

0 comments on commit 07b9f72

Please sign in to comment.