fix(lint): deduplicate CSS transform text in gsap_css_transform_conflict finding - #3284
Open
santhiprakash wants to merge 1 commit into
Open
fix(lint): deduplicate CSS transform text in gsap_css_transform_conflict finding#3284santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
…ict message - Problem: when a single CSS transform declaration contains both translate and scale (e.g. transform: scale(1.08) translate3d(...)), both cssTranslateSelectors and cssScaleSelectors store the same transformVal for the same selector. The finding message and fixHint then concatenate the identical string, producing doubled text. - Fix: deduplicate the [cssFromTranslate, cssFromScale] parts via new Set() before joining. This is a no-op when the values differ (separate translate-only and scale-only declarations) and corrects the doubling when they are identical. - Verification: bun test packages/lint/src/rules/gsap.test.ts — 162 tests pass including a new regression test that asserts the message and fixHint do not contain doubled transform text.
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.
Problem
In the
gsap_css_transform_conflictlint rule, when a single CSStransformdeclaration contains both translate and scale functions(e.g.
transform: scale(1.08) translate3d(1.5%, 0, 0)), the rulestores the same
transformValin bothcssTranslateSelectorsandcssScaleSelectorsfor the same selector. The findingmessageandfixHintthen concatenate the identical string via[cssFromTranslate, cssFromScale].filter(Boolean).join(" "), producingdoubled text like:
instead of the correct:
Root cause:
gsap.tsline ~1356 — the join has no deduplication,so when both maps resolve to the same value for the same selector, it
appears twice.
Triage / Root cause
packages/lint/src/rules/gsap.ts—gsap_css_transform_conflictrulehandler. The two regex tests (
/translate/iand/scale/i) both matchthe same combined declaration, so both
cssTranslateSelectorsandcssScaleSelectorsstore the identicaltransformVal. The downstream.filter(Boolean).join(" ")then doubles it.Fix
[cssFromTranslate, cssFromScale]vianew Set()beforejoining into
cssTransform.translate-only and scale-only CSS declarations for the same selector)
and corrects the doubling when they are identical.
conflicts with multiple GSAP properties" test case that asserts the
message and fixHint do not contain the doubled transform text.
Verification
162 tests pass (0 fail). The new assertion confirms no doubling:
Notes / Risks
conflict detection logic itself.
and scale-only CSS rules are separate (the
new Set()is a no-opwhen parts contain different values).
Closes #3263