[英]Unexpected token … in VSCode ESLint + Prettier
I have a node project and am using VSCode. 我有一个节点项目,正在使用VSCode。 I can't get ESLint or Prettier to work properly, they are not highlighting errors or auto-formatting code.
我无法使ESLint或Prettier正常工作,它们没有突出显示错误或自动格式化代码。
The only output I am getting is: 我得到的唯一输出是:
(node:74324) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: ) SyntaxError: Unexpected token ...
I've been through the setup multiple times and believe I have my .eslintrc.json
and .prettierrc.json
set up properly. 我已经完成了多次设置,并相信我已经正确设置了
.eslintrc.json
和.prettierrc.json
。 The error seems like it might be that the linters are not recognizing more modern javascript like object rest spread, but, I have experimented with adding "parser": "babel-eslint"
to my ESLint settings file, and "ecmaVersion": 2018
, to parserOptions, but to no avail. 该错误似乎似乎是
"parser": "babel-eslint"
没有意识到像对象休息传播这样的更现代的javascript,但是,我已经尝试在我的ESLint设置文件中添加"parser": "babel-eslint"
和"ecmaVersion": 2018
,解析器选项,但无济于事。
Is there something I am missing to get these tools working? 我缺少使这些工具正常工作的功能吗?
I had similar problem yesterday. 昨天我有类似的问题。 It helped to upgrade VSCode to version 1.36.1.
它帮助将VSCode升级到版本1.36.1。 Than Eslint works fine.
比埃斯林特还不错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.