SublimeLinter
SublimeLinter
关于代码检查 郑重推荐这个插件
官方插件库中仅有sublime3 有此插件
(对于ST2 有个sublimeLinter for ST2 没试过)
SublimeLinter只是一个检测环境, 检测的功能还需其他插件来完成, 安装好SublimeLinter后, 再装SublimeLinter-jscs SublimeLinter-csslint 之类的插件
环境
- NodeJS
- NodeJS 中还需全局安装 jscs jshint csslint
当然了, 如果你只用jscs 就只安装jscs这个模块啦
用户配置
官方配置文档 http://www.sublimelinter.com/en/latest/global_settings.html
PS path是自动寻找的, 无需手动指定
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Blueberry/round/Blueberry - round.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "load/save", //保存的时候运行代码检查
"linters": {
"csslint": {
"@disable": false,
"args": [],
"errors": "",
"excludes": [],
"ignore": "box-model,adjoining-classes,box-sizing,compatible-vendor-prefixes,gradients,text-indent,fallback-colors,star-property-hack,underscore-property-hack,bulletproof-font-face,font-faces,import,regex-selectors,universal-selector,unqualified-attributes,overqualified-elements,duplicate-background-images,floats,font-sizes,ids,important,outline-none,qualified-headings,unique-headings",
"warnings": ""
},
"jscs": {
"@disable": false,
"args": [
"--config",
"C:\\Users\\rakuluo\\AppData\\Roaming\\Sublime Text 3\\Packages\\User\\.jscsrc"
],
"excludes": []
},
"jshint": {
"@disable": true,
"args": [
"--config",
"C:\\Users\\rakuluo\\AppData\\Roaming\\Sublime Text 3\\Packages\\User\\.jshintrc"
],
"excludes": []
},
"scss": {
"@disable": false,
"args": [
"--config",
"C:\\Users\\xxxx\\AppData\\Roaming\\Sublime Text 3\\Packages\\User\\.scss-lint.yml"
],
"exclude-linter": "",
"excludes": [],
"include-linter": ""
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"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",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
其中 C:\Users\rakuluo\AppData\Roaming\Sublime Text 3\Packages\ 是 Browse Packages 的路径
jsrc csslint 配置文件
jsrc csslint的配置文件可以在http://imweb.github.io/CodeGuide/下载 之后放在Packages 的 User 目录下
更多配置http://imweb.github.io/CodeGuide/
使用
"lint_mode": "load/save", //保存的时候运行代码检查
之后可以在保存时显示感叹号和warning的框, 光标移动到warning时将会在状态栏显示详细错误信息