【发布时间】:2021-02-04 08:27:13
【问题描述】:
我想在我的应用中使用枚举:
export const enum typeEnum {
TVY = 'TVY',
USER = 'USER',
}
在 npm run webpack:build 时,我收到以下错误:
12:111 错误 'typeEnum' 已在上层范围内声明 无阴影
我在几个与此错误相关的链接上读到,解决方案是将以下内容添加到 eslint 规则中:
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error"
这就是我在 .eslintrc.json 文件中所做的:
{
"plugins": ["@typescript-eslint/tslint"],
"extends": ["jhipster"],
"parserOptions": {
"project": "./tsconfig.base.json"
},
"rules": {
"@typescript-eslint/tslint/config": [
"error",
{
"lintFile": "./tslint.json"
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": false
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error"
}
}
但现在,我在 npm run:webpack:build 也收到此错误:
myPath\src\main\webapp\app\vendor.ts [INFO] 1:1 错误定义 找不到规则“@typescript-eslint/no-shadow” @typescript-eslint/无阴影
你知道我能做什么吗?
谢谢,
曼努埃拉
【问题讨论】:
标签: typescript jhipster eslint