Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe7e235

Browse files
committed
build(lint): use eslint
1 parent 13441bc commit fe7e235

36 files changed

+2656
-185
lines changed

.eslintrc.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"jquery": true,
5+
"node": true
6+
},
7+
"globals": {
8+
"expect": true,
9+
"it": true,
10+
"describe": true,
11+
"beforeEach": true,
12+
"afterEach": true
13+
},
14+
"parserOptions": {
15+
"ecmaVersion": 6
16+
},
17+
"rules": {
18+
19+
"camelcase": 2,
20+
"curly": 2,
21+
"eqeqeq": 2,
22+
"indent": [
23+
2,
24+
2,
25+
{
26+
"SwitchCase": 1
27+
}
28+
],
29+
"no-use-before-define": [
30+
2,
31+
{
32+
"functions": false
33+
}
34+
],
35+
"no-caller": 2,
36+
"new-cap": 0,
37+
"quotes": [
38+
2,
39+
"single"
40+
],
41+
"no-unused-vars": 2,
42+
"strict": [
43+
2,
44+
"function"
45+
],
46+
"no-extend-native": 2,
47+
"wrap-iife": [
48+
2,
49+
"any"
50+
],
51+
"no-empty": 2,
52+
"no-plusplus": 2,
53+
"no-undef": 2,
54+
"linebreak-style": 2,
55+
"max-depth": [
56+
2,
57+
4
58+
],
59+
"no-loop-func": 2,
60+
"complexity": [
61+
2,
62+
13
63+
],
64+
"max-len": [
65+
2,
66+
{
67+
"code": 120,
68+
"ignoreComments": true
69+
}
70+
],
71+
"max-params": [
72+
2,
73+
5
74+
],
75+
76+
77+
"curly": [
78+
2,
79+
"all"
80+
],
81+
"keyword-spacing": [
82+
2,
83+
{}
84+
],
85+
"one-var": [
86+
2,
87+
"never"
88+
],
89+
"array-bracket-spacing": [
90+
2,
91+
"never",
92+
{}
93+
],
94+
"space-in-parens": [
95+
2,
96+
"never"
97+
],
98+
"key-spacing": [
99+
2,
100+
{
101+
"beforeColon": false,
102+
"afterColon": true
103+
}
104+
],
105+
"quote-props": [
106+
2,
107+
"as-needed"
108+
],
109+
"space-infix-ops": 2,
110+
"space-unary-ops": [
111+
2,
112+
{
113+
"words": false,
114+
"nonwords": false
115+
}
116+
],
117+
"no-implicit-coercion": [
118+
2,
119+
{
120+
"boolean": false,
121+
"string": true,
122+
"number": true
123+
}
124+
],
125+
"no-with": 2,
126+
"no-multiple-empty-lines": 2,
127+
"brace-style": [
128+
2,
129+
"1tbs",
130+
{
131+
"allowSingleLine": true
132+
}
133+
],
134+
"eol-last": 2,
135+
"no-trailing-spaces": 2,
136+
"indent": [
137+
2,
138+
2,
139+
{
140+
"SwitchCase": 1
141+
}
142+
]
143+
}
144+
}

.jscsrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"beforeOpeningCurlyBrace": true
66
},
77
"disallowMultipleVarDecl": true,
8-
"requireSpacesInsideObjectBrackets": "allButNested",
98
"disallowSpacesInsideArrayBrackets": true,
109
"disallowSpacesInsideParentheses": true,
1110
"disallowSpaceAfterObjectKeys": true,
@@ -26,4 +25,4 @@
2625
"disallowTrailingWhitespace": true,
2726
"excludeFiles": ["node_modules/**", "bower_components/**"],
2827
"validateIndentation": 2
29-
}
28+
}

gulpfile.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
'use strict';
22
var gulp = require('gulp');
33
var shell = require('gulp-shell');
4-
var jshint = require('gulp-jshint');
4+
var eslint = require('gulp-eslint');
55
var jasmine = require('gulp-jasmine');
6-
var stylish = require('jshint-stylish');
7-
var jscs = require('gulp-jscs');
86
var isWin = /^win/.test(process.platform);
97

108
gulp.task('jsdoc', shell.task([
@@ -13,21 +11,16 @@ gulp.task('jsdoc', shell.task([
1311
'./node_modules/.bin/jsdoc -c ./doc-config.json'
1412
]));
1513

16-
gulp.task('lint', function () {
17-
return gulp.src(['./src/**/*.js'], ['./test/**/*.js'])
18-
.pipe(jshint())
19-
.pipe(jshint.reporter(stylish))
20-
.pipe(jshint.reporter('fail'));
21-
});
22-
2314
gulp.task('test', function () {
2415
return gulp.src('test/**/*.spec.js')
2516
.pipe(jasmine());
2617
});
2718

28-
gulp.task('jscs', function () {
19+
gulp.task('lint', function () {
2920
return gulp.src(['src/**/*.js', 'test/**/*.js'])
30-
.pipe(jscs());
21+
.pipe(eslint())
22+
.pipe(eslint.format())
23+
.pipe(eslint.failAfterError());
3124
});
3225

33-
gulp.task('build', ['lint', 'jscs', 'test']);
26+
gulp.task('build', ['lint', 'test']);

0 commit comments

Comments
 (0)