eslint: error Parsing error: The keyword 'const' is reserved
up vote
98
down vote
favorite
I am getting this error from ESLint:
error Parsing error: The keyword 'const' is reserved
from this code:
const express = require('express');
const app = express();
const _ = require('underscore');
I've tried removing node_modules
and reinstalling all npm packages (as suggested here), but to no avail.
javascript node.js ecmascript-6 eslint
add a comment |
up vote
98
down vote
favorite
I am getting this error from ESLint:
error Parsing error: The keyword 'const' is reserved
from this code:
const express = require('express');
const app = express();
const _ = require('underscore');
I've tried removing node_modules
and reinstalling all npm packages (as suggested here), but to no avail.
javascript node.js ecmascript-6 eslint
add a comment |
up vote
98
down vote
favorite
up vote
98
down vote
favorite
I am getting this error from ESLint:
error Parsing error: The keyword 'const' is reserved
from this code:
const express = require('express');
const app = express();
const _ = require('underscore');
I've tried removing node_modules
and reinstalling all npm packages (as suggested here), but to no avail.
javascript node.js ecmascript-6 eslint
I am getting this error from ESLint:
error Parsing error: The keyword 'const' is reserved
from this code:
const express = require('express');
const app = express();
const _ = require('underscore');
I've tried removing node_modules
and reinstalling all npm packages (as suggested here), but to no avail.
javascript node.js ecmascript-6 eslint
javascript node.js ecmascript-6 eslint
edited Oct 14 at 16:26
MultiplyByZer0
2,66322138
2,66322138
asked Mar 9 '17 at 22:19
opike
2,213114277
2,213114277
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
up vote
147
down vote
accepted
ESLint defaults to ES5 syntax-checking. You'll want to override to the latest well-supported version of JavaScript.
Try adding a .eslintrc
file to your project. Inside it:
{
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true
}
}
Hopefully this helps.
EDIT: I also found this example .eslintrc
which might help.
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
add a comment |
up vote
2
down vote
I used .eslintrc.js and I have added following code.
module.exports = {
"parserOptions": {
"ecmaVersion": 6
}
};
add a comment |
up vote
0
down vote
I had this same problem with this part of my code:
const newComment = {
dishId: dishId,
rating: rating,
author: author,
comment: comment
};
newComment.date = new Date().toISOString();
Same error, const is a reserved word.
The thing is, I made the .eslintrc.js from the link you gave in the update and still got the same error. Also, I get an parsing error in the .eslintrc.js
: Unexpected token ':'
.
Right in this part:
"env": {
"browser": true,
"node": true,
"es6": true
},
...
add a comment |
up vote
0
down vote
you also can add this inline instead of config, just add it to the same file before you add your own disable stuff
/* eslint-env es6 */
/* eslint-disable no-console */
my case was disable a file and eslint-disable were not working for me alone
/* eslint-env es6 */
/* eslint-disable */
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
147
down vote
accepted
ESLint defaults to ES5 syntax-checking. You'll want to override to the latest well-supported version of JavaScript.
Try adding a .eslintrc
file to your project. Inside it:
{
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true
}
}
Hopefully this helps.
EDIT: I also found this example .eslintrc
which might help.
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
add a comment |
up vote
147
down vote
accepted
ESLint defaults to ES5 syntax-checking. You'll want to override to the latest well-supported version of JavaScript.
Try adding a .eslintrc
file to your project. Inside it:
{
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true
}
}
Hopefully this helps.
EDIT: I also found this example .eslintrc
which might help.
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
add a comment |
up vote
147
down vote
accepted
up vote
147
down vote
accepted
ESLint defaults to ES5 syntax-checking. You'll want to override to the latest well-supported version of JavaScript.
Try adding a .eslintrc
file to your project. Inside it:
{
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true
}
}
Hopefully this helps.
EDIT: I also found this example .eslintrc
which might help.
ESLint defaults to ES5 syntax-checking. You'll want to override to the latest well-supported version of JavaScript.
Try adding a .eslintrc
file to your project. Inside it:
{
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true
}
}
Hopefully this helps.
EDIT: I also found this example .eslintrc
which might help.
edited Oct 14 at 16:22
MultiplyByZer0
2,66322138
2,66322138
answered Mar 9 '17 at 22:26
iamjpg
2,78711114
2,78711114
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
add a comment |
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
so much trouble to find this, thank you
– Michael Pell
Jul 26 '17 at 2:06
add a comment |
up vote
2
down vote
I used .eslintrc.js and I have added following code.
module.exports = {
"parserOptions": {
"ecmaVersion": 6
}
};
add a comment |
up vote
2
down vote
I used .eslintrc.js and I have added following code.
module.exports = {
"parserOptions": {
"ecmaVersion": 6
}
};
add a comment |
up vote
2
down vote
up vote
2
down vote
I used .eslintrc.js and I have added following code.
module.exports = {
"parserOptions": {
"ecmaVersion": 6
}
};
I used .eslintrc.js and I have added following code.
module.exports = {
"parserOptions": {
"ecmaVersion": 6
}
};
answered Jun 17 at 9:34
Kajornjit Songsaen
53638
53638
add a comment |
add a comment |
up vote
0
down vote
I had this same problem with this part of my code:
const newComment = {
dishId: dishId,
rating: rating,
author: author,
comment: comment
};
newComment.date = new Date().toISOString();
Same error, const is a reserved word.
The thing is, I made the .eslintrc.js from the link you gave in the update and still got the same error. Also, I get an parsing error in the .eslintrc.js
: Unexpected token ':'
.
Right in this part:
"env": {
"browser": true,
"node": true,
"es6": true
},
...
add a comment |
up vote
0
down vote
I had this same problem with this part of my code:
const newComment = {
dishId: dishId,
rating: rating,
author: author,
comment: comment
};
newComment.date = new Date().toISOString();
Same error, const is a reserved word.
The thing is, I made the .eslintrc.js from the link you gave in the update and still got the same error. Also, I get an parsing error in the .eslintrc.js
: Unexpected token ':'
.
Right in this part:
"env": {
"browser": true,
"node": true,
"es6": true
},
...
add a comment |
up vote
0
down vote
up vote
0
down vote
I had this same problem with this part of my code:
const newComment = {
dishId: dishId,
rating: rating,
author: author,
comment: comment
};
newComment.date = new Date().toISOString();
Same error, const is a reserved word.
The thing is, I made the .eslintrc.js from the link you gave in the update and still got the same error. Also, I get an parsing error in the .eslintrc.js
: Unexpected token ':'
.
Right in this part:
"env": {
"browser": true,
"node": true,
"es6": true
},
...
I had this same problem with this part of my code:
const newComment = {
dishId: dishId,
rating: rating,
author: author,
comment: comment
};
newComment.date = new Date().toISOString();
Same error, const is a reserved word.
The thing is, I made the .eslintrc.js from the link you gave in the update and still got the same error. Also, I get an parsing error in the .eslintrc.js
: Unexpected token ':'
.
Right in this part:
"env": {
"browser": true,
"node": true,
"es6": true
},
...
edited Oct 14 at 0:49
DarkSuniuM
799819
799819
answered Oct 14 at 0:10
Marcos Sevilla
11
11
add a comment |
add a comment |
up vote
0
down vote
you also can add this inline instead of config, just add it to the same file before you add your own disable stuff
/* eslint-env es6 */
/* eslint-disable no-console */
my case was disable a file and eslint-disable were not working for me alone
/* eslint-env es6 */
/* eslint-disable */
add a comment |
up vote
0
down vote
you also can add this inline instead of config, just add it to the same file before you add your own disable stuff
/* eslint-env es6 */
/* eslint-disable no-console */
my case was disable a file and eslint-disable were not working for me alone
/* eslint-env es6 */
/* eslint-disable */
add a comment |
up vote
0
down vote
up vote
0
down vote
you also can add this inline instead of config, just add it to the same file before you add your own disable stuff
/* eslint-env es6 */
/* eslint-disable no-console */
my case was disable a file and eslint-disable were not working for me alone
/* eslint-env es6 */
/* eslint-disable */
you also can add this inline instead of config, just add it to the same file before you add your own disable stuff
/* eslint-env es6 */
/* eslint-disable no-console */
my case was disable a file and eslint-disable were not working for me alone
/* eslint-env es6 */
/* eslint-disable */
answered Nov 21 at 21:32
yousef
39948
39948
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42706584%2feslint-error-parsing-error-the-keyword-const-is-reserved%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown