【发布时间】:2017-04-06 18:27:45
【问题描述】:
我使用 sublime 作为我的 IDE,并且已经下载了 sublimelinter 用于使用 eslint 对我的 javascript 进行 linting。在sublimelinter.sublimesettings 文件中,我将其配置为使用如下所示的 eslint:
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "load/save",
"linters": {
"eslint": {
"@disable": false,
"args": [],
"excludes": [],
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": true,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"warning_color": "000000",
"wrap_find": true
}
}
我的问题是我在网上找不到任何东西来抑制来自 eslint 的警告。我试过在 eslint 中使用 "ignore": "W" 作为一个值,但它没有用。 Eslint 工作正常,我似乎无法找到抑制警告的解决方案。有任何想法吗?
编辑: 这是我的 .eslintrc 文件:
{
/* Don't search any further for .eslintrc files */
"root": true,
/* See all the pre-defined configs here: https://www.npmjs.com/package/eslint-config-defaults */
"extends": [
"eslint:recommended",
"defaults/configurations/google"
],
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals":{
"angular": 1,
"phoenix": 1,
"requirejs": 1
},
"rules": {
"indent": [
2,
2,
{ "SwitchCase": 1 }
],
/* We don't do this consistently, so disable it as it is treated as an error otherwise */
"newline-after-var": 0,
"dot-location": [2, "property"],
"no-extra-semi": 1,
"semi": 2,
"max-len": [2, 250, 2],
"eqeqeq": 2,
"comma-dangle": 1,
"no-console": 0,
"no-debugger": 1,
"no-extra-parens": 1,
"no-irregular-whitespace": 0,
"no-undef": 1,
"no-unused-vars": 2,
"semi-spacing": 1
}
}
【问题讨论】:
-
您的
.eslintrc文件中有什么内容? -
@idleberg 我在编辑中添加了我的
.eslintrc文件。 -
您想忽略所有警告,但保留错误吗?如果是这样,
eslint --quiet是否满足您的需求? -
@Aurora0001 是的,这就是我想做的。我会尝试在配置文件中添加安静。
-
@Aurora0001 太棒了!为 eslinter 配置的
args添加安静有效。如果您将其作为答案,我可以接受。谢谢!
标签: sublimetext3 eslint suppress-warnings sublimelinter