简体   繁体   English

让ESLint忽略未使用的Angular $ log变量

[英]Getting ESLint to ignore unused Angular $log variable

For JavaScript I'm using ESLint in Atom with Angular 1.5. 对于JavaScript,我在Angular 1.5的Atom中使用ESLint。 I have the following excerpt in my .eslintrc file: 我的.eslintrc文件中包含以下摘录:

"rules": {
    "no-unused-vars": ["warn", {
        "varsIgnorePattern": "\\$log"
    }]

The ESLint no-unused-vars documentation says I can use a regular expression. ESLint no-unused-vars文档说我可以使用正则表达式。 Yet ESLint still gives me a warning for the $log variable I have injected in an Angular controller. 但是,ESLint仍然会警告我,我已在Angular控制器中注入了$log变量。 (I've tried "$log" as well with no escaping, and the same thing happens.) (我也尝试过"$log" ,没有转义,并且发生了同样的事情。)

尝试使用args IgnorePattern代替vars signorepattern

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM