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

template-curly-spacing fix should not remove comments inside the curly braces. #12744

Closed
yeonjuan opened this issue Jan 5, 2020 · 1 comment · Fixed by #12775
Closed

template-curly-spacing fix should not remove comments inside the curly braces. #12744

yeonjuan opened this issue Jan 5, 2020 · 1 comment · Fixed by #12775
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 bug ESLint is working incorrectly needs design Important details about this change need to be discussed rule Relates to ESLint's core rules

Comments

@yeonjuan
Copy link
Member

yeonjuan commented Jan 5, 2020

Tell us about your environment

  • ESLint Version: v6.8.0
  • Node Version: v12.13.0
  • npm Version: v6.12.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
 "parserOptions": { "ecmaVersion": 6 },
  rules: {
   "template-curly-spacing": ["error", "never"]
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

  • .eslintrc.js
module.exports = {
 "parserOptions": { "ecmaVersion": 6 },
  rules: {
   "template-curly-spacing": ["error", "never"]
  }
}
  • test.js
const foo = `  ${  bar  /*comment*/}   `;

Run eslint with --fix option.

eslint --fix test.js

What did you expect to happen?

It should not remove comments(/*comment*/) even it has an error.

What actually happened? Please include the actual, raw output from ESLint.

const foo = `  ${bar}   `;

It removes comments inside the curly braces.{,}. Here is a demo

Are you willing to submit a pull request to fix this bug?

Yes, If it is a bug.

@yeonjuan yeonjuan added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jan 5, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion rule Relates to ESLint's core rules needs design Important details about this change need to be discussed and removed triage An ESLint team member will look at this issue soon labels Jan 5, 2020
@mdjermanovic
Copy link
Member

It's very possible that some other spacing rules have the same bug.

Spacing rules that don't have this bug treat comments as tokens.

That's one option, another is to defer to a new space-around-comment rule (as @mysticatea mentioned in this comment) in these situations.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 17, 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 Jul 17, 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 bug ESLint is working incorrectly needs design Important details about this change need to be discussed rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants