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 rule exception

See original GitHub issue

Tell us about your environment

Node version: v14.4.0 npm version: v6.14.4 Local ESLint version: v7.13.0 (Currently used)

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using?

@babel/eslint-parser

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

Not exactly production ready code, but while testing something out I stumbled across a line of JS that breaks the template-curly-spacing rule:

const nonParameterArgs = this.context.module.controllerConstructor.args.filter(a => !this[`${a}Target`]?.selectedOptions[0]?.hasAttribute('data-parameter-id')).map(a => this[`${a}Argument`]);

What did you expect to happen? Not raise an exception

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

Offending line: https://github.com/eslint/eslint/blob/master/lib/rules/template-curly-spacing.js#L52

TypeError: Cannot read property 'value' of null
Occurred while linting /myrepo/app/javascript/controllers/plots/plot_controller.js:51
    at checkSpacingBefore (/myrepo/node_modules/eslint/lib/rules/template-curly-spacing.js:52:24)
    at TemplateElement (/myrepo/node_modules/eslint/lib/rules/template-curly-spacing.js:136:17)
    at /myrepo/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/myrepo/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/myrepo/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/myrepo/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/myrepo/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/myrepo/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /myrepo/node_modules/eslint/lib/linter/linter.js:952:32
error Command failed with exit code 2.

Are you willing to submit a pull request to fix this bug? Not right now, sorry

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
ImreBoersmacommented, Nov 30, 2020

Got a fix for this. Run the following npm commands to update the eslint packages manually(I think):

npm install --save-dev @babel/types@7.2.0 @babel/traverse@7.1.6 npm dedupe npm uninstall --save-dev @babel/types @babel/traverse

I don’t really know how it works, but it worked for me.

1reaction
nelillycommented, Dec 23, 2020

Got a fix for this. Run the following npm commands to update the eslint packages manually(I think):

npm install --save-dev @babel/types@7.2.0 @babel/traverse@7.1.6 npm dedupe npm uninstall --save-dev @babel/types @babel/traverse

I don’t really know how it works, but it worked for me.

This worked for me as well.

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 >
vue/template-curly-spacing
Require or disallow spacing around embedded expressions of template strings in ` `
Read more >
eslint error cannot read property 'range' of null - Stack Overflow
eslintrc.js file and it resolved for me. rules : { "template-curly-spacing" : "off", indent : "off" }.
Read more >
Google C++ Style Guide
General Naming Rules; File Names; Type Names; Variable Names; Constant Names; Function Names; Namespace Names; Enumerator Names; Macro Names; Exceptions to ...
Read more >
eslintrc.json - Google Git
"rules": {. // Possible Errors. "no-await-in-loop": "error",. "no-extra-parens": "error",. "no-prototype-builtins": "error",. "no-template-curly-in-string": ...
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