Typescript Eslint QA
项目配置完 eslint之后报👇错误
Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context
解决办法:
// .eslintrc
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
// //也就是ES6语法支持的意思
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"plugins": ["@typescript-eslint"],
// ...
}