Conversation
- Introduce TSESTreeDirective and TSESTreeDirectiveLike types and isDirective helpers; replace StringLiteral[] directives with TSESTreeDirective[] in semantic nodes - Update getFileDirectives/getFunctionDirectives to return directive statements and reference via d.expression.value - Update component collector to read directives from d.expression.value - Align ESLint plugins and utilities to the new directive shapes across codebase
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This pull request refactors how directives are represented and accessed throughout the codebase. The key change is moving from treating directives as StringLiteral[] to treating them as TSESTreeDirective[] (directive expression statements), which aligns better with the ESTree/TSESTree specification where directives are expression statements with a directive property.
Changes:
- Introduced
TSESTreeDirectiveandTSESTreeDirectiveLiketypes to represent directive expression statements - Updated
isDirectiveto check for thedirectiveproperty on expression statements rather than checking if expressions are string literals - Modified
getFileDirectivesandgetFunctionDirectivesto return directive expression statements instead of string literals - Updated semantic node interfaces (
SemanticFunc,FunctionComponentSemanticNode, etc.) to use the new directive type - Updated ESLint plugin rules and component collector to access directive values via
d.expression.value - Updated documentation files to reflect the new directive type
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/utilities/ast/src/types.ts | Adds TSESTreeDirective and TSESTreeDirectiveLike type definitions |
| packages/utilities/ast/src/directive-is.ts | Updates isDirective to check for directive property; adds isDirectiveLike helper |
| packages/utilities/ast/src/function-directive.ts | Updates return type and implementation to return directive statements |
| packages/utilities/ast/src/file-directive.ts | Updates return type and implementation to return directive statements |
| packages/plugins/eslint-plugin-react-x/src/rules/no-unstable-default-props.ts | Updates directive value access from d.value to d.expression.value |
| packages/plugins/eslint-plugin-react-x/src/rules/no-unstable-context-value.ts | Updates directive value access from d.value to d.expression.value |
| packages/plugins/eslint-plugin-react-rsc/src/rules/function-definition.ts | Updates directive value access from d.value to d.expression.value |
| packages/core/src/semantic/semantic-func.ts | Updates directives type from StringLiteral[] to TSESTreeDirective[] |
| packages/core/src/component/component-semantic-node.ts | Updates directives type from StringLiteral[] to TSESTreeDirective[] |
| packages/core/src/component/component-collector.ts | Updates directive value access from d.value to d.expression.value |
| packages/core/docs/interfaces/*.md | Updates documentation to reflect new directive type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/plugins/eslint-plugin-react-x/src/rules/no-unstable-context-value.ts
Outdated
Show resolved
Hide resolved
packages/plugins/eslint-plugin-react-rsc/src/rules/function-definition.ts
Outdated
Show resolved
Hide resolved
packages/plugins/eslint-plugin-react-rsc/src/rules/function-definition.ts
Outdated
Show resolved
Hide resolved
packages/plugins/eslint-plugin-react-x/src/rules/no-unstable-context-value.ts
Outdated
Show resolved
Hide resolved
packages/plugins/eslint-plugin-react-x/src/rules/no-unstable-default-props.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: REL1CX <solarflamex@hotmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___)Other information