英文:
Why doesn't eslint allow the rule option @typescript-eslint/consistent-type-imports?
问题
I applied the eslint rule as follows.
module.exports = {
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{
fixStyle: "inline-type-imports"
}
]
}
}
After that, I tried to run the fix option using eslint.
eslint --fix --ext js,ts,tsx .
But get error
Oops! Something went wrong! :(
ESLint: 8.26.0
Error: .eslintrc.js:
Configuration for rule "@typescript-eslint/consistent-type-imports" is invalid:
Value {"fixStyle":"inline-type-imports"} should NOT have additional properties.
at ConfigValidator.validateRuleOptions (.../node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2027:23)
at .../node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2082:18
It's an option that's also in the actual official document, why doesn't it apply?
my package.json
{
"devDependencies": {
"typescript": "4.8.4",
"eslint": "^8.26.0"
}
}
英文:
I applied the eslint rule as follows.
module.exports = {
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{
fixStyle: "inline-type-imports"
}
],
}
}
After that, I tried to run the fix option using eslint.
eslint --fix --ext js,ts,tsx .
But get error
Oops! Something went wrong! :(
ESLint: 8.26.0
Error: .eslintrc.js:
Configuration for rule "@typescript-eslint/consistent-type-imports" is invalid:
Value {"fixStyle":"inline-type-imports"} should NOT have additional properties.
at ConfigValidator.validateRuleOptions (.../node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2027:23)
at .../node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2082:18
It's an option that's also in the actual official document, why doesn't it apply?
my package.json
{
"devDependencies": {
"typescript": "4.8.4"
"eslint": "^8.26.0",
}
}
答案1
得分: 2
这是除了我在问题中提到的软件包版本问题之外的另一个版本问题。
我的解决方案是升级版本 5.41.0
=> 5.59.9
{
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
}
英文:
This was a version issue of something other than the version issue of the packages I presented in the question.
My solution is upgrade version 5.41.0
=> 5.59.9
{
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论