Skip to content

NEW(eslint): @W-18669872@: Enhance progress events for eslint v9 engine #306

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 4 commits into from
Jun 6, 2025

Conversation

stephen-carter-at-sf
Copy link
Collaborator

No description provided.

@@ -104,7 +104,6 @@ export class BaseConfigFactory {
configs.push({
...conf,
files: this.engineConfig.file_extensions.typescript.map(ext => `**/*${ext}`),
ignores: this.engineConfig.file_extensions.javascript.map(ext => `**/*${ext}`), // TODO: Confirm whether this works or not
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 turns out this wasn't needed. :-)

Comment on lines +156 to +161
if (specifiedRules.has(violation.ruleName)) {
violations.push(violation);
} else {
// This may be possible if a user tries to suppress an eslint rule in their code that isn't available. We just ignore it but debug it just in case.
this.emitLogEvent(LogLevel.Debug, getMessage('ViolationFoundFromUnregisteredRule', violation.ruleName, JSON.stringify(violation,null,2)))
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix as you go item: This code was with the eslint 8 engine... I didn't think we would need it with eslint 9's ruleFilter but as I did my full gambit of tests... it turns out we still do.

Comment on lines +69 to +72
ViolationFoundFromUnregisteredRule:
`A rule with name '%s' produced a violation, but this rule was not registered with the 'eslint' engine so it will not be included in the results.\n` +
`This may occur if in your file you are using inline comments to attempt to disable or configure this rule even though it is unknown to ESLint and Code Analyzer.\n` +
`Ignored Violation:\n%s`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This already exististed with eslint 8... just pulled it into eslint 9... so no need for UI text review here.

Comment on lines +31 to +35
// ESLint doesn't natively know about various browser and node globals. So we add them here to
// remove false positives for our users.
... globals.node,
... globals.browser,
... globals.es2017
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix as you go item in response to seeing noise when scanning a ton of repos. This should make users happy :-)

expect(logEvents).toContainEqual({
type: EventType.LogEvent,
logLevel: LogLevel.Debug,
message: getMessage('ViolationFoundFromUnregisteredRule', 'oops-rule', JSON.stringify(filteredViolation, null, 2))
Copy link
Contributor

Choose a reason for hiding this comment

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

What is our rationale for logging these violations instead of just including them with the results? I can't remember, and now that I'm seeing it again it looks weird to me.

Copy link
Collaborator Author

@stephen-carter-at-sf stephen-carter-at-sf Jun 6, 2025

Choose a reason for hiding this comment

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

Good question. We do the same thing with eslint 8. Basically the rule name associated with the violation that eslint produces isn't one of the rules selected.

Basically ESLint 8 and 9 both create a proper violation that ends up in our official engine results whenever it wants to complain that a directive is used for an unknown rule. But Core complains when a violation associated with a rule that wasn't selected show up. This makes the engine fail completely since it is a post engine validation check - which we don't want.

Ideally ESLint 8 and 9 should just emit a warning. It's odd that it adds this as a violation. This is even more odd given that the ruleFilter doesn't include this rule. So ESLint is kind of violating their own contract in reporting a violation for a rule that wasn't in the ruleFilter gate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, yeah, the core requirement that all violations be for rules that actually exist does totally justify the current behavior.

@stephen-carter-at-sf stephen-carter-at-sf merged commit f2be7d5 into dev Jun 6, 2025
7 checks passed
@stephen-carter-at-sf stephen-carter-at-sf deleted the sc/eslintUpdates branch June 6, 2025 16:00
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.

2 participants