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
computed-property-spacing errors with parens #12198
computed-property-spacing errors with parens #12198
Comments
Thank you for your report.
We have a utility function to check spaces: sourceCode.isSpaceBetweenTokens(). It intends to ignore comments on between the tokens. |
Meant to ask, should this rule see comments as equal with other tokens regarding the spacing logic. For example, should this be valid: /*eslint computed-property-spacing: ["error", "never"]*/
foo = {
[/**/ a /**/]: 1
} It's currently an error, because there are spaces between the brackets and the Some other spacing rules see comments as equal: /*eslint space-in-parens: ["error", "never"]*/
foo = (/**/ a /**/) // no error /*eslint object-curly-spacing: ["error", "never"]*/
foo = {/**/ a /**/} // no error While some don't: /*eslint array-bracket-spacing: ["error", "never"]*/
foo = [/**/ a /**/] // error, autofix will delete comments |
Sounds good to me. So maybe the |
It could be useful, the logic can be modified to pick the first token (including comments) after Though, it would be good to see what should be done with #11902 first. |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Demo link
What did you expect to happen?
No errors.
What actually happened? Please include the actual, raw output from ESLint.
Fixed to:
Are you willing to submit a pull request to fix this bug?
Yes.
It would be also good to clarify how should the rule handle comments.
The text was updated successfully, but these errors were encountered: