feat: port rule @stylistic/jsx-indent-props#1028
Merged
Merged
Conversation
The @Stylistic rule is byte-identical to react/jsx-indent-props, so the implementation is shared via BuildRule; only the registered name differs. Also aligns a ternary-bump edge case in the shared implementation: when the first prop sits on the opening tag's ?/: line, upstream's getNodeIndent gives useOperator priority over useBracket, so the bump carries to the new-line props. Verified by differential against @Stylistic 5.10.0 on rsbuild/rspack.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the jsx-indent-props rule to support both the react and @stylistic variants using a shared BuildRule implementation. It also refines the ternary operator indentation logic to match upstream ESLint precedence and adds comprehensive test suites. The review comments identify potential nil pointer dereference vulnerabilities when handling AST properties in 'first' mode and during property iteration, offering robust code suggestions to ensure safety.
Deploying rslint with
|
| Latest commit: |
a65ecdc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c42dcff2.rslint.pages.dev |
| Branch Preview URL: | https://feat-port-rule-jsx-indent-pr.rslint.pages.dev |
c36ec01 to
a65ecdc
Compare
eryue0220
added a commit
to eryue0220/rslint
that referenced
this pull request
May 27, 2026
… into feat/no-duplicate-hooks * 'feat/no-duplicate-hooks' of github.com:eryue0220/rslint: test(eslint-plugin-runner): skip worker-pool e2e suites on windows (napi terminate aborts) (web-infra-dev#1031) feat: port rule react/checked-requires-onchange-or-readonly (web-infra-dev#1030) chore(deps): update actions/checkout action to v6 (web-infra-dev#1007) chore(deps): update actions/setup-go action to v6 (web-infra-dev#1009) chore(deps): update actions/setup-node action to v6 (web-infra-dev#1010) feat: port rule @stylistic/jsx-indent-props (web-infra-dev#1028) feat(eslint-plugin-runner): new package for ESLint plugin compatibility runtime (web-infra-dev#991) feat: port rule @stylistic/jsx-function-call-newline (web-infra-dev#1027) feat(eslint-plugin-jest): add `prefer-called-with` rule (web-infra-dev#1025) feat: port rule @stylistic/jsx-first-prop-new-line (web-infra-dev#1024) feat: port rule @stylistic/jsx-curly-spacing (web-infra-dev#1023)
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
Port the
@stylistic/jsx-indent-propsrule to rslint. It enforces a consistent indentation style for the props of a JSX element — N spaces, a tab, or alignment with the first prop's column ("first"), with an optionalignoreTernaryOperator.The
@stylisticrule is byte-identical toreact/jsx-indent-props, so the implementation is shared viaBuildRule; only the registered name differs. This change also aligns a ternary-bump edge case in the shared implementation: when the first prop sits on the opening tag's?/:line, upstream'sgetNodeIndentgivesuseOperatorpriority overuseBracket, so the indent bump carries to the new-line props. Verified by a differential against@stylistic/eslint-plugin@5.10.0, including real-code runs over rsbuild/rspack (93 diagnostics, 0 divergence).Related Links
Checklist