-
Notifications
You must be signed in to change notification settings - Fork 1
ci: phase-1 eslint hardening with flat config #92
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| const js = require('@eslint/js'); | ||
| const globals = require('globals'); | ||
| const importPlugin = require('eslint-plugin-import'); | ||
| const jestPlugin = require('eslint-plugin-jest'); | ||
| const reactPlugin = require('eslint-plugin-react'); | ||
| const reactHooksPlugin = require('eslint-plugin-react-hooks'); | ||
| const tsPlugin = require('@typescript-eslint/eslint-plugin'); | ||
| const tsParser = require('@typescript-eslint/parser'); | ||
| const unusedImportsPlugin = require('eslint-plugin-unused-imports'); | ||
|
|
||
| module.exports = [ | ||
| { | ||
| ignores: [ | ||
| 'node_modules/**', | ||
| 'dist/**', | ||
| 'build/**', | ||
| 'coverage/**', | ||
| 'scripts/**', | ||
| 'src/renderer/bundle.js', | ||
| 'src/renderer/bundle.js.map', | ||
| 'src/renderer/bundle.js.LICENSE.txt', | ||
| 'src/renderer/index.js', | ||
| 'src/renderer/index.js.map', | ||
| 'src/renderer/index.js.LICENSE.txt', | ||
| 'src/renderer/output.css', | ||
| ], | ||
| }, | ||
| js.configs.recommended, | ||
| { | ||
| files: ['src/**/*.{js,jsx,ts,tsx}', 'tests/**/*.{js,jsx,ts,tsx}'], | ||
|
Comment on lines
+1
to
+30
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. 1. @eslint/js major mismatch eslint.config.js requires top-level @eslint/js, but the repo still uses ESLint 8.57.1 (which depends on @eslint/js 8.57.1). This dual-major setup can cause ESLint to load an incompatible recommended ruleset or fail at runtime when initializing lint. Agent Prompt
|
||
| languageOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| 'unused-imports': unusedImportsPlugin, | ||
| }, | ||
| rules: { | ||
| 'no-unused-vars': 'off', | ||
| 'unused-imports/no-unused-imports': 'error', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['src/**/*.{js,jsx,ts,tsx}'], | ||
| plugins: { | ||
| import: importPlugin, | ||
| }, | ||
| rules: { | ||
| 'import/order': [ | ||
| 'error', | ||
| { | ||
| groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'], | ||
| 'newlines-between': 'always', | ||
| alphabetize: { order: 'asc', caseInsensitive: true }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.{jsx,tsx}'], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| ecmaFeatures: { | ||
| jsx: true, | ||
| }, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| react: reactPlugin, | ||
| 'react-hooks': reactHooksPlugin, | ||
| }, | ||
| settings: { | ||
| react: { | ||
| version: 'detect', | ||
| }, | ||
| }, | ||
| rules: { | ||
| ...reactPlugin.configs.recommended.rules, | ||
| 'react-hooks/rules-of-hooks': 'error', | ||
| 'react-hooks/exhaustive-deps': 'error', | ||
| 'react/react-in-jsx-scope': 'off', | ||
| 'react/prop-types': 'off', | ||
| }, | ||
| }, | ||
|
Comment on lines
+63
to
+88
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. The current configuration for JSX/TSX files might not enable JSX parsing for To ensure JSX is parsed correctly for all relevant files, you should add {
files: ['**/*.{jsx,tsx}'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...reactPlugin.configs.recommended.rules,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
}, |
||
| { | ||
| files: ['**/*.{ts,tsx}'], | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| parserOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
|
Comment on lines
+94
to
+95
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. |
||
| ecmaFeatures: { | ||
| jsx: true, | ||
| }, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| '@typescript-eslint': tsPlugin, | ||
| }, | ||
| rules: { | ||
| ...tsPlugin.configs.recommended.rules, | ||
| 'no-undef': 'off', | ||
| 'no-unused-vars': 'off', | ||
| '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
| '@typescript-eslint/no-require-imports': 'off', | ||
| '@typescript-eslint/no-explicit-any': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: [ | ||
| 'tests/**/*.{js,jsx,ts,tsx}', | ||
| 'src/**/__tests__/**/*.{js,jsx,ts,tsx}', | ||
| '**/*.test.{js,jsx,ts,tsx}', | ||
| '**/*.spec.{js,jsx,ts,tsx}', | ||
| ], | ||
| languageOptions: { | ||
| globals: { | ||
| ...globals.jest, | ||
| ...globals.node, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| jest: jestPlugin, | ||
| }, | ||
| rules: { | ||
| ...jestPlugin.configs.recommended.rules, | ||
| 'no-console': 'off', | ||
| 'jest/expect-expect': 'off', | ||
| 'jest/no-conditional-expect': 'off', | ||
| 'jest/no-standalone-expect': 'off', | ||
| }, | ||
| }, | ||
| ]; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 3384
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 716
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 1867
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 2582
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 2607
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 1485
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 1015
🏁 Script executed:
Repository: codingworkflow/ai-code-fusion
Length of output: 1037
Delete legacy
.eslintrc.jsandtests/.eslintrc.jsto complete the flat config migration.The new
eslint.config.jsis currently being ignored because ESLint prioritizes legacy.eslintrc.*files over flat config files when both exist. This means all the rule configurations in the new flat config—including the stricter rules, import ordering, and Jest relaxations—are not actually being applied. To activate the flat config, remove the legacy configuration files.🤖 Prompt for AI Agents