Skip to content

NEW(eslint): @W-18495555@: Allow users to supply their own custom "flat" ESLint configuration file #302

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

Merged
merged 2 commits into from
Jun 3, 2025

Conversation

stephen-carter-at-sf
Copy link
Collaborator

No description provided.

@stephen-carter-at-sf stephen-carter-at-sf force-pushed the sc/eslintUpdates branch 3 times, most recently from afc4010 to 904ce44 Compare June 3, 2025 20:40
@@ -34,6 +34,7 @@ export class ESLintEngine extends Engine {
private readonly delegateV8Engine: Engine;
private userConfigInfoCache: Map<string, UserConfigInfo> = new Map();
private eslintContextCache: Map<string, ESLintContext> = new Map();
private workspaceIdsThatHaveWarnedAboutESLint8: Set<string> = new Set();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI only calls runRules after already calling describeRules. Is there a conceivable flow where that wouldn't be the case? If not, then do we really need this variable, or could we get away with only having the one check take place in describe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I went back and forth with this one... I really wanted to have a test though that confirmed that the run was being called on the v8 engine. I hope this will all go away once we stop supporting v8.

I guess I could just remove the warn check from the runRules test though. Let me me do that so I can remove this state... hold on...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK pushed commit

@stephen-carter-at-sf stephen-carter-at-sf merged commit d53063b into dev Jun 3, 2025
7 checks passed
Copy link
Collaborator

@jshackell-sfdc jshackell-sfdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I edited, I tried to roughly use the same terminology as in the ESLint docs (https://eslint.org/docs/latest/use/configure/migration-guide). They're a bit all over the map, but they mostly seem to use "flag configuration file" and "eslintrc configuration file." So I think we should include "eslintrc" in our messages too. And then, to make it even more clear, I landed on "legacy eslintrc ESLint configuration file" for the old stuff, and just "flat ESLint configuration file" for the new. A mouthful, I know, but hopefully it's clear and consistent with the ESLint docs. Let me know....

IgnoringFlatConfigFile: // TODO: Remove this as soon as we support user's providing their own flat config files
`Ignoring '%s' since ESLint "Flat" configuration files are not yet supported by this version of the 'eslint' engine.`,
DetectedLegacyConfig:
`Using ESLint v8 instead of ESLint v9 since the use of a "legacy" ESLint configuration file or ignore file was detected: %s.\n` +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Using ESLint v8 instead of ESLint v9 since the use of a "legacy" ESLint configuration file or ignore file was detected: %s.\n` +
`Using ESLint v8 instead of ESLint v9 because we detected the use of a legacy eslintrc ESLint configuration file or ignore file: %s.\n` +

`Ignoring '%s' since ESLint "Flat" configuration files are not yet supported by this version of the 'eslint' engine.`,
DetectedLegacyConfig:
`Using ESLint v8 instead of ESLint v9 since the use of a "legacy" ESLint configuration file or ignore file was detected: %s.\n` +
`Since ESLint v8 is no longer supported, Code Analyzer will be removing support for "legacy" ESLint configuration files in the coming months.\n` +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Since ESLint v8 is no longer supported, Code Analyzer will be removing support for "legacy" ESLint configuration files in the coming months.\n` +
`Because ESLint v8 is no longer supported, Code Analyzer will be removing support for legacy eslintrc ESLint configuration files in the coming months.\n` +

DetectedLegacyConfig:
`Using ESLint v8 instead of ESLint v9 since the use of a "legacy" ESLint configuration file or ignore file was detected: %s.\n` +
`Since ESLint v8 is no longer supported, Code Analyzer will be removing support for "legacy" ESLint configuration files in the coming months.\n` +
`Therefore, it is highly recommended that you migrate your "legacy" configuration to the new "flat" configuration format as soon as possible.\n` +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Therefore, it is highly recommended that you migrate your "legacy" configuration to the new "flat" configuration format as soon as possible.\n` +
`Therefore, we highly recommend that you migrate your legacy eslintrc configuration to the new flat configuration format as soon as possible.\n` +

InvalidLegacyConfigFileName:
`The '%s' configuration value is invalid. Expected the file name '%s' to be one of the following: %s`,
InvalidESLintConfigFileName:
`The '%s' configuration value is invalid. Expected either a "flat" ESLint configuration file that ends with %s or a known "legacy" ESLint configuration file name from among %s.`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`The '%s' configuration value is invalid. Expected either a "flat" ESLint configuration file that ends with %s or a known "legacy" ESLint configuration file name from among %s.`,
`The '%s' configuration value is invalid. Expected either a flat ESLint configuration file that ends with %s or a known legacy eslintrc ESLint configuration file name from among %s.`,

`Learn how at: https://eslint.org/docs/latest/use/configure/migration-guide`,

ApplyingFlatConfigFile:
`Applying the ESLint "flat" configuration file: %s`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Applying the ESLint "flat" configuration file: %s`,
`Applying the flat ESLint configuration file: %s`,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants