Skip to content

feat(unstable): support comments in lint plugin #29189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 8, 2025
Merged

Conversation

marvinhagemeister
Copy link
Contributor

This PR adds support for comments in the AST for lint plugins.

  • The Program node has a comments field pointing to an array of all comments.
  • SourceCode.getAllComments(): Returns all comments (same as program.comments)
  • SourceCode.getCommentsBefore(node): Get all comments before this Node
  • SourceCode.getCommentsAfter(node): Get all comments after this Node
  • SourceCode.getCommentsInside(node): Get all comments inside this Node

ESLint docs:

@iuioiua
Copy link
Contributor

iuioiua commented May 6, 2025

Closes #29100

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, pretty cool, please remove the TODO

@marvinhagemeister marvinhagemeister merged commit c015b8a into main May 8, 2025
18 checks passed
@marvinhagemeister marvinhagemeister deleted the lint-comments branch May 8, 2025 19:59
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.

3 participants