Skip to content

Fix spread style attributes in GCI26 and GCI29 rules - #101

Merged
utarwyn merged 1 commit into
mainfrom
issue-100-fix-spread-props
Mar 7, 2026
Merged

utarwyn merged 1 commit into
mainfrom
issue-100-fix-spread-props

Conversation

@utarwyn

@utarwyn utarwyn commented Mar 7, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes #100

When a JSX element contains spread elements inside a style attribute (e.g. style={{ ...someProps.style, color: 'red' }}), the rules would crash with:

TypeError: Cannot read properties of undefined (reading 'name')

This happened because spread elements (SpreadElement nodes) have no key property, so accessing prop.key.name threw when iterating over properties.

Changes

  • Rule prefer-shorthand-css-notations (GCI26)
  • Rule avoid-css-animations (GCI29)

Testing

All 152 tests pass:

152 passing (129ms)

@utarwyn utarwyn changed the title fix: handle spread style attributes in JSX rules (#100) Fix spread style attributes in JSX rules (#100) Mar 7, 2026
@utarwyn utarwyn changed the title Fix spread style attributes in JSX rules (#100) Fix spread style attributes in JSX rules Mar 7, 2026
@utarwyn utarwyn self-assigned this Mar 7, 2026
@utarwyn utarwyn changed the title Fix spread style attributes in JSX rules Fix spread style attributes in GCI26 and GCI29 rules Mar 7, 2026
@utarwyn
utarwyn force-pushed the issue-100-fix-spread-props branch from 1ddfcd6 to 566297a Compare March 7, 2026 11:05
@sonarqubecloud

sonarqubecloud Bot commented Mar 7, 2026

Copy link
Copy Markdown

@utarwyn
utarwyn merged commit c237f1d into main Mar 7, 2026
8 checks passed
@utarwyn
utarwyn deleted the issue-100-fix-spread-props branch March 7, 2026 11:07
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.

GCI26 - error "TypeError: Cannot read properties of undefined"

1 participant