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

Update: improve report location for space-infix-ops #12324

Merged
merged 1 commit into from Nov 1, 2019
Merged

Update: improve report location for space-infix-ops #12324

merged 1 commit into from Nov 1, 2019

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Sep 27, 2019

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

[x] Changes an existing rule

What changes did you make? (Give an overview)

Make space-infix-ops report end location.

const a = p&&q
//         ~   before
//         ~~  after

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

No

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Sep 27, 2019
@golopot
Copy link
Contributor Author

golopot commented Sep 27, 2019

One thing confuses me. In the docs (https://eslint.org/docs/developer-guide/working-with-rules#working-with-rules) the location column is said to be 0-based, but in test cases the location column is 1-based. What's wrong?

@g-plane g-plane added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Sep 27, 2019
Copy link
Member

@g-plane g-plane 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!

@kaicataldo
Copy link
Member

@golopot I had to look this over myself, but it looks like when it's reported in the rule it's expected to be 0-based, but the error in the results is 1-based (see here). Maybe someone on the team who has more context can speak to why this works that way.

Copy link
Member

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

@golopot
Copy link
Contributor Author

golopot commented Sep 28, 2019

I guess one reason context.reports expects 0-based column is that it allows passing a token location with context.report({loc: someToken.loc}), and that token columns are 0-based.

And one reason that problems.column is 1-based is that it is a more human friendly format, for example most editors display 1-based columns.

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!

Two more 👍 to accept this.

@kaicataldo
Copy link
Member

Given that we have a champion and three approvals from the team, I'm marking this as accepted.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 1, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants