template-curly-spacing does not always work with babel-eslint
See original GitHub issueTell us about your environment
macOS Sierra, iTerm 2.0
- ESLint Version: 3.12.2
- Node Version: 5.1.0
- npm Version: 3.3.12
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
{
"parser": "babel-eslint"
"rules": {
"template-curly-spacing": ["error", "never"]
}
}
What did you do? Please include the actual source code causing the issue.
See demo repo here.
`a${(function() { return `b${ 0 }c`; })}d`;
What did you expect to happen?
I expect two errors, one on both sides of the 0
inside the nested template literal.
What actually happened? Please include the actual, raw output from ESLint.
I got one error:
/Users/donovan/Desktop/eslint-babel-template-curly-issue/index.js
1:33 error Unexpected space(s) before '}' template-curly-spacing
✖ 1 problem (1 error, 0 warnings)
eslint it not reporting the space after ${
as a problem. This is due to the difference in tokens between espree and babylon. It may actually be a bug in babylon, but I’m not sure. See the demo repo for further analysis.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
template-curly-spacing - ESLint - Pluggable JavaScript Linter
"never" (by default) - Disallows spaces inside of the curly brace pair. "always" - Requires one or more spaces inside of the curly...
Read more >eslintrc.json - Google Git
Possible Errors. "no-await-in-loop": "error",. "no-extra-parens": "error",. "no-prototype-builtins": "error",. "no-template-curly-in-string": "error",.
Read more >Airbnb JavaScript Style Guide()
3.1 Use the literal syntax for object creation. eslint: no-new-object ... strings instead of concatenation. eslint: prefer-template template-curly-spacing ...
Read more >ESLint: Cannot read property 'value' of null Occurred while ...
If that doesn't help, can you please fill out the bug report template? my babel-eslint version is 10.1.0 . I have update the...
Read more >There should be no space after '{' (babel/object-curly-spacing)
In your VS Code settings, change javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces to false so it won't add those ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eventualbuddha looks like that issue was an exception, as can be seen in the discussion here: https://github.com/eslint/eslint/issues/6266#issuecomment-222560132 As a rule of thumb, if the buggy behavior happens with
babel-eslint
but not with the default parser, then you should report an issue in thebabel-eslint
repo.One final note, I saw that https://github.com/eslint/eslint/pull/6290 was created to fix an issue with babel-eslint so I decided that it might be worth opening here. Is there guidance somewhere on which repo to open an issue in?