-
-
Notifications
You must be signed in to change notification settings - Fork 239
TypeError: Cannot read property 'range' of null from template-curly-spacing #530
Comments
Weird.. 🤔 it works fine with just
Also just FYI, babel-preset-latest has been deprecated? Can you recreate a repo that produces this error (and with the minimal dependencies/config). I don't think the other eslint plugins/configs should matter.
|
Locking to 8.0.1 seems to be ok. |
8.0.2 works fine too. |
After a few hours digging, I found the root problem. There are multiple copies of [1] % npm list @babel/types
├─┬ babel-eslint@8.1.2
│ ├─┬ @babel/traverse@7.0.0-beta.31
│ │ ├─┬ @babel/helper-function-name@7.0.0-beta.31
│ │ │ ├─┬ @babel/helper-get-function-arity@7.0.0-beta.31
│ │ │ │ └── @babel/types@7.0.0-beta.31
│ │ │ ├─┬ @babel/template@7.0.0-beta.31
│ │ │ │ └── @babel/types@7.0.0-beta.31
│ │ │ └── @babel/types@7.0.0-beta.31
│ │ └── @babel/types@7.0.0-beta.31
│ └── @babel/types@7.0.0-beta.31
└─┬ babel-plugin-import@1.6.3
└─┬ @babel/helper-module-imports@7.0.0-beta.36
└── @babel/types@7.0.0-beta.36
|
Temporary fix for babel/babel-eslint#530
how to fix this ? Anybody know ? |
@delch Install |
I have same issue. The most annoying thing is that it doesn't bubbles for old peaces of code with template literals, but only for fresh once. Can't figure out why. It does creeps me out a lot.
|
ps I have "@babel/types": "7.0.0-beta.39" in my devDependencies |
In case anyone is in a similar situation - this problem occurred for me when I bumped my Node version from 6.11.1 to 8.9.4. I took two steps to resolve this -
|
In my case upgrading to babel-eslint@8.2.2 has solved the problem. |
@jasonblanchard confirmed pin its good to resolve the issue since that means newer version of this plugin really is nobody using it.. lol |
I've missed this error for a while, but today I had edited like 20 files using template literals, and I had this error again. Weirdest thing that error appeared in 10 of edited files, and there was no errors for other part of the files. All 20 files are React components, and all 20 fixes had similar pattern. I looked at babel-eslint version, and I had 8.2.2 I've downgraded it to 7.2.3 and errors disappeared. |
I tried all suggested fixes from above but I still get the error. The error came out of nowhere after switching branches and coming back to my initial branch. Nothing in package.json had changed. I just removed node_modules and re-installed all with yarn install. I also tried eslint 5.0.0.alpha and different babel-eslint versions. Frustrating, the error is: I'm on node 9.5.0 |
Same error, if I remove the
|
Why is |
I managed to fix this problem for myself; our company's internal ESLint config defined Removing the line |
@ryaninvents Worked for me too. Thank you! |
fixed #815 (comment) |
I have been able to resolve this issue by upgrading |
babel-eslint has trouble parsing some files for random, unknown reasons (e.g. babel/babel-eslint#530 and babel/babel-eslint#799). The error given is `TypeError: Cannot read property 'range' of null` which comes from `OffsetStorage.setDesiredOffset` (eslintrc.rules.indent). Ignoring template literals fixes this.
Still having it.
|
@KarmaBlackshaw, have you tried #530 (comment)? |
@TomasBarry yes, but to no avail. |
I've run into these issues before with just the version of |
This only occurs on vue-router. Line 1 which is |
You’re still using babel 6? |
@ljharb, These are the only babels I'm only using.
Perhaps, they need to be matched? |
babel-core bridge is only used to be able to use Babel 6, i thought. |
I have updated it now to use the latest stable version which is 6.26.3. Still the same. I don't like turning off rules though, but for now, it seems that it is just appropriate. I believe this is just a hack.
|
Right, Babel 7+ is at |
* TypeError: Cannot read property 'range' of null * babel/babel-eslint#530
Downgrading to babel-eslint 8.x was the only way I was able to solve this after trying the other suggestions here. |
With this
.eslintrc
config:And these dependencies:
this code snippet:
results in this error when running eslint:
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 pinbabel-eslint
to7.2.3
.Happy to provide any other information if necessary!
The text was updated successfully, but these errors were encountered: