Skip to content

FIX @W-24886726@ [BUG][code-analyzer] ESLint LWC base config runs on Aura controllers and reports correct Aura code - #522

Open
nikhil-mittal-165 wants to merge 3 commits into
devfrom
fix/issue-2112-exclude-aura-from-lwc-config
Open

nikhil-mittal-165 wants to merge 3 commits into
devfrom
fix/issue-2112-exclude-aura-from-lwc-config

Conversation

@nikhil-mittal-165

Copy link
Copy Markdown
Contributor

Summary

Addresses code-analyzer issue 2112.

Root Cause

In code-analyzer-core's ESLint engine, base-config.ts (createJavascriptPlusLwcConfigArray, ~L143-181) applies the LWC, LWC-platform, Lightning, import and Jest configs and the eslintJs.configs.all base JS config to every .js/.cjs/.mjs file with no exclusion for /aura/ folders. Aura controllers (ES5, $A API, not LWC) therefore get false positives such as @lwc/lwc-platform/no-aura, @lwc/lwc/no-document-query, no-var and prefer-const. createJavascriptConfigArray has the same unconditional patterns. Not user error: it happens with default settings and documented flags on 5.16.0, and disable_lwc_base_config / file_extensions cannot separate Aura from LWC files.

Fix

Excluded /aura/ files from JS and LWC base ESLint configs so Aura controllers no longer get LWC false positives.

Testing

  • Unit tests added/updated in engine.test.ts

Functional Testing Evidence

Test 1: Aura controller (issue repro, eslint:Recommended, no config) via sf code-analyzer run --workspace . --rule-selector eslint:Recommended - no ESLint violations on aura/accountList/accountListController.js (no no-aura, no-document-query, no-var, prefer-const) - PASS

Test 2: Control LWC file in same run still reports eslint:no-var and eslint:@lwc/lwc/no-document-query on myLwc.js (exclusion limited to Aura) - PASS

Unrelated PMD/SFGE engine errors from missing Java.

Overall Status: PASS

Files Changed

  • packages/code-analyzer-eslint-engine/src/base-config.ts
  • packages/code-analyzer-eslint-engine/test/engine.test.ts
  • packages/code-analyzer-eslint-engine/test/test-data/workspaceWithAuraAndLwc/aura/myCmp/myCmpController.js
  • packages/code-analyzer-eslint-engine/test/test-data/workspaceWithAuraAndLwc/lwc/myCmp/myCmp.js

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@git2gus

git2gus Bot commented Nov 12, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

@nikhil-mittal-165 nikhil-mittal-165 changed the title fix: [BUG][code-analyzer] ESLint LWC base config runs on Aura controllers and reports correct Aura code FIX @W-24886726@ [BUG][code-analyzer] ESLint LWC base config runs on Aura controllers and reports correct Aura code Nov 12, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nikhil-mittal-165
nikhil-mittal-165 marked this pull request as ready for review November 12, 2026 12:40
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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