I have a problem with eslint, it gives me [Parsing Error The keyword import is reserve] this is only occur in sublime, in atom editor work well. I have eslint
.eslintr
The problem was i had installed eslint globally and locally, causing inconsistencies in SublimeLinter-contrib-eslint. I uninstalled eslint globally and SublimeLinter is working.
Add this to the root of your .eslintrc
"parser": "babel-eslint"
and make sure to run:
npm i babel-eslint --save-dev
i also got this error in a meteor project and i could solved it setting sourceType to "module" more details can be found in Eslint docs: http://eslint.org/docs/user-guide/configuring#specifying-parser-options
The eslint option that solves the "The keyword import is reserved" error is parserOptions.sourceType
. Setting it to "module"
allows the import
keyword to be used.
.eslintrc
{
"parserOptions": {
"sourceType": "module"
}
}
Docs: https://eslint.org/docs/user-guide/configuring#specifying-parser-options
This config worked for me. (I am using create-react-app but applicable to any eslint project)
.eslintrc (create file in root if it doesnt exist)
{
"rules": {
"jsx-a11y/anchor-is-valid": [ "error", {
"components": [ "Link" ],
"specialLink": [ "to" ]
}]
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2015
}
}
Closing VS code and re-open it does the trick for me...