manlili blog

sublime之插件sublimeLinter使用

全局安装standard

打开gitBash-> 输入命令:npm install standard –global ->查看是否安装成功-> 输入命令:standard –version

安装sublime插件package control

快捷键ctrl+` 或者View->Show Console,输入如下代码(sublime text3)

1
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

安装sublime插件sublimeLinter,Sublime​Linter-contrib-standard与standardFormat

①按下 Ctrl+Shift+p 进入 Command Palette
②输入install进入 Package Control: Install Package
③输入SublimeLinter。进行安装.
④重复①②③,到第③步输入Sublime​Linter-contrib-standard进行安装
⑤重复①②③,到第③步输入standardFormat进行安装

设置语法检测规则

sublime->preferences->package-settings->sublimeLinter->setting-user->进到页面里面找到linters字段,在下面填写如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"standard": {
"@disable": false,
"args": [
"--global=Lizard",
"--global=location",
"--global=define",
"--global=Promise",
"--global=BMap",
"--global=_",
"--global=$",
"--global=define",
"--global=console",
"--global=wvjb",
"--global=Mlink",
"--global=require",
"--global=Set",
"--global=Promise",
"--global=setImmediate",
"--global=BNJS",
"--global=wx"
],
"excludes": []
}

填完后形式为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"linters": {
"standard": {
"@disable": false,
"args": [
"--global=Lizard",
"--global=location",
"--global=define",
"--global=Promise",
"--global=BMap",
"--global=_",
"--global=$",
"--global=define",
"--global=console",
"--global=wvjb",
"--global=Mlink",
"--global=require",
"--global=Set",
"--global=Promise",
"--global=setImmediate",
"--global=BNJS",
"--global=wx"
],
"excludes": []
}
},

重启sublime,随便打开一个js文件写点错误代码保存查看效果

请我喝杯果汁吧!