-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Unified ESLint rule profiles + flipped warns to error/off across all workspaces #28839
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
Open
9larsons
wants to merge
6
commits into
main
Choose a base branch
from
eslint-unify-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e96901e
Unified ESLint rule profiles + flipped warns to error/off across all …
9larsons 4b5578f
Collapsed ESLint configs to 2 unified factories (reactAppConfig + nod…
9larsons 5665c2e
Fixed 4 factory bugs surfaced by agent review
9larsons 6a352a2
Deduplicated standalone configs + tightened TODO/LEGACY annotations +…
9larsons 2cc30dc
Tightened factory validation + renamed localFilenamesMode + clarified…
9larsons c539ac7
Fixed CI-breaking settings:undefined + extended ghost-core+admin-x-fr…
9larsons File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,98 +1,6 @@ | ||
| import js from '@eslint/js'; | ||
| import globals from 'globals'; | ||
| import ghostPlugin from 'eslint-plugin-ghost'; | ||
| import reactPlugin from 'eslint-plugin-react'; | ||
| import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
| import reactRefreshPlugin from 'eslint-plugin-react-refresh'; | ||
| import tailwindcssPlugin from 'eslint-plugin-tailwindcss'; | ||
| import tseslint from 'typescript-eslint'; | ||
| import {reactAppConfig} from '../../eslint.shared.mjs'; | ||
|
|
||
| import { | ||
| correctnessRules, | ||
| mochaRulesOff, | ||
| reactDefaultsOff, | ||
| reactStrictRules, | ||
| shadeLayeredImportsRule, | ||
| sortImportsRule, | ||
| tailwindRulesV4, | ||
| tsUnusedVarsRule | ||
| } from '../../eslint.shared.mjs'; | ||
|
|
||
| const tailwindCssConfig = `${import.meta.dirname}/../admin/src/index.css`; | ||
|
|
||
| const reactFlat = reactPlugin.configs.flat.recommended; | ||
|
|
||
| export default tseslint.config( | ||
| { | ||
| ignores: ['dist/**/*'] | ||
| }, | ||
| { | ||
| files: ['src/**/*.{js,ts,cjs,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| languageOptions: { | ||
| ...reactFlat.languageOptions, | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node | ||
| } | ||
| }, | ||
| plugins: { | ||
| ...reactFlat.plugins, | ||
| ghost: ghostPlugin, | ||
| 'react-hooks': reactHooksPlugin, | ||
| 'react-refresh': reactRefreshPlugin, | ||
| tailwindcss: tailwindcssPlugin | ||
| }, | ||
| settings: { | ||
| react: {version: 'detect'}, | ||
| tailwindcss: {config: tailwindCssConfig} | ||
| }, | ||
| rules: { | ||
| ...js.configs.recommended.rules, | ||
| ...reactFlat.rules, | ||
| ...reactHooksPlugin.configs.recommended.rules, | ||
| ...correctnessRules, | ||
| ...tsUnusedVarsRule, | ||
| ...reactDefaultsOff, | ||
| ...reactStrictRules, | ||
| ...sortImportsRule, | ||
| ...shadeLayeredImportsRule, | ||
| ...tailwindRulesV4, | ||
| 'no-undef': 'off', | ||
| 'no-redeclare': 'off', | ||
| 'no-unexpected-multiline': 'off', | ||
| 'no-shadow': 'off', | ||
| '@typescript-eslint/no-shadow': 'error', | ||
| 'react-refresh/only-export-components': 'off', | ||
| '@typescript-eslint/no-inferrable-types': 'off', | ||
| '@typescript-eslint/no-non-null-assertion': 'off', | ||
| '@typescript-eslint/no-empty-function': 'off' | ||
| } | ||
| }, | ||
| { | ||
| files: ['test/**/*.{js,ts,cjs,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| languageOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| ...globals.vitest, | ||
| vi: 'readonly' | ||
| } | ||
| }, | ||
| plugins: { | ||
| ghost: ghostPlugin | ||
| }, | ||
| rules: { | ||
| ...correctnessRules, | ||
| ...tsUnusedVarsRule, | ||
| ...mochaRulesOff(ghostPlugin), | ||
| 'no-undef': 'off', | ||
| '@typescript-eslint/no-inferrable-types': 'off' | ||
| } | ||
| } | ||
| ); | ||
| export default await reactAppConfig({ | ||
| tailwindCssPath: `${import.meta.dirname}/../admin/src/index.css`, | ||
| shadeRestricted: true | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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,96 +1,7 @@ | ||
| import js from '@eslint/js'; | ||
| import globals from 'globals'; | ||
| import ghostPlugin from 'eslint-plugin-ghost'; | ||
| import reactPlugin from 'eslint-plugin-react'; | ||
| import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
| import reactRefreshPlugin from 'eslint-plugin-react-refresh'; | ||
| import tailwindcssPlugin from 'eslint-plugin-tailwindcss'; | ||
| import tseslint from 'typescript-eslint'; | ||
| import {reactAppConfig} from '../../eslint.shared.mjs'; | ||
|
|
||
| import { | ||
| correctnessRules, | ||
| mochaRulesOff, | ||
| reactDefaultsOff, | ||
| reactStrictRules, | ||
| tailwindRulesV4, | ||
| tsUnusedVarsRule | ||
| } from '../../eslint.shared.mjs'; | ||
|
|
||
| const tailwindCssConfig = `${import.meta.dirname}/../admin/src/index.css`; | ||
|
|
||
| const reactFlat = reactPlugin.configs.flat.recommended; | ||
|
|
||
| export default tseslint.config( | ||
| { | ||
| ignores: ['dist/**/*', 'storybook-static/**/*'] | ||
| }, | ||
| { | ||
| files: ['src/**/*.{js,ts,cjs,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| languageOptions: { | ||
| ...reactFlat.languageOptions, | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node | ||
| } | ||
| }, | ||
| plugins: { | ||
| ...reactFlat.plugins, | ||
| ghost: ghostPlugin, | ||
| 'react-hooks': reactHooksPlugin, | ||
| 'react-refresh': reactRefreshPlugin, | ||
| tailwindcss: tailwindcssPlugin | ||
| }, | ||
| settings: { | ||
| react: {version: 'detect'}, | ||
| tailwindcss: {config: tailwindCssConfig} | ||
| }, | ||
| rules: { | ||
| ...js.configs.recommended.rules, | ||
| ...reactFlat.rules, | ||
| ...reactHooksPlugin.configs.recommended.rules, | ||
| ...correctnessRules, | ||
| ...tsUnusedVarsRule, | ||
| ...reactDefaultsOff, | ||
| ...reactStrictRules, | ||
| ...tailwindRulesV4, | ||
| // TS handles these — disable the base ESLint variants | ||
| 'no-undef': 'off', | ||
| 'no-redeclare': 'off', | ||
| 'no-unexpected-multiline': 'off', | ||
| '@typescript-eslint/no-inferrable-types': 'off' | ||
| } | ||
| }, | ||
| // Storybook story files — render() functions intentionally use hooks | ||
| { | ||
| files: ['**/*.stories.{ts,tsx,js,jsx}'], | ||
| rules: { | ||
| 'react-hooks/rules-of-hooks': 'off' | ||
| } | ||
| }, | ||
| { | ||
| files: ['test/**/*.{js,ts,cjs,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| languageOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| ...globals.vitest, | ||
| vi: 'readonly' | ||
| } | ||
| }, | ||
| plugins: { | ||
| ghost: ghostPlugin | ||
| }, | ||
| rules: { | ||
| ...correctnessRules, | ||
| ...tsUnusedVarsRule, | ||
| ...mochaRulesOff(ghostPlugin), | ||
| '@typescript-eslint/no-inferrable-types': 'off' | ||
| } | ||
| } | ||
| ); | ||
| export default await reactAppConfig({ | ||
| tailwindCssPath: `${import.meta.dirname}/../admin/src/index.css`, | ||
| ignores: ['dist/**/*', 'storybook-static/**/*'], | ||
| storybook: 'storiesBlock' | ||
| }); |
This file contains hidden or 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,85 +1,10 @@ | ||
| import js from '@eslint/js'; | ||
| import globals from 'globals'; | ||
| import ghostPlugin from 'eslint-plugin-ghost'; | ||
| import reactPlugin from 'eslint-plugin-react'; | ||
| import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
| import reactRefreshPlugin from 'eslint-plugin-react-refresh'; | ||
| import tseslint from 'typescript-eslint'; | ||
| import {reactAppConfig} from '../../eslint.shared.mjs'; | ||
|
|
||
| import { | ||
| correctnessRules, | ||
| mochaRulesOff, | ||
| reactDefaultsOff, | ||
| reactStrictRules, | ||
| shadeLayeredImportsRule, | ||
| tsUnusedVarsRule | ||
| } from '../../eslint.shared.mjs'; | ||
|
|
||
| const reactFlat = reactPlugin.configs.flat.recommended; | ||
|
|
||
| export default tseslint.config( | ||
| { | ||
| ignores: ['dist/**/*'] | ||
| }, | ||
| { | ||
| files: ['src/**/*.{js,ts,cjs,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| languageOptions: { | ||
| ...reactFlat.languageOptions, | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node | ||
| } | ||
| }, | ||
| plugins: { | ||
| ...reactFlat.plugins, | ||
| ghost: ghostPlugin, | ||
| 'react-hooks': reactHooksPlugin, | ||
| 'react-refresh': reactRefreshPlugin | ||
| }, | ||
| settings: { | ||
| react: {version: 'detect'} | ||
| }, | ||
| rules: { | ||
| ...js.configs.recommended.rules, | ||
| ...reactFlat.rules, | ||
| ...reactHooksPlugin.configs.recommended.rules, | ||
| ...correctnessRules, | ||
| ...tsUnusedVarsRule, | ||
| ...reactDefaultsOff, | ||
| ...reactStrictRules, | ||
| ...shadeLayeredImportsRule, | ||
| // TS handles these — disable the base ESLint variants | ||
| 'no-undef': 'off', | ||
| 'no-redeclare': 'off', | ||
| 'no-unexpected-multiline': 'off', | ||
| '@typescript-eslint/no-inferrable-types': 'off' | ||
| } | ||
| }, | ||
| { | ||
| files: ['test/**/*.{js,ts,cjs,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| languageOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| ...globals.vitest, | ||
| vi: 'readonly' | ||
| } | ||
| }, | ||
| plugins: { | ||
| ghost: ghostPlugin | ||
| }, | ||
| rules: { | ||
| ...correctnessRules, | ||
| ...tsUnusedVarsRule, | ||
| ...mochaRulesOff(ghostPlugin), | ||
| '@typescript-eslint/no-inferrable-types': 'off', | ||
| '@typescript-eslint/no-explicit-any': 'off' | ||
| } | ||
| export default await reactAppConfig({ | ||
| shadeRestricted: true, | ||
| extraTestRules: { | ||
| // TODO: 71 legacy violations in test/ — mostly mock-fixture typing | ||
| // shortcuts. Cleanup PR will type them properly and flip back. | ||
| '@typescript-eslint/no-explicit-any': 'off' | ||
| } | ||
| ); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
strictLinterOptionscurrently disables the strict behavior.Line 18 applies
strictLinterOptions, but the shared preset currently setsreportUnusedDisableDirectivesto'off', so staleeslint-disabledirectives will not fail CI as intended.🔧 Proposed fix (in
eslint.shared.mjs)export const strictLinterOptions = { linterOptions: { - reportUnusedDisableDirectives: 'off' + reportUnusedDisableDirectives: 'error' } };🤖 Prompt for AI Agents