[英]Standardjs no-unused-vars while it's used
In my Typescript React project, I defined: 在我的Typescript React项目中,我定义了:
export type NavState = { mounted: boolean }
and then in my component I used theme like: 然后在我的组件中我使用了以下主题:
import { NavState } from '../../models/nav'
class Nav extends React.Component<any, NavState> {
state: NavState = {
mounted: false
}
}
but I got red underline for NavState
in my import and it says: 但是我在导入时得到了
NavState
红色下划线,它说:
'NavState' is defined but never used. (no-unused-vars)standard(no-unused-vars)
In my package.json
I have this: 在我的
package.json
我有这个:
"standard": {
"ignore": [
"node_modules/**",
"**/__generated__/"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
]
}
and my vs-code settings.json
is like this: 和我的vs-code
settings.json
是这样的:
{
"standard.autoFixOnSave": true,
"standard.enable": true,
"standard.run": "onType",
"standard.validate": [
{ "language": "javascript", "autoFix": true },
{ "language": "javascriptreact", "autoFix": true },
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
]
}
Why Standardjs can't understand that I used a type alias? 为什么Standardjs无法理解我使用了类型别名? and how can I fix it?
我该如何解决?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.