Back to Discover

#typescript linting

1 prompt found

ESLint v9 Flat Config Migration: .eslintrc and .eslintignore to eslint.config.js with typescript-eslint, React Plugins, and FlatCompat Fallbacks
๐Ÿ’ป Coding

ESLint v9 Flat Config Migration: .eslintrc and .eslintignore to eslint.config.js with typescript-eslint, React Plugins, and FlatCompat Fallbacks

PpromptstudioยทOct 5, 2026
No rating

Move a real project from legacy .eslintrc and .eslintignore files to an ESLint v9 eslint.config.js: overrides become file scoped objects, env becomes languageOptions.globals, plugins move to flat configs, typescript-eslint uses the project service, legacy shareable configs go through FlatCompat, and you get a package.json diff, CI command changes, and a parity check so no rule silently disappears.

Act as a JavaScript tooling engineer who has migrated monorepos and single apps from ESLint 8 eslintrc files to ESLint 9 flat config and knows which plugins ship flat configs and which still need the compatibility layer. Inputs: - Current .eslintrc file contents (json, js, or yaml) including overrides: [LegacyConfig] - Current .eslintignore contents and any ignorePatterns: [IgnoreFile] - package.json devDependencies with versions for eslint and every plugin or shared config: [LintDeps] - Module type (package.json type field) and TypeScript tsconfig layout: [ModuleSetup] - Lint scripts and CI commands that call eslint today: [LintScripts] - Inline eslint-env or eslint comments used in source files, if any: [InlineDirectives] - Output format: [Format] Generate: 1. Translation table: every key in LegacyConfig (root, env, parser, parserOptions, plugins, extends, settings, rules, overrides, ignorePatterns) with its flat config equivalent, for example env to languageOptions.globals using the globals package, overrides to separate objects with files and ignores, parser to languageOptions.parser. 2. Plugin readiness list from LintDeps: which packages export flat configs at the listed versions, which need a version bump, and which must be wrapped with FlatCompat from @eslint/eslintrc. Mark anything you are not sure of as VERIFY with the command to check. 3. A complete eslint.config.js (or eslint.config.mjs if ModuleSetup is CommonJS) in the right order: global ignores object first, js.configs.recommended, typescript-eslint configs, React and hooks, FlatCompat entries, file scoped overrides, then eslint-config-prettier last if Prettier is used. Use projectService for type aware rules when typescript-eslint is v8. 4. IgnoreFile converted into the ignores array with directory patterns ending in a slash, plus a note that ESLint 9 no longer reads .eslintignore. 5. package.json diff: packages to add, bump, and remove, and LintScripts rewritten without the removed --ext flag. 6. InlineDirectives fixes: replace eslint-env comments with file scoped globals and list the files to edit. 7. Parity check: run npx eslint --print-config on two representative files before and after, diff the rules, and list rules that changed severity or vanished, with the reason. Constraints: - Do not drop a rule silently. Every rule in LegacyConfig appears in the new file or in a REMOVED list with a reason. - Do not invent plugin export names. Unknown exports are VERIFY items. - No em dashes.