-
Notifications
You must be signed in to change notification settings - Fork 14
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 #1332 from research-software-directory/eslint-upgrade
chore: upgrade eslint to v9
- Loading branch information
Showing
7 changed files
with
230 additions
and
213 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,68 @@ | ||
import {dirname} from 'node:path' | ||
import {fileURLToPath} from 'node:url' | ||
import {FlatCompat} from '@eslint/eslintrc' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
}) | ||
|
||
const eslintConfig = [ | ||
// Note! it does not work if only core-web-vitals are used | ||
...compat.extends('next/core-web-vitals', 'next/typescript'), | ||
// add custom rules | ||
{ | ||
rules: { | ||
'no-debugger': 'warn', | ||
'no-console': 'warn', | ||
// use direct imports on material-ui to improve | ||
// performance in unit tests with jest | ||
// see https://blog.bitsrc.io/why-is-my-jest-suite-so-slow-2a4859bb9ac0 | ||
'no-restricted-imports': ['warn', { | ||
name: '@mui/material', | ||
message: 'Please use "import foo from \'@mui/material/foo\'" instead.', | ||
}], | ||
// do not warn for use of img element | ||
'@next/next/no-img-element': 'off', | ||
|
||
// --------------------------------------- | ||
// disable specific typescript rules | ||
// we will use generic rules instead | ||
'@typescript-eslint/no-explicit-any':'off', | ||
'@typescript-eslint/no-unused-vars':'off', | ||
|
||
// --------------------------------------- | ||
// ENABLE LATER | ||
// dissable rules we did not used in the past | ||
// we can enable these rules in the future | ||
// and fix the linter errors | ||
'@typescript-eslint/no-empty-object-type' :'off', | ||
'@typescript-eslint/prefer-as-const':'off', | ||
'@typescript-eslint/no-unused-expressions':'off', | ||
'@typescript-eslint/no-unsafe-function-type':'off', | ||
'prefer-const':'off', | ||
'no-unused-vars':'off', | ||
'no-var':'off', | ||
|
||
// --------------------------------------- | ||
// FORMATTING (this rules are deprecated) | ||
// Though it seems these still work for me in VS Code? | ||
'eol-last': ['warn', 'always'], | ||
'quotes': ['warn', 'single'], | ||
'semi': ['warn', 'never'], | ||
'indent': ['warn', 2, { | ||
SwitchCase: 1, | ||
}], | ||
'no-trailing-spaces': 'warn', | ||
'no-multi-spaces': 'warn', | ||
'no-multiple-empty-lines': 'warn', | ||
'object-curly-spacing': ['warn', 'never'], | ||
'array-bracket-spacing': ['warn', 'never'], | ||
// --------------------------------------- | ||
}, | ||
} | ||
] | ||
|
||
export default eslintConfig |
Oops, something went wrong.