-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ESLint to version 9 and migrate to flat config format. * **Add `eslint.config.mjs`**: Create a new file `eslint.config.mjs` with the flat config format for ESLint, including necessary plugins, parser options, rules, and ignore patterns. * **Remove `.eslintrc.js`**: Delete the file `.eslintrc.js`. * **Remove `.eslintignore`**: Delete the file `.eslintignore`. * **Update `package.json`**: - Change ESLint version to `^9.0.0` in `devDependencies`. - Update `lint` and `format` scripts to use the new ESLint configuration. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/vega/vega-tooltip?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
Showing
4 changed files
with
82 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
import js from '@eslint/js'; | ||
import typescriptParser from '@typescript-eslint/parser'; | ||
import typescriptPlugin from '@typescript-eslint/eslint-plugin'; | ||
import prettierPlugin from 'eslint-plugin-prettier'; | ||
import jestPlugin from 'eslint-plugin-jest'; | ||
import prettierConfig from 'eslint-config-prettier'; | ||
|
||
const compat = new FlatCompat(); | ||
|
||
export default [ | ||
js.configs.recommended, | ||
jestPlugin.configs.recommended, | ||
jestPlugin.configs.style, | ||
typescriptPlugin.configs.recommended, | ||
prettierConfig, | ||
{ | ||
files: ['*.ts'], | ||
ignores: [ | ||
'.eslintrc.js', | ||
'babel.config.js', | ||
'prettier.config.js', | ||
'jest.config.js', | ||
'rollup.config.js', | ||
'build', | ||
'build-es5', | ||
'dist', | ||
'coverage', | ||
'types' | ||
], | ||
languageOptions: { | ||
parser: typescriptParser, | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
ecmaVersion: 2020, | ||
sourceType: 'module' | ||
} | ||
}, | ||
plugins: { | ||
'@typescript-eslint': typescriptPlugin, | ||
prettier: prettierPlugin, | ||
jest: jestPlugin | ||
}, | ||
rules: { | ||
'prettier/prettier': 'warn', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/ban-types': 'warn', | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
'@typescript-eslint/prefer-for-of': 'error', | ||
'@typescript-eslint/no-for-in-array': 'error', | ||
'@typescript-eslint/no-require-imports': 'error', | ||
'@typescript-eslint/no-parameter-properties': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
vars: 'all', | ||
args: 'after-used', | ||
ignoreRestSiblings: true | ||
} | ||
], | ||
'no-shadow': 'off', | ||
'@typescript-eslint/no-shadow': 'error', | ||
'@typescript-eslint/no-object-literal-type-assertion': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-namespace': 'error', | ||
'jest/no-conditional-expect': 'off', | ||
'linebreak-style': ['error', 'unix'], | ||
'no-irregular-whitespace': ['error', { skipComments: true }], | ||
'no-alert': 'error', | ||
'prefer-const': 'error', | ||
'no-return-assign': 'error', | ||
'no-useless-call': 'error', | ||
'no-useless-concat': 'error', | ||
'prefer-template': 'error', | ||
'no-undef': 'off', | ||
'no-unreachable': 'off' | ||
} | ||
} | ||
]; |
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