Repository navigation
Conversation
|
Git2Gus App is installed but the |
|
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Claude AI <c***@n***.g***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated. |
The LWC base config and the base JavaScript config apply to every .js file, so the LWC, LWC platform, Lightning, import, and Jest rules, and the rules that ask for syntax that ECMAScript 5 does not have, report correct Aura code. A new config, appended last for the files in an aura folder, turns those rules off. It turns them off rather than ignoring the files, so that the plugins stay registered and a user config that names one of their rules still works. Fixes forcedotcom#519. Also reported as forcedotcom/code-analyzer#2112.
dschach
force-pushed
the
fix/aura-files-lwc-base-config
branch
from
November 10, 2026 09:36
ac7eb68 to
af9e95d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #519. The same report is filed as forcedotcom/code-analyzer#2112.
What changes
The ESLint engine's LWC base config and base JavaScript config apply to every
.jsfile, so they also run on the JavaScript of Aura components: the controllers, helpers, and renderers in anaurafolder. Salesforce checks that JavaScript with@salesforce/eslint-plugin-aura, as ECMAScript 5, so these rules report correct Aura code. For example,@lwc/lwc-platform/no-aurareports every$A, andno-varreports everyvar.base-config.tsnow appends one config for**/aura/**/*.js(and the other LWC extensions) that turns off:@lwc/lwc,@lwc/lwc-platform,@salesforce/lightning,import, andjest;eslintJs.configs.allthat ask for syntax that ECMAScript 5 does not have, such asno-var,prefer-const,object-shorthand, andprefer-arrow-callback.The JavaScript-only path (
disable_lwc_base_config: true) gets the second part, and the LWC-only path (disable_javascript_base_config: true) gets the first.Why rules are turned off and not files ignored
ignores: ['**/aura/**']on the LWC configs would also unregister their plugins for Aura files. A user config that names an LWC rule for every JavaScript file would then make ESLint throw ("Could not find plugin"). With the rules turned off, the plugins stay registered, and a user config, which comes after the base config, can still turn any of these rules back on for Aura files.The engine sets each rule's status from the most severe setting across the files, so the rule list does not change for a workspace with Lightning web components. A workspace with only Aura files no longer lists the LWC rules, which do not apply to it.
Tests
A new workspace,
test/test-data/workspaceWithAuraFiles, holds the correct Aura controller from the issue and a Lightning web component with the samevaranddocument.querySelector. Four tests inengine.test.ts:no-varand@lwc/lwc/no-document-querystill reported on the Lightning web component;disable_lwc_base_config: true: the same for the ES2015+ rules;disable_javascript_base_config: true: the same for the LWC rules;@lwc/lwc/no-document-queryfor every JavaScript file applies to the Aura file too, and nothing throws.Without the change, the first three fail and the fourth passes. The existing rule goldfiles are unchanged.
The engine's
package.jsonversion goes to0.48.0-SNAPSHOT, for the snapshot version check. With the change, the engine's build, lint, and tests pass locally (333 tests, with every new line ofbase-config.tscovered), and so do the snapshot version check and the package interdependency check.The title
I do not have a work item number, so the title has none and the title check will fail. Please rename the pull request as you need.
🤖 Generated with Claude Code