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

refactor: fix disable directives for languages with 0-based lines #18605

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Jun 18, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Follow-up to #18448 (review). This fixes the behavior of disable directives when language has 0-based lines.

For example, this directive was disabling problem on line 1 instead of its own line 2:

some_problem;
some_problem;  // eslint-disable-line

What changes did you make? (Give an overview)

Since apply-disable-directives works with lint messages that have already been translated into messages with 1-based locations, I updated disable directive objects to be translated to 1-based locations as well, in order to properly match with lint messages.

Is there anything you'd like reviewers to focus on?

This fixes a bug, but I tagged it as "refactor" because language plugins are not an officially available feature yet.

Sorry, something went wrong.

@mdjermanovic mdjermanovic requested a review from a team as a code owner June 18, 2024 19:29
@eslint-github-bot eslint-github-bot bot added the chore This change is not user-facing label Jun 18, 2024
@github-actions github-actions bot added the core Relates to ESLint's core APIs and features label Jun 18, 2024
Copy link

netlify bot commented Jun 18, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 1a77e31
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/6672ebc9d09717000828a1eb

@mdjermanovic mdjermanovic force-pushed the languages-disable-directives branch from f4c1c73 to d98b508 Compare June 19, 2024 09:54
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
Copy link
Member

@nzakas nzakas 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!

@nzakas nzakas merged commit 6421973 into main Jun 20, 2024
19 checks passed
@nzakas nzakas deleted the languages-disable-directives branch June 20, 2024 15:20
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Dec 18, 2024
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing core Relates to ESLint's core APIs and features
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants