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.
What's the problem this PR addresses?
Follow up to #6276 and #6352. The ESLint config has room for improvement
@typescript-eslint/naming-convention
rule config in@yarnpkg/eslint-config
is shadowed by the one ineslint.config.mjs
How did you fix it?
Wide include
The culprit is this line
berry/eslint.config.mjs
Line 43 in 57ed709
By only specifying a negated pattern, it matches ALL other files that are not globally ignored. Under flat config, each file matched by at least one config item (and is not globally ignored) is eligible for linting. This causes the VSCode plugin to attempt to lint pretty much every file.
The correct way to use both
files
andignores
to accurately specify the set of files to be linted. With that, we can simplify thetest:lint
command to just lint the whole repo and we have a single source of truth of what should be linted. This also aligns with the default behavior of ESLint v9 for when we migrate. I have also taken the opportunity to widen the typescript files globs to include.cts
and.mts
if we create those in the future.Ignore patterns
See #6276 (comment). Added a few missed ignores. Also grouped them by workspace.
Extraneous configs
See #6276 (comment). There are two sets of configs that specify jest globals for tests using
env
but that is not supported in flat config and has already been migrated in #6276.@typescript-eslint/naming-convention
The
@typescript-eslint/naming-convention
is configured twice, once in@yarnpkg/eslint-config
and once ineslint.config.mjs
. But due to a wide include glob in the latter, the former one is actually almost entirely shadowed -- it only takes effect onsources/index.ts
andsources/Plugin.ts
of each workspace.There are already ~100 violations of the rule that went unreported due to this shadowing. I have removed the shadowed config item since it isn't really being enforced. (Or is that actually intentional?)
Checklist