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 template-curly-spacing #12813

Merged
merged 1 commit into from Mar 28, 2020

Conversation

mdjermanovic
Copy link
Member

Prerequisites checklist

  • I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

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

[X] Other, please explain:

Changes template-curly-spacing report locations.

What changes did you make? (Give an overview)

  • For missing spaces the rule will now report the full location of ${ or }
  • For disallowed spaces the rule will now report the location of spaces (the range that should be removed).

"always" before this change:

image

"always" after this change:

image

"never" before this change:

image

"never" after this change:

image

Also:

  • Refactoring - locations are now also different depending on the option, so the code became difficult to follow with two branches in every line.
  • Replaced regexes with .startsWith() and .endsWith().
  • Replaced call to deprecated isSpaceBetweenTokens with isSpaceBetween

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

  • Refactoring.
  • Checks whether prevToken/nextToken exists or not are removed. I believe they were not necessary (in the previous version as well) when the template token starts/ends with }/${.

Marked as an enhancement, as suggested in a similar PR (I agree), but I guess it can be accepted as a bug fix.

@mdjermanovic mdjermanovic added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jan 20, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion enhancement This change enhances an existing feature of ESLint and removed 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 labels Mar 17, 2020
@mdjermanovic
Copy link
Member Author

Marked as accepted since it refs #12334

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!

@kaicataldo kaicataldo merged commit 362713c into master Mar 28, 2020
@kaicataldo kaicataldo deleted the templatecurlyspacing-loc branch March 28, 2020 00:19
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Sep 25, 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 Sep 25, 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

2 participants