refactor(jsx): consolidate helpers into attribute, children, element,… - #1914
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Rel1cx
force-pushed
the
refactor/jsx-consolidate-helpers
branch
from
July 17, 2026 13:37
c953efc to
4ed3809
Compare
Rel1cx
marked this pull request as ready for review
July 17, 2026 14:49
… and text modules
Rel1cx
force-pushed
the
refactor/jsx-consolidate-helpers
branch
from
July 17, 2026 14:54
4ed3809 to
642ed06
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the @eslint-react/jsx package by consolidating previously separate helper modules into grouped modules (attribute-*, children, element-*, text) and updates downstream eslint-plugin-react-dom rules to use the new APIs. It also adds/updates tests and generated docs to reflect the new organization.
Changes:
- Consolidated JSX helpers into new grouped modules (attribute/children/element/text) and updated the package barrel exports.
- Updated React DOM rules to use the new
resolveAttributeValue(..., name)andisPaddingWhitespaceAPIs. - Added/updated unit tests and documentation for the new module structure and behavior.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/eslint-plugin-react-dom/src/rules/no-unsafe-iframe-sandbox/no-unsafe-iframe-sandbox.ts | Uses resolveAttributeValue(..., "sandbox") to statically extract spread sandbox values. |
| plugins/eslint-plugin-react-dom/src/rules/no-missing-iframe-sandbox/no-missing-iframe-sandbox.ts | Simplifies spread handling by relying on toStatic() with the provided property name. |
| plugins/eslint-plugin-react-dom/src/rules/no-dangerously-set-innerhtml-with-children/no-dangerously-set-innerhtml-with-children.ts | Switches whitespace filtering to isPaddingWhitespace. |
| packages/jsx/src/text.ts | New consolidated text/whitespace utilities (collapse + whitespace classifiers). |
| packages/jsx/src/text.test.ts | Tests for text.ts utilities. |
| packages/jsx/src/resolve-attribute-value.ts | Removed; functionality moved into attribute-value.ts. |
| packages/jsx/src/is-whitespace.ts | Removed; replaced by text.ts (isPaddingWhitespace, isWhitespaceText, etc.). |
| packages/jsx/src/is-host-element.ts | Removed; moved into element-is.ts. |
| packages/jsx/src/is-fragment-element.ts | Removed; moved into element-is.ts. |
| packages/jsx/src/is-element.ts | Removed; moved into element-is.ts. |
| packages/jsx/src/index.ts | Replaces broad export * with curated exports from consolidated modules. |
| packages/jsx/src/has-every-attribute.ts | Removed; moved into attribute-has.ts. |
| packages/jsx/src/has-attribute.ts | Removed; moved into attribute-has.ts. |
| packages/jsx/src/has-any-attribute.ts | Removed; moved into attribute-has.ts. |
| packages/jsx/src/get-children.ts | Removed; logic moved into children.ts. |
| packages/jsx/src/get-attribute-value.ts | Removed; moved into attribute-value.ts. |
| packages/jsx/src/get-attribute-static-value.ts | Removed; moved into attribute-value.ts. |
| packages/jsx/src/get-attribute-name.ts | Removed; moved into attribute-name.ts. |
| packages/jsx/src/find-parent-attribute.ts | Removed; moved into attribute-find.ts. |
| packages/jsx/src/find-attribute.ts | Removed; moved into attribute-find.ts. |
| packages/jsx/src/find-attribute.test.ts | Removed; replaced by attribute-find.test.ts. |
| packages/jsx/src/element.test.ts | New tests for element-is.ts and element-type.ts. |
| packages/jsx/src/element-type.ts | Doc update to include namespaced element types (e.g. xml:space). |
| packages/jsx/src/element-is.ts | New consolidated element predicates (isElement, isFragmentElement, isHostElement). |
| packages/jsx/src/collapse-multiline-text.ts | Removed; moved into text.ts. |
| packages/jsx/src/children.ts | Refactors children helpers to use new text.ts utilities. |
| packages/jsx/src/children.test.ts | New tests for children.ts. |
| packages/jsx/src/attribute-value.ts | New consolidated attribute value resolution + static extraction helpers. |
| packages/jsx/src/attribute-value.test.ts | New tests for attribute-value.ts. |
| packages/jsx/src/attribute-name.ts | Adds getAttributeName alongside isAttribute. |
| packages/jsx/src/attribute-has.ts | New consolidated attribute existence helpers (hasAttribute, hasAnyAttribute, hasEveryAttribute). |
| packages/jsx/src/attribute-find.ts | New consolidated find helpers (findAttribute, findParentAttribute, findSpreadProperty). |
| packages/jsx/src/attribute-find.test.ts | New tests for attribute find/spread resolution. |
| packages/jsx/docs/README.md | Updates API docs index for new/renamed functions. |
| packages/jsx/docs/functions/resolveAttributeValue.md | Documents the new optional name parameter and spread behavior. |
| packages/jsx/docs/functions/isWhitespaceText.md | Updates references to isPaddingWhitespace. |
| packages/jsx/docs/functions/isPaddingWhitespace.md | Renames/re-documents the former isWhitespace behavior. |
| packages/jsx/docs/functions/getElementFullType.md | Docs update to include namespaced element types. |
| packages/jsx/docs/functions/getChildren.md | Docs update reflecting empty-string-expression filtering. |
| packages/jsx/docs/functions/getAttributeValue.md | Updates return type semantics (undefined vs null). |
| packages/jsx/docs/functions/getAttributeStaticValue.md | Updates absent/indeterminate return semantics. |
| packages/jsx/docs/functions/findSpreadProperty.md | New docs for spread-property resolution helper. |
| packages/jsx/docs/functions/findParentAttribute.md | Updates return type semantics (undefined vs null). |
| packages/jsx/docs/functions/findAttribute.md | Adds reference to findSpreadProperty behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…preadProperty - follow alias chains (const b = a) when resolving spread identifiers, mirroring getStaticValue's identifier tracking - match statically evaluable computed keys in spread objects instead of skipping all computed keys - bump packageManager to pnpm@11.13.1 (11.13.0 is a broken release)
…rule specs - no-dangerously-set-innerhtml: move computed string literal spread case from valid to invalid; add alias chain and string literal key cases - no-(missing|unsafe)-iframe-sandbox, no-dangerously-set-innerhtml-with-children: add alias chain, static computed key, and string literal key cases - add [Unreleased] changelog entries for the four affected rules
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.
… and text modules
Update "[ ]" to "[x]" to check a box
What kind of change does this PR introduce?
Check at least one. If you are introducing a new binding, you must reference an issue where this binding has been proposed, discussed and approved by the maintainers.
Does this PR introduce a breaking change?
If yes, please describe the impact and migration path for existing applications in an attached issue.
Checklist
fix: remove a typo, closes #___, #___)Other information