Skip to content
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

feat: Add disable comment support #281

Merged
merged 7 commits into from
Oct 3, 2024
Merged

feat: Add disable comment support #281

merged 7 commits into from
Oct 3, 2024

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Sep 13, 2024

This PR adds support for disable comments to the Markdown plugin. It supports all of the variations that ESLint supports:

  • eslint-disable/eslint-enable
  • eslint-disable-line
  • eslint-disable-next-line

While working on this, I discovered a bug in no-html where it was only reporting the first HTML tag in an html node even though there can be multiple. It was also skipping any html node that began with a comment. I also fixed these bugs in this PR, as I needed a good example to test the disable directives.

Note: This PR intentionally does not implement inline configuration comments like /* eslint rule:error */.

@nzakas
Copy link
Member Author

nzakas commented Sep 24, 2024

Ping @eslint/eslint-team

@mdjermanovic
Copy link
Member

Note: This PR intentionally does not implement inline configuration comments like /* eslint rule:error */

We don't want to implement this or we'll implement it in another PR?

@nzakas
Copy link
Member Author

nzakas commented Sep 25, 2024

We can implement it in a separate PR. Just wanted to keep this PR focused on the disable directives.

README.md Outdated Show resolved Hide resolved
end.column =
commentLineCount === 0
? start.column + comment.length
: comment.length - comment.lastIndexOf("\n") - 1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
: comment.length - comment.lastIndexOf("\n") - 1;
: comment.length - comment.lastIndexOf("\n");

As the columns are 1-based in this language.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Leaving open for @aladdin-add to verify.

@nzakas
Copy link
Member Author

nzakas commented Oct 2, 2024

Ping @aladdin-add

Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

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

LGTM!👍

@aladdin-add aladdin-add merged commit acdbd08 into main Oct 3, 2024
13 checks passed
@aladdin-add aladdin-add deleted the comment-parser branch October 3, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

3 participants