【发布时间】:2022-01-14 17:26:35
【问题描述】:
我的 eslint 在我的 TS 代码上显示一个错误,它应该可以工作:
const foo = {
key1: 'value1',
key2: 'value2'
};
type MyType = keyof typeof foo;
ESLint: Parsing error: Unexpected token `typeof`, expected the token `;`(prettier/prettier
应用程序是由 create-react-app 工具创建的,带有一些用于 eslint 的默认配置,我添加了更漂亮的支持,这是我的所有配置:
// eslintrc
"extends": [
"react-app",
"react-app/jest",
"eslint:recommended",
"plugin:prettier/recommended"
],
here is printscreen of my IDE with the error
有什么想法吗?谢谢!
Edit1:实际上我发现是由plugin:prettier/recommended 引起的,当我删除它时,它将停止调用该错误。但是我想添加这个插件
【问题讨论】:
-
对此有一个重复的问题:stackoverflow.com/questions/36001552/…
标签: typescript eslint prettier