[英]Display es-lint html errors in Intellij/Webstorm
I've set up es-lint for my Angular project.我已经为我的 Angular 项目设置了 es-lint。 Everything works fine, except error highlighting in html files in the Intellij/Webstorm IDE.
一切正常,除了 Intellij/Webstorm IDE 中 html 文件中的错误突出显示。 I want to display an error if I use a method in a template.
如果我在模板中使用方法,我想显示错误。
.eslintrc.json .eslintrc.json
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/no-call-expression": "error"
}
}
]
}
html file in IDE IDE 中的 html 文件
dev packages开发包
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.5",
"@angular-eslint/builder": "0.8.0-beta.7",
"@angular-eslint/eslint-plugin": "0.8.0-beta.7",
"@angular-eslint/eslint-plugin-template": "0.8.0-beta.7",
"@angular-eslint/schematics": "^0.8.0-beta.7",
"@angular-eslint/template-parser": "0.8.0-beta.7",
"@angular/cli": "~11.0.5",
"@angular/compiler-cli": "~11.0.5",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "4.3.0",
"@typescript-eslint/parser": "4.3.0",
"codelyzer": "^6.0.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"prettier": "2.2.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"typescript": "~4.0.2"
}
If I run ng lint
, it correctly outputs the errors, however, in my IDE I can't see any issue highlighted.如果我运行
ng lint
,它会正确输出错误,但是,在我的 IDE 中,我看不到任何突出显示的问题。 However if I set a rule for a ts file, it displays correctly even in IDE.但是,如果我为 ts 文件设置规则,即使在 IDE 中也能正确显示。 My eslint settings are set to automatic inside the IDE:
我的 eslint 设置在 IDE 内设置为自动:
Please try adding html
to eslint.additional.file.extensions
list in Registry ( Help > Find Action... , type registry...
to locate it) and re-start the IDE请尝试将
html
添加到注册表中的eslint.additional.file.extensions
列表( Help > Find Action... ,键入registry...
以找到它)并重新启动 IDE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.