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
Conversation
…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 App is installed but the |
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.
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
Functional Testing Evidence
Tested on Dreamhouse project:
Test 1: Non-SSR component with @salesforce/customPermission import
Test 2: SSR component with lightning__ServerRenderable
Overall Status: PASS ✅
Files Changed