![](/img/trans.png)
[英]how to turn off eslint rule `angular/file-name` in eslint-plugin-angular
[英]How to import environment exported by eslint plugin?
我看到,在https://github.com/Gillespie59/eslint-plugin-angular/blob/master/environments.js款mocks
eslint-插件棱角聲明inject
全局變量。
如何從我的應用程序導入這些環境設置? 我試過"extends": "angular"
分明"extends": "angular"
但是eslint仍然抱怨:
7:14 error 'inject' is not defined no-undef
我嘗試添加:
"env": {
"angular/mocks": true
}
到配置,但后來我得到了
Environment key "angular/mocks" is unknown
您收到此錯誤是因為ESLint只能使用插件而不是配置所暴露的環境。 您必須在配置文件中注冊eslint-plugin-angular作為插件:
"plugins": ["angular"],
"env": {
"angular/mocks": true
}
如果仍然無效,則應使用--debug
標志運行ESLint,以查看配置是否已正確加載並應用了環境。 您還可以使用--print-config
標志運行ESLint,后跟存儲庫中某個文件的路徑,以查看ESLint在使用該文件時將使用的所有規則和全局變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.