-
Notifications
You must be signed in to change notification settings - Fork 11
Migrate to ESLint 9 flat config format #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
4cd6b94
2c8b08a
5dad4d7
59b836e
8ec8198
38e8da7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,109 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const eslint = require('@eslint/js') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const tseslint = require('typescript-eslint') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const jestPlugin = require('eslint-plugin-jest') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const githubPlugin = require('eslint-plugin-github') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prettierPlugin = require('eslint-plugin-prettier') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| module.exports = tseslint.config( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Ignore patterns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ignores: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '**/node_modules/**', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '**/dist/**', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '**/coverage/**', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '**/*.json' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Base ESLint recommended rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| eslint.configs.recommended, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TypeScript recommended configurations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...tseslint.configs.recommended, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TypeScript files configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| files: ['**/*.ts'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| languageOptions: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parserOptions: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| projectService: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tsconfigRootDir: __dirname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| plugins: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jest: jestPlugin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| github: githubPlugin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prettier: prettierPlugin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rules: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ESLint core rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'camelcase': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'no-console': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'no-unused-vars': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'semi': ['error', 'never'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'func-call-spacing': ['error', 'never'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Prettier integration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'prettier/prettier': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TypeScript custom rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/array-type': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/await-thenable': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/ban-ts-comment': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/consistent-type-assertions': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/explicit-member-accessibility': [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { accessibility: 'no-public' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/explicit-function-return-type': [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { allowExpressions: true } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-array-constructor': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-empty-interface': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-explicit-any': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-extraneous-class': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-for-in-array': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-inferrable-types': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-misused-new': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-namespace': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-non-null-assertion': 'warn', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-require-imports': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-unnecessary-qualifier': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-unnecessary-type-assertion': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-unused-vars': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-useless-constructor': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-var-requires': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/prefer-for-of': 'warn', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/prefer-function-type': 'warn', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/prefer-includes': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/prefer-string-starts-ends-with': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/promise-function-async': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/require-array-sort-compare': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/restrict-plus-operands': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/space-before-function-paren': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/unbound-method': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // GitHub plugin rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'eslint-comments/no-use': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'eslint-comments/no-unused-disable': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'i18n-text/no-en': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'import/no-namespace': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Jest plugin rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...jestPlugin.configs.recommended.rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // JavaScript files configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| files: ['**/*.js'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...tseslint.configs.disableTypeChecked, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rules: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MishaKav marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Maintainability - Missing Jest Configuration: Add Jest plugin, globals, and relevant Jest rules to the JavaScript files configuration section to ensure consistent test file linting across both TypeScript and JavaScript.
Suggested change
Is this review accurate? Use 👍 or 👎 to rate itIf you want to tell us more, use
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /gs feedback this sugegstion is more then 30 lines, it very scare and hard to check |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Disable TypeScript-specific rules for JavaScript files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/explicit-function-return-type': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-explicit-any': 'off', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/explicit-member-accessibility': 'off' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.