Uncertain De‑precation Timeline for Legacy .eslintrc in ESLint 9
0 reputation · 07 Jan 2025, 23:48 UTC
0 reputation · 07 Jan 2025, 23:48 UTC
Determine a clear migration path for projects still using legacy .eslintrc files when upgrading to ESLint 9, given the documented shift to the flat‑config system and the ongoing ambiguity about when legacy support will be removed.
The flat‑config model replaces the directory‑based cascade of legacy .eslintrc files with an ordered array of configuration objects, changing how rule overrides and ignore patterns are processed. While ESLint 9 continues to support legacy files, the community has not yet defined a concrete de‑precation schedule, leaving teams unsure whether to invest in a gradual transition or a quick rewrite.
.eslintrc files, and what version will serve as the de‑precation cutoff?.eslintignore and node_modules defaults in the new flat‑config environment?35775 reputation · 08 Jan 2025, 02:45 UTC
ESLint has not announced a specific version or date for removing legacy .eslintrc support. Legacy files continue to work in the ESLint 9 line alongside flat config, so treat removal as a future major-version event rather than an ESLint 9.x change. There is no committed deprecation cutoff to wait for.
Confirmed: ESLint 9 defaults to flat config while still reading legacy .eslintrc files. Flat config uses an ordered array of configuration objects instead of a directory-based cascade, and flat config does not automatically read .eslintignore.
Likely explanation, not a commitment: ESLint is preserving legacy support through v9 to permit gradual migration. Because no cutoff is published, schedule migration now instead of waiting for a deprecation notice.
The legacy nearest-file-wins directory cascade does not map one-to-one. In flat config, later matching entries generally override earlier ones for the same file and rule. Express each override level as explicit files globs, ordered from broad to specific.
import js from "@eslint/js";
import tseslint from "typescript-eslint";
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts"],
rules: { "@typescript-eslint/no-unused-vars": "warn" },
},
{
files: ["src/**/*.ts"],
rules: { "@typescript-eslint/no-unused-vars": "error" },
},
{
files: ["src/**/legacy.ts"],
rules: { "@typescript-eslint/no-unused-vars": "off" },
},
];
Flat config does not automatically import .eslintignore. Add an explicit ignores array, typically in a broad object first, covering node_modules, build outputs, and generated files. Verify whether your installed ESLint 9 patch excludes node_modules by default before relying on it.
export default [
{
ignores: ["node_modules/**", "dist/**", "build/**", "*.config.js"],
},
// configuration objects follow
];
eslint --version and list .eslintrc.*, .eslintignore, and eslint.config.* files to determine which config system is active.eslint.config.js or eslint.config.mjs with broad plugin configs first, then file-specific overrides and an ignores object.eslint --print-config <file> on representative files before and after migration; compare merged rules, languageOptions, plugins, and effective ignores..eslintrc.* and .eslintignore.Provide your exact eslint --version and whether ESLINT_USE_FLAT_CONFIG, legacy .eslintrc.*, .eslintignore, or eslint.config.* files exist. That detail determines whether a gradual per-directory migration or a single flat-config rewrite is appropriate.
node_modules exclusion may vary by patch version; verify per installation.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.