Conversation
- fix(node-equality): handle JSXNamespacedName in JSXAttribute comparison - fix(function-init-path): support ClassExpression in addition to ClassDeclaration - docs: add clarifying comments for various utility functions - test: add test cases to rule specs for the fixed issues
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
b9ddcd0 to
7a0dde7
Compare
7a0dde7 to
bf439e3
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the AST utilities and React-X rule test suite to address review feedback, including clarifying documentation, extending AST pattern support, and refreshing dependencies/lockfile entries.
Changes:
- Bump
tsldependency across workspaces and updatepnpm-lock.yamlaccordingly. - Refine AST utilities (docs/notes, traversal behavior, init-path patterns, and node equality logic).
- Add/extend rule tests to cover class expressions and JSX namespaced attribute scenarios.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates lockfile for the tsl bump and resulting dependency graph changes |
| package.json | Bumps root tsl version |
| apps/website/package.json | Bumps website workspace tsl version |
| .pkgs/configs/package.json | Bumps configs workspace tsl version |
| packages/utilities/ast/src/function-init-path.ts | Extends function init-path typing/logic to include ClassExpression patterns |
| packages/utilities/ast/src/node-equality.ts | Adjusts JSXAttribute name equality comparison |
| packages/utilities/ast/src/node-traverse.ts | Changes findParent to stop at Program (excludes Program from matches) |
| packages/utilities/ast/src/property-traverse.ts | Clarifies spread handling limitations in docs/comments |
| packages/utilities/ast/src/node-types.ts | Adds documentation clarifying JSX type vs runtime guard differences |
| packages/utilities/ast/src/node-is.ts | Adds documentation note about isJSX coverage |
| packages/utilities/ast/src/identifier-name.ts | Clarifies ASCII-only identifier heuristic in docs |
| packages/utilities/ast/src/file-directive.ts | Updates docstring to match file-directive-only behavior |
| packages/utilities/ast/src/expression-nested.ts | Adds clarifying comment about boundary behavior |
| packages/utilities/ast/src/directive-name.ts | Clarifies heuristic nature of directive-name check |
| packages/core/src/component/component-flag.ts | Reorders flag constants (no functional change) |
| packages/plugins/eslint-plugin-react-x/src/rules/no-unused-class-component-members/no-unused-class-component-members.spec.ts | Adds coverage for class-expression class components |
| packages/plugins/eslint-plugin-react-x/src/rules/no-nested-component-definitions/no-nested-component-definitions.spec.ts | Adds coverage for nested class-expression components |
| packages/plugins/eslint-plugin-react-x/src/rules/no-duplicate-key/no-duplicate-key.spec.ts | Adds valid SVG namespaced-attribute case |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/utilities/ast/src/node-equality.ts:70
isNodeEqualnow comparesJSXAttribute.nameviaisNodeEqual(a.name, b.name), but this helper currently has no cases for JSX name node types (e.g.JSXIdentifier,JSXNamespacedName,JSXMemberExpression). As a result, JSX attribute name comparisons will always return false unless the nodes are the same reference, which breaks structural equality forJSXAttributenodes. Add explicit handling for JSX name node types (and, if needed,JSXNamespacedNamenamespace+name) or revert to a correct name comparison implementation.
case a.type === AST.JSXAttribute
&& b.type === AST.JSXAttribute: {
if (!isNodeEqual(a.name, b.name)) {
return false;
}
if (a.value == null || b.value == null) {
return a.value === b.value;
}
return isNodeEqual(a.value, b.value);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rel1cx
added a commit
that referenced
this pull request
Mar 31, 2026
Cover the following changes introduced in PR #1660: - find-import-source: circular reference guard with visited Set - is-react-api: correct suffix matching with endsWith - component-detection-legacy: isRenderMethodLike covers ClassExpression, isClassComponent with optional context, isThisSetState -> isThisSetStateCall - hook-is: isHook -> isHookDefinition rename, isHookCallWithName un-exported Cover the following changes introduced in PR #1662: - function-init-path: support ClassExpression in addition to ClassDeclaration - node-equality: handle JSXNamespacedName in JSXAttribute comparison New test files: - packages/core/src/api/find-import-source.test.ts (6 tests) - packages/core/src/api/is-react-api.test.ts (32 tests) - packages/core/src/component/component-detection-legacy.test.ts (13 tests) - packages/core/src/hook/hook-is.test.ts (20 tests) - packages/utilities/ast/src/function-init-path.test.ts (6 tests) - packages/utilities/ast/src/node-equality.test.ts (16 tests)
Rel1cx
added a commit
that referenced
this pull request
Mar 31, 2026
…n cases to isNodeEqual PR #1662 changed JSXAttribute name comparison from direct string comparison to recursive isNodeEqual(a.name, b.name), but did not add handling for JSX name node types. This caused JSXAttribute structural equality to always return false for non-reference-equal nodes, as JSXIdentifier / JSXNamespacedName / JSXMemberExpression all fell through to the default case.
Rel1cx
added a commit
that referenced
this pull request
Mar 31, 2026
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.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___)Other information