Skip to content

Fix directives checks#1461

Merged
Rel1cx merged 3 commits intomainfrom
directives
Feb 2, 2026
Merged

Fix directives checks#1461
Rel1cx merged 3 commits intomainfrom
directives

Conversation

@Rel1cx
Copy link
Owner

@Rel1cx Rel1cx commented Feb 2, 2026

  • 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

What kind of change does this PR introduce?

  • 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?

  • 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

- 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
@Rel1cx Rel1cx requested a review from Copilot February 2, 2026 13:00
@vercel
Copy link

vercel bot commented Feb 2, 2026

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

Project Deployment Actions Updated (UTC)
eslint-react Ready Ready Preview, Comment Feb 2, 2026 1:24pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 TSESTreeDirective and TSESTreeDirectiveLike types to represent directive expression statements
  • Updated isDirective to check for the directive property on expression statements rather than checking if expressions are string literals
  • Modified getFileDirectives and getFunctionDirectives to 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.

@Rel1cx Rel1cx marked this pull request as draft February 2, 2026 13:09
Signed-off-by: REL1CX <solarflamex@hotmail.com>
@Rel1cx Rel1cx merged commit dfb2567 into main Feb 2, 2026
10 of 11 checks passed
@Rel1cx Rel1cx deleted the directives branch February 2, 2026 13:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

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.

1 participant