-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from lexicongovernance/120-replicate-backend-…
…linter-and-format-requirements Implement format and linting ci/cd
- Loading branch information
Showing
21 changed files
with
251 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,42 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:@tanstack/eslint-plugin-query/recommended', | ||
'prettier' | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
plugins: ['react-refresh', '@typescript-eslint'], | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
rules: { | ||
// 1. 'react-refresh/only-export-components': Ensure React components are exported properly | ||
// Warn because it's important but not necessarily an error | ||
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], | ||
|
||
// 2. '@typescript-eslint/ban-ts-comment': Avoid using @ts-ignore comments | ||
// Warn to discourage usage, but doesn't necessarily break the build | ||
'@typescript-eslint/ban-ts-comment': 'warn', | ||
|
||
// 3. '@typescript-eslint/no-var-requires': Discourage using require() in favor of ES6 imports | ||
// Warn to discourage usage, but doesn't necessarily break the build | ||
'@typescript-eslint/no-var-requires': 'warn', | ||
|
||
// 4. '@typescript-eslint/no-explicit-any': Avoid using explicit 'any' types | ||
// Warn to encourage type safety, could be upgraded to 'error' for stricter enforcement | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
|
||
// 5. '@tanstack/query/exhaustive-deps': Ensure exhaustive dependency arrays in React hooks | ||
// Warn to highlight potential issues, but doesn't necessarily break the build | ||
'@tanstack/query/exhaustive-deps': 'warn', | ||
|
||
// 6. '@typescript-eslint/no-unused-vars': Avoid unused variables, enforcing cleaner code | ||
// Error to ensure unused variables are caught during linting | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true }, | ||
], | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Check Formatting | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
branches: | ||
- develop | ||
- main | ||
|
||
concurrency: | ||
# group runs by <name of the workflow>-<name of job>-<branch name> | ||
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
formatting: | ||
name: Check formatting | ||
timeout-minutes: 2 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Review formatting | ||
run: pnpm format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Linting | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
branches: | ||
- develop | ||
- main | ||
|
||
concurrency: | ||
# group runs by <name of the workflow>-<name of job>-<branch name> | ||
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linting: | ||
name: Check linting | ||
timeout-minutes: 2 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Review linting | ||
run: pnpm lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
tabWidth: 2, | ||
singleQuote: true, | ||
quoteProps: 'consistent', | ||
printWidth: 100, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.