I am using eslint
for a javascript project. eslint
failed to parse spread operator and I got this error 11:18 error Parsing error: Unexpected token ..
.
The code for above error is:
return { ...render }
The eslint configuration is yml file:
env:
browser: true
es6: true
extends: 'eslint:remended'
parserOptions:
ecmaVersion: 2017
sourceType: module
experimentalObjectRestSpread: true
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-console:
- off
prefer-spread: "error"
I am using eslint
for a javascript project. eslint
failed to parse spread operator and I got this error 11:18 error Parsing error: Unexpected token ..
.
The code for above error is:
return { ...render }
The eslint configuration is yml file:
env:
browser: true
es6: true
extends: 'eslint:remended'
parserOptions:
ecmaVersion: 2017
sourceType: module
experimentalObjectRestSpread: true
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-console:
- off
prefer-spread: "error"
Share
Improve this question
edited Jan 19, 2019 at 4:51
Ry-♦
225k56 gold badges492 silver badges498 bronze badges
asked Jan 19, 2019 at 4:39
Joey Yi ZhaoJoey Yi Zhao
42.7k87 gold badges353 silver badges659 bronze badges
1
- Which version of ESLint are you using? – Ry- ♦ Commented Jan 19, 2019 at 4:52
2 Answers
Reset to default 6This is related to ESLint doesn't support spread operator in objects #10307, where full description of various alternatives on how to fix it is listed.
Essentially it boils down to changing to ecmaVersion: 2018
(or the equivalent ecmaVersion: 9
), which is when it first was officially supported. With this change there is also no need for the experimentalObjectRestSpread: true
any more.
The issue is fixed by add configuration: parser: 'babel-eslint'
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742323593a4422306.html
评论列表(0条)