Skip to content

CHANGE @W-22462036@ fix: [BUG][code-analyzer] SSR checks done for LWC which are non lightning__ServerRenderable or lightning__ServerRenderableWithHydration (#2049)#471

Open
nikhil-mittal-165 wants to merge 1 commit into
devfrom
fix/issue-2049-ssr-processor
Open

CHANGE @W-22462036@ fix: [BUG][code-analyzer] SSR checks done for LWC which are non lightning__ServerRenderable or lightning__ServerRenderableWithHydration (#2049)#471
nikhil-mittal-165 wants to merge 1 commit into
devfrom
fix/issue-2049-ssr-processor

Conversation

@nikhil-mittal-165

Copy link
Copy Markdown
Contributor

Summary

Fixes forcedotcom/code-analyzer#2049

Root Cause

The SSR ESLint rules from @lwc/eslint-plugin-lwc are being applied to all LWC components instead of only SSR-enabled components. The root cause is that Code Analyzer's base-config.ts uses the LWC recommended configuration which includes SSR rules, but does not configure the SSR processor. The SSR processor (available at @lwc/eslint-plugin-lwc/processors/ssr) is designed to check each component's -meta.xml file for lightning__ServerRenderable or lightning__ServerRenderableWithHydration capabilities and only create virtual .ssrjs files for SSR components. Without the processor, SSR rules run on ALL LWC files regardless of their SSR capabilities.

Fix

Added SSR processor configuration to base-config.ts to prevent false positives on non-SSR LWC components. The fix requires adding processor: '@lwc/lwc/ssr' to the LWC configuration in base-config.ts createJavascriptPlusLwcConfigArray() and createLwcConfigArray() methods.

Testing

  • ✅ Unit tests added/updated
  • ✅ All tests passing
  • ✅ Lint checks passing

Functional Testing Evidence

Tested on Dreamhouse project:

Test 1: Non-SSR component with @salesforce/customPermission import

  • PASS (no SSR violations, only class-methods-use-this warning)

Test 2: SSR component with lightning__ServerRenderable

  • PASS (no violations)

Overall Status: PASS ✅

Files Changed

  • packages/code-analyzer-eslint-engine/src/base-config.ts
  • packages/code-analyzer-eslint-engine/test/ssr-processor.test.ts
  • packages/code-analyzer-eslint-engine/test/test-data/workspaceWithNonSSRLwc/helloWorld.js
  • packages/code-analyzer-eslint-engine/test/test-data/workspaceWithNonSSRLwc/helloWorld.js-meta.xml
  • packages/code-analyzer-eslint-engine/package.json

…n-SSR LWC components (#2049)

The SSR ESLint rules from @lwc/eslint-plugin-lwc were incorrectly firing
on all LWC components instead of only SSR-enabled components. This was
because Code Analyzer's base-config.ts uses the LWC recommended configuration
which includes SSR rules, but did not configure the SSR processor.

The SSR processor (@lwc/eslint-plugin-lwc/processors/ssr) is designed to
check each component's -meta.xml file for lightning__ServerRenderable or
lightning__ServerRenderableWithHydration capabilities and only create virtual
.ssrjs files for SSR components.

Changes:
- Added processor: '@lwc/lwc/ssr' to createJavascriptPlusLwcConfigArray()
  in base-config.ts
- Added test coverage for SSR processor configuration
- Created test data with non-SSR LWC component to verify fix
- Bumped version to 0.43.1-SNAPSHOT

Fixes issue where SSR rules were incorrectly flagging non-SSR components
that use browser globals or process.env.NODE_ENV.
@git2gus

git2gus Bot commented Jun 15, 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 marked this pull request as ready for review June 15, 2026 10:51
@nikhil-mittal-165 nikhil-mittal-165 changed the title fix: [BUG][code-analyzer] SSR checks done for LWC which are non lightning__ServerRenderable or lightning__ServerRenderableWithHydration (#2049) CHANGE @W-22462036@ fix: [BUG][code-analyzer] SSR checks done for LWC which are non lightning__ServerRenderable or lightning__ServerRenderableWithHydration (#2049) Jun 15, 2026
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.

[BUG][code-analyzer] SRR checks done for LWC which are non lightning__ServerRenderable or lightning__ServerRenderableWithHydration

1 participant