-
Notifications
You must be signed in to change notification settings - Fork 141
Bump ESLint and update linting rules #2878
Copy link
Copy link
Open
Description
Please confirm that you have searched existing issues in the repo
Yes, I have searched the existing issues
Any related issues?
What is the area that this feature belongs to?
Code Quality, Syntax
Is your feature request related to a problem? Please describe.
Our current ESLint configuration and ruleset are outdated and are starting to hold back our development, particularly when using modern ECMAScript features. As noted in recent PRs, it's time to bump our ESLint dependency and modernize our .eslintrc.js file.
Some noted issues:
- Outdated Lodash Rules: We currently rely on
plugin:lodash/recommended(added a few years ago). Modern JS/Node has native equivalents for many Lodash methods, so we shouldn't enforce Lodash usage by default or depend on it unnecessarily. for...ofLoop Restrictions: We need to use// eslint-disable-next-line no-restricted-syntaxto usefor...ofloops (e.g.,for (const ext of possibleExts)). But is really applicable pre-2016 , as highlighted by @Harjun751 in Add support for both CJS/ESM plugins #2876
- ESM &
import.metaParsing: As highlighted by @Harjun751 in Migrate CLI output from CJS to ESM #2836, linting currently fails onimport.metaand ESM-only syntax in functional tests because it falls back to a CommonJStsconfig.lint.json.
- ESLint v9 Flat Config Migration:: If bump ESLint to version 9.x,
.eslintrc.jsformat used is deprecated. Migrate to new "Flat Config" format (eslint.config.js). Changes how plugins, ignores, and overrides are declared, considerable massive rewrite, else just bump to ESLint v8.x, not v9. - Airbnb Config is Stagnant: we extend
airbnb-baseandairbnb-typescript/base, but it is overly strict and may not have adapted to modern JS/TS paradigms. Consider switching to standard@eslint/jsrecommended configs and@typescript-eslint/recommended, which are much easier to maintain. - Environment Flags: We have
"env": { "node": true, "es6": true, "jest": true }. If we are moving to ESM (import/exportandimport.meta), we will also want to ensure our TS parser or ESLint environment is recognizing ES2022+ so modern globals are properly linted without errors.
Some (Non-exhaustive) Tasks to consider:
- Bump ESLint to the latest version to support modern ECMAScript features natively.
- Update
@typescript-eslintpackages to their latest compatible versions. - Fix
no-restricted-syntax: Remove the restriction onForOfStatement. - Re-evaluate Lodash Plugin: Remove or downgrade
plugin:lodash/recommendedto allow native JS methods, or use a more modern alternative. - Fix ESM Parsing: Update parser options so ESLint’s type-aware setup correctly recognizes
NodeNext/ESM. (e.g., wiring the CLItsconfiginto the root ESLint config or addingparserOptions.project: ['./tsconfig.lint.json']to the TS override inpackages/cli/.eslintrc.cjs).
Describe the solution you'd like
Updated dev tooling for our linter
Describe alternatives you've considered
No response
Additional context
Thanks @Harjun751 for suggesting this, feel free to add on to this laundry list as we continue development, created the issue for tracking
Reactions are currently unavailable