-
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.
chore: update eslint and add rules (#111)
* feat: update eslint pkgs + separate prettier from eslint (best practice) * feat: add rules to eslint config * fix: linting and code migration * chore: lint and format * fix: handle i18n promises * ci: update lint including prettier check * fix(eslint): revert removal of `eslint-config-prettier` * build: set npm engine version to lts (20.x.x) * ci: add husky for pre-commit hook (`npm test`) * ci(eslint): specify file extensions to check * ci(eslint): add back react rules * ci: change pre-commit hook from `npm test` to `npm run lint` * chore: update lockfile --------- Co-authored-by: Federico Grandi <[email protected]>
- Loading branch information
1 parent
9d32018
commit b62d230
Showing
20 changed files
with
2,499 additions
and
796 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,20 +1,49 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
'plugin:@typescript-eslint/recommended-type-checked', | ||
'plugin:react-hooks/recommended', | ||
'plugin:prettier/recommended' // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'prettier' // this prevents conflicts between eslint and prettier (eslint-config-prettier) | ||
], | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
parser: '@typescript-eslint/parser', | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 'latest', // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module' // Allows for the use of imports | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
tsconfigRootDir: __dirname, | ||
project: true | ||
}, | ||
plugins: ['react-refresh'], | ||
plugins: ['react-refresh', 'unused-imports'], | ||
overrides: [ | ||
{ | ||
extends: ['plugin:@typescript-eslint/disable-type-checked'], | ||
files: ['./**/*.{js,cjs}'] | ||
} | ||
], | ||
rules: { | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'react-refresh/only-export-components': 'warn', | ||
'prettier/prettier': 'warn', | ||
|
||
// no unused vars/imports | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
'unused-imports/no-unused-imports': 'error', | ||
'unused-imports/no-unused-vars': [ | ||
'warn', | ||
{ | ||
vars: 'all', | ||
varsIgnorePattern: '^_', | ||
args: 'after-used', | ||
argsIgnorePattern: '^_' | ||
} | ||
] | ||
}, | ||
settings: { | ||
react: { // eslint-plugin-react | ||
version: 'detect' | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm run lint |
Oops, something went wrong.