Skip to content
Advertisement

eslint: error Parsing error: The keyword ‘const’ is reserved

I am getting this error from ESLint:

JavaScript

from this code:

JavaScript

I’ve tried removing node_modules and reinstalling all npm packages (as suggested here), but to no avail.

Advertisement

Answer

ESLint defaults to ES5 syntax-checking.
You’ll want to override to the latest well-supported version of JavaScript.

Try adding a .eslintrc.json file to your project. Inside it:

JavaScript

Hopefully this helps.

EDIT: I also found this example .eslintrc.json which might help.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement