Reputation: 8170
{
"parserOptions" : {
"ecmaVersion": 2017
},
"env": {
"browser": true,
"node": true,
"es6": true
},
}
module.exports = { "extends": "plugin:prettier/recommended" };
When I try
eslint test.js
I got this error
/home/miki/azatmardan/ch8/new-restexpress/.eslintrc.js:2
"parserOptions" : {
^
SyntaxError: Unexpected token ':'
How to format .eslinterc
?
Upvotes: 0
Views: 666
Reputation: 944568
Your JavaScript is not valid.
You appear to be starting by having an object:
{ "parserOptions" : {
etc
But because you have just thrown an object into the file without putting any context (such as a variable assignment first) it is a syntax error.
It looks like you've mixed up the syntax of .eslintrc.js
and .eslintrc.json
.
Then, you continue with:
module.exports = { "extends": "plugin:prettier/recommended" };
… which completely ignores that object.
You need a single object which you can then either export from a JS file or just have in a JSON file.
{
"extends": "plugin:prettier/recommended",
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"browser": true,
"node": true,
"es6": true
}
}
module.exports = {
"extends": "plugin:prettier/recommended",
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"browser": true,
"node": true,
"es6": true
}
}
Upvotes: 3