Skip to content

Fix SCREAMING_SNAKE_CASE constant exported via export { Name } incorrectly treated as React component - #114

Open
rakleed wants to merge 2 commits into
ArnaudBarre:mainfrom
rakleed:fix/screaming-snake-case-export-specifier
Open

Fix SCREAMING_SNAKE_CASE constant exported via export { Name } incorrectly treated as React component#114
rakleed wants to merge 2 commits into
ArnaudBarre:mainfrom
rakleed:fix/screaming-snake-case-export-specifier

Conversation

@rakleed

@rakleed rakleed commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #113

Follow-up to #110, same code path: export { Name } specifiers referring to a local const/let variable were only checked by name (reactComponentNameRE), never by their actual initializer, unlike inline export const X = .... Since the name regex allows underscores, SCREAMING_SNAKE_CASE constants (ENTITY_TYPE, COLUMN_TEMPLATE, ...) were misidentified as components when re-exported via a specifier list, causing false positives whenever the same file also exports something correctly classified as non-component (e.g. a plain class, per #110).

This mirrors the ClassName scope-resolution added in #110: for a specifier referring to a local variable declarator, resolve its initializer from scope and run it through the normal handleExportIdentifier(identifier, init) path instead of the name-only fallback.

Added regression tests for both the false positive (valid case) and to confirm real component/non-component mixes via export { } are still caught (invalid case).

@rakleed rakleed changed the title Fix SCREAMING_SNAKE_CASE constant exported via export { Name } incorrectly treated as React component Fix SCREAMING_SNAKE_CASE constant exported via export { Name } incorrectly treated as React component Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant