@W-22655367: [WIP] LWC engine POC#467
Conversation
|
Git2Gus App is installed but the |
|
Thanks for the contribution! Unfortunately we can't verify the commit author(s): pragya.dave <p***@s***.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, refresh the status of this Pull Request. |
aruntyagiTutu
left a comment
There was a problem hiding this comment.
Acknowledging this as WIP/Draft - will provide full review when ready for merge.
High-level observations on the POC design:
Architecture (looks solid):
- One rule per LWC error code (LWC1001, LWC1016, etc.) - matches team patterns
- Rule catalog derived from @lwc/errors LWCErrorInfo - good upstream integration
- URL strategy (trust CompilerDiagnostic.url only) - pragmatic, no synthetic fallbacks
Open Questions (per your description):
-
Severity mapping - LWC 4-level vs Code Analyzer 5-level + SARIF note support
- Recommend option (c) if Log diagnostics have value - push note support into core
- Otherwise option (b) (filter Log) keeps it simple
-
Pre-existing lint failure in apexguru-engine
- This should be fixed before final merge (no --no-verify commits)
- See guideline: "Never skip hooks (--no-verify) unless explicitly asked"
When ready for full review, convert from draft and will check:
- Performance (compilation hot paths)
- Cross-platform (LWC compiler behavior)
- Testing coverage
- Error handling for workspace structure variations
Nice work on the POC structure!
Summary
POC for a new
code-analyzer-lwc-enginepackage that integrates the LWC compiler as a Code Analyzer engine. Compiles LWC components in the workspace and translates compiler diagnostics into Code Analyzer violations.Design Decisions
Rule Model
One Code Analyzer rule per LWC error code — e.g.
LWC1001,LWC1016,LWC1121. EachCompilerDiagnosticmaps to aViolationwhoseruleName=LWC${d.code}.--rule-selector LWC1016@lwc/errorsLWCErrorInfoentriesURL Strategy
resourceUrls: d.url ? [d.url] : []— trustCompilerDiagnostic.urlonly. No fallback, no local map, no convention synthesis.urlpopulated; we accept the gapOpen Gaps / Known Issues
Severity Mapping
LWC has 4 levels (
Fatal=0, Error=1, Warning=2, Log=3) and Code Analyzer has 5 (Critical=1, High=2, Moderate=3, Low=4, Info=5). The two don't line up cleanly. Additionally:error, Warning →warning, Log →noteseverity < 3 → error, elsewarning(never emitsnote)DiagnosticLevel.Logcannot round-trip through Code Analyzer's SARIF asnoteOptions:
warningin SARIFtoSarifNotificationLevelto supportnoteNeeds team input before finalizing.
Pre-existing lint failure
apexguru-enginehas a pre-existingno-constant-conditionlint error (not from this PR) — committed with--no-verify.