fix: align react static property placement with upstream - #2070
Merged
Conversation
fansenze
deleted the
codex/fix-react-static-property-placement-20260905
branch
September 5, 2026 07:39
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.
Summary
Fix
react/static-property-placementcomponent detection to match ESLint. For example,Box.C = {}must take precedence over an earlier React class initializer when checkingBox.C.propTypes. Component lookup now preserves upstream reference order, exact source spelling, nested property paths, repeated declarations, and TypeScript wrapper boundaries.Reuse rslint's reference index, binding model, class-member helpers, and React pragma utility. Refine the existing JSDoc component helper with tsgo's comment scanner and parser so declaration ownership, adjacent comments, exported expressions, object methods, and tag syntax match upstream. Add regressions for the rule and its shared helper's
sort-compconsumer, plus JavaScript/JSX integration and disable-comment coverage.Validation:
eslint-plugin-react7.37.5 with ESLint 9.39.5 and@typescript-eslint/parser8.69.0. All 2,824 differential cases agree, including the upstream release's source cases expanded across placement settings, message IDs, message text, and diagnostic ranges.reactutil,static_property_placement, andsort_comp.@rslint/coreand passed the two affected JS integration suites.pnpm run check-spellandpnpm run format:checkpassed.--new-from-merge-base=origin/main, restricted to the three affected Go packages.Local Go benchmark results (median of five 300 ms runs, 100 components per input, parsing/binding excluded):
Box.C)The external-assignment case includes building an uncached reference index and validating the first matching reference, which the previous declaration-first return skipped. Retain that work for correctness. Cached diagnostics and early placement checks reduce allocations elsewhere; invalid class fields drop from 1,514 to 322 allocations per input. Benchmark and profiling source files are not included.
Related Links
Checklist