This repository was archived by the owner on Aug 18, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 207
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
TypeError: Cannot read property 'range' of null from template-curly-spacing #530
Copy link
Copy link
Closed
Labels
Description
With this .eslintrc config:
{
"root": true,
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"semistandard"
],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"mocha": true,
"node": true
},
"plugins": [
"babel"
],
"rules": {
"arrow-parens": 0,
"no-class-assign": 0,
"space-before-function-paren": [2, "never"]
}
}And these dependencies:
"dependencies": {
"babel-runtime": "6.26.0",
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "8.0.1",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-latest": "6.24.1",
"babel-preset-stage-0": "6.24.1",
"chai": "4.1.2",
"dotenv": "4.0.0",
"eslint": "4.9.0",
"eslint-config-semistandard": "11.0.0",
"eslint-config-standard": "10.2.1",
"eslint-plugin-babel": "4.1.2",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-node": "5.2.0",
"eslint-plugin-promise": "3.6.0",
"eslint-plugin-standard": "3.0.1",
"mocha": "4.0.1"
}this code snippet:
export default class SomeClass {
someMethod(params) {
const test = 'test';
return `${test}`; // Seems to have to do with this template. Returning `test` directly is fine.
}
}results in this error when running eslint:
Cannot read property 'range' of null
TypeError: Cannot read property 'range' of null
at SourceCode.getTokenBefore (/Users/jason/my-project/node_modules/eslint/lib/token-store/index.js:303:17)
at checkSpacingBefore (/Users/jason/my-project/node_modules/eslint/lib/rules/template-curly-spacing.js:51:42)
at TemplateElement (/Users/jason/my-project/node_modules/eslint/lib/rules/template-curly-spacing.js:116:17)
at listeners.(anonymous function).forEach.listener (/Users/jason/my-project/node_modules/eslint/lib/util/safe-emitter.js:47:58)
at Array.forEach (native)
at Object.emit (/Users/jason/my-project/node_modules/eslint/lib/util/safe-emitter.js:47:38)
at NodeEventGenerator.applySelector (/Users/jason/my-project/node_modules/eslint/lib/util/node-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (/Users/jason/my-project/node_modules/eslint/lib/util/node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (/Users/jason/my-project/node_modules/eslint/lib/util/node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (/Users/jason/my-project/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:606:23)
If I remove "parser": "babel-eslint" the problem goes away, so I think it has to do with babel-eslint. The error also goes away if I pin babel-eslint to 7.2.3.
Happy to provide any other information if necessary!
denshikov-vovan, tguillemot, afc163, fabdbt, yuryshulaev and 122 moreJustFly1984, barrymichaeldoyle, Meow-z, dev-rozaq, john-veresk and 5 moreyvele, gautierrollin, aychtang, jackytck, ro0gr and 8 moreJustFly1984, barrymichaeldoyle, john-veresk, justinhp, mrquanghuy and 3 more