关于Sublime Text 2中的SublimeLinter的使用网上多如牛毛,基本上不会遇到什么问题,简单的讲一下关于Sublime Text 3中遇到的问题:
1.通过package control(cmd+shift+p),搜索SublimeLinter,安装,如果按照网上的配置是没法进行JS和CSS校验的;
2.安装jshint,csslint,SublimeLinter在Text 3中自己本身演变成了一个框架,关于各个语言校验的集合,关于各种语言的校验又拆成对应的小模块:
(需要安装node,如果没有安装的可以参考本人之前的文章)
安装jshint:
1
|
npm install -g jshint
|
安装csslint:
1
|
npm install -g csslint
|
3.这个时候不要急于配置,还需要两个对应的插件SublimeLinter-jshint以及SublimeLinter-csslint,如果没有出错的话,这个时候是有对应的JS和CSS警告以及提示的;
4.配置可选项,SublimeLinter向下兼容,配置选项参考网上前辈的配置:
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{
"sublimelinter"
:
"save-only"
,
"sublimelinter_popup_errors_on_save"
:
true
,
"sublimelinter_executable_map"
: {
"javascript"
:
"http://www.cnblogs.com/xiaofeixiang/"
,
"css"
:
"http://www.cnblogs.com/xiaofeixiang/"
},
"jshint_options"
: {
"strict"
:
false
,
"quotmark"
:
"single"
,
//只能使用单引号
"noarg"
:
true
,
"noempty"
:
true
,
//不允许使用空语句块{}
"eqeqeq"
:
false
,
//!==和===检查
"undef"
:
true
,
"curly"
:
true
,
//值为true时,不能省略循环和条件语句后的大括号
"forin"
:
true
,
//for in hasOwnPropery检查
"devel"
:
true
,
"jquery"
:
true
,
"browser"
:
true
,
"wsh"
:
true
,
"evil"
:
true
,
"unused"
:
"vars"
,
//形参和变量未使用检查
"latedef"
:
true
,
//先定义变量,后使用
"globals"
: {
"grunt"
:
true
,
"module"
:
true
,
"window"
:
true
,
"jQuery"
:
true
,
"$"
:
true
,
"global"
:
true
,
"document"
:
true
,
"console"
:
true
,
"setTimeout"
:
true
,
"setInterval"
:
true
}
},
"csslint_options"
: {
"adjoining-classes"
:
false
,
"box-sizing"
:
false
,
"box-model"
:
false
,
"compatible-vendor-prefixes"
:
false
,
"floats"
:
false
,
"font-sizes"
:
false
,
"gradients"
:
false
,
"important"
:
false
,
"known-properties"
:
false
,
"outline-none"
:
false
,
"qualified-headings"
:
false
,
"regex-selectors"
:
false
,
"shorthand"
:
false
,
"text-indent"
:
false
,
"unique-headings"
:
false
,
"universal-selector"
:
false
,
"unqualified-attributes"
:
false
}
}
|
本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4853625.html,如需转载请自行联系原作者