question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

template-curly-spacing does not always work with babel-eslint

See original GitHub issue

Tell 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:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vitorbalcommented, Jan 4, 2017

@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 the babel-eslint repo.

0reactions
eventualbuddhacommented, Jan 4, 2017

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found