【发布时间】:2021-01-29 13:37:18
【问题描述】:
我正在尝试删除this SO thread 中为Angular 回答的未使用的导入和声明。我正在尝试使用eslint-plugin-react 来实现目标,但没有找到任何选项来使用单个命令从整个项目中删除未使用的导入和声明。
这是我的 .eslintrc.json
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12
},
"plugins": [
"react",
"@typescript-eslint",
"unused-imports"
],
"rules": {
"indent": [
"warn",
"tab"
],
"linebreak-style": [
"warn",
"windows"
],
"quotes": [
"warn",
"double"
],
"semi": [
"warn",
"always"
],
"@typescript-eslint/no-unused-vars": "on",
"unused-imports/no-unused-imports-ts": "on"
}
}
或者有没有办法在 VS Code 中使用 ESLint 或 Typescript Hero 扩展来做同样的事情?
【问题讨论】:
标签: reactjs typescript visual-studio-code eslint