Skip to content

refactor(jsx): consolidate helpers into attribute, children, element,… - #1914

Merged
Rel1cx merged 3 commits into
mainfrom
refactor/jsx-consolidate-helpers
Jul 18, 2026
Merged

refactor(jsx): consolidate helpers into attribute, children, element,…#1914
Rel1cx merged 3 commits into
mainfrom
refactor/jsx-consolidate-helpers

Conversation

@Rel1cx

@Rel1cx Rel1cx commented Jul 17, 2026

Copy link
Copy Markdown
Owner

… 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.

  • Bugfix
  • Feature
  • Perf
  • Docs
  • Test
  • Chore
  • Enhancement
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

If yes, please describe the impact and migration path for existing applications in an attached issue.

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • I have added a convincing reason for adding this feature, if necessary

Other information

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eslint-react Ready Ready Preview, Comment Jul 18, 2026 3:19pm

@Rel1cx
Rel1cx force-pushed the refactor/jsx-consolidate-helpers branch from c953efc to 4ed3809 Compare July 17, 2026 13:37
@Rel1cx
Rel1cx marked this pull request as ready for review July 17, 2026 14:49
@Rel1cx
Rel1cx force-pushed the refactor/jsx-consolidate-helpers branch from 4ed3809 to 642ed06 Compare July 17, 2026 14:54
@Rel1cx
Rel1cx requested a review from Copilot July 18, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and isPaddingWhitespace APIs.
  • 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.

Comment thread packages/jsx/src/index.ts
Comment thread packages/jsx/src/attribute-value.ts
Comment thread packages/jsx/src/attribute-find.ts
…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
@Rel1cx
Rel1cx merged commit e1667a6 into main Jul 18, 2026
12 checks passed
@Rel1cx
Rel1cx deleted the refactor/jsx-consolidate-helpers branch July 18, 2026 17:03
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.

2 participants