脚本宝典收集整理的这篇文章主要介绍了在sublime中实现代码检测,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
在sublime中配置linter, eslint
sublime插件安装
-
进入到,对path进行配置:
配置node_modules的基本位置:/usr/local/lib/node_modules
配置其他各项插件的位置:如eslint: /usr/local/bin/eslint
示例代码如下:
"paths": {
"linux": [],
"OSX": [
"/usr/local/bin/node",
"/usr/local/lib/node_modules",
"/usr/local/bin/eslint",
"/usr/local/bin/jslint"
],
"windows": []
}
安装插件(以eslint为例):
-
安装eslint的npm插件,包括:
然后就可以愉快的使用啦!
可以通过右键进入到sublimelinter
来调用其功能。
.eslintrc文件示例
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"parser": "babel-eslint",
"extends" : [
"airbnb"
],
"plugins": [
"babel",
"promise"
],
"ecmaFeatures": {
"jsx": true
},
"rules": {
"SEMi": [2, "always"],
"quotes": [2, "single"]
}
}
最后
展示一下配置完成后的sublimelinter-user.settings
:
{
"user": {
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"eslint": {
"@disable": false,
"args": [],
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true,
"es6": true,
"node": true
},
"excludes": [],
"extends": [
"standard"
],
"parser": "babel-eslint",
"plugins": [
"babel",
"PRomise"
],
"rules": {
"quotes": [
2,
"single"
],
"semi": [
2,
"always"
]
}
},
"jsxhint": {
"@disable": false,
"args": [],
"excludes": []
}
},
"mark_style": "stippled underline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [
"/usr/local/bin/node",
"/usr/local/lib/node_modules",
"/usr/local/bin/eslint"
],
"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": "DDB700",
"wrap_find": true
}
}
以上是脚本宝典为你收集整理的在sublime中实现代码检测全部内容,希望文章能够帮你解决在sublime中实现代码检测所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。