JS-1947 Group S2933 issues by class#7401
Conversation
This comment has been minimized.
This comment has been minimized.
e119f04 to
8b8f4c8
Compare
Code Review ✅ Approved 2 resolved / 2 findingsGroups S2933 reports by class while preserving member locations and aggregate quick fixes, incorporating an updated nyc ESM loader. Dependency cleanup resolved issues with extraneous Vue rule imports and decorator stability. ✅ 2 resolved✅ Bug: Removed eslint-plugin-vue dependency still imported by Vue rules
✅ Quality: Decorator silently degrades if upstream selector key changes
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
6571fc5 to
6a077ac
Compare
|
Follow-up note on inline ESLint suppressions: this grouping decorator intercepts raw upstream I do not think this should block JS-1947: inline suppressions for this rule are expected to be uncommon, and the PR improves the default reporting experience substantially. Handling this properly also deserves a generic solution for decorators that relocate or aggregate reports, instead of special-casing S2933 or duplicating ESLint directive semantics. Tracked as JS-2001: add a reusable metadata-driven guard so decorators can opt out of custom grouping/relocation when relevant inline ESLint disables are present, forwarding original reports and letting ESLint apply its native suppression logic. |
| if ( | ||
| classNode.range[0] <= index && | ||
| index <= classNode.range[1] && | ||
| (!owner || classNode.range[0] >= owner.range[0]) | ||
| ) { |
There was a problem hiding this comment.
Worth adding a comment about what this condition is checking because it's not clear to me
| }, | ||
| secondaryLocations, | ||
| ); | ||
| } |
There was a problem hiding this comment.
I saw that you tried to extract this reportGroupedIssue in a reusable helper in this commit: http://github.com/SonarSource/SonarJS/pull/7401/changes/bf16d3e62c8ba32c120dcbc04416bf004fa21efc
But it was then reverted. Why not having this in a separate helper ?
19e668c to
9eabe4d
Compare
Refactor the S2933 (prefer-readonly) grouping decorator and address review findings: - Reuse the shared interceptReport helper instead of hand-rolling context interception. - Route the fallback path through report() so forwarded issues stay encoded and decodable under hasSecondaries (was throwing in decode). - Delegate location/message resolution to location.ts helpers. - Extract the "group an upstream rule's reports into one issue with secondary locations" mechanism into helpers/decorators/grouper.ts; S2933 becomes a thin consumer. - Fail loudly when the decorated rule registers listeners but none under the configured selector (upstream selector rename), while treating a fully empty listener (sanitized/inactive rule) as a no-op. - Sort and drop overlapping combined fixes so a grouped quick fix can never crash file analysis, and pin the merged edit in the integration test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9eabe4d to
bf66c89
Compare
|
Code Review ✅ Approved 8 resolved / 8 findingsGroups S2933 reports by class and integrates an NYC ESM loader, resolving identified dependency issues and messaging inconsistencies. No open findings remain. ✅ 8 resolved✅ Bug: Removed eslint-plugin-vue dependency still imported by Vue rules
✅ Quality: Decorator silently degrades if upstream selector key changes
✅ Edge Case: Overlapping upstream fixes are silently dropped from combined fix
✅ Quality: convert-source-map imported as an undeclared (phantom) dependency
✅ Quality: convert-source-map uses caret range vs. repo's exact pins
...and 3 more resolved from earlier reviews OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |




Summary
Recreates the closed work from #7366 on top of the latest
origin/master, using the new JS Jira key instead of the oldAT-23branch.This groups
S2933(typescript-eslint/prefer-readonly) reports by class, preserving each readonly-eligible member as a secondary location and keeping the aggregate quick fix for addingreadonly.The branch also carries the nyc ESM loader source-map fallback from the original PR, adapted to the newer
SourceMapscache/content-hash implementation now present onmaster.Notes
The old generated rule JSON changes already match current
origin/master. The profile files from the old PR were not replayed because currentmastercontains newer profile entries and regenerating rule data produced no profile diff.Validation
npm installnpm run generate-rule-data:mavennpm run generate-metanpx tsx --tsconfig packages/tsconfig.test.json --test packages/analysis/src/jsts/rules/S2933/unit.test.ts packages/analysis/tests/jsts/linter/index.test.ts packages/analysis/tests/tools/nyc-esm-loader.test.tsnpx tsc -b packagesnpm run bbf