X Tutup
Skip to content

Commit 8fd4d16

Browse files
committed
Add jscsrc and fix styles
1 parent e9f06ec commit 8fd4d16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+256
-227
lines changed

.jscsrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"],
3+
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
4+
"requireSpacesInFunctionExpression": {
5+
"beforeOpeningCurlyBrace": true
6+
},
7+
"requireSpacesInsideObjectBrackets": "allButNested",
8+
"disallowSpacesInsideArrayBrackets": true,
9+
"disallowSpacesInsideParentheses": true,
10+
"disallowSpaceAfterObjectKeys": true,
11+
"disallowQuotedKeysInObjects": true,
12+
"requireSpaceBeforeBinaryOperators": ["?", "+", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
13+
"disallowSpaceAfterBinaryOperators": ["!"],
14+
"requireSpaceAfterBinaryOperators": ["?", ",", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
15+
"disallowSpaceBeforeBinaryOperators": [","],
16+
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
17+
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
18+
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
19+
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
20+
"disallowImplicitTypeConversion": ["numeric", "binary", "string"],
21+
"disallowKeywords": ["with", "eval"],
22+
"disallowMultipleLineBreaks": true,
23+
"disallowKeywordsOnNewLine": ["else"],
24+
"requireLineFeedAtFileEnd": true,
25+
"excludeFiles": ["node_modules/**", "bower_components/**"],
26+
"validateIndentation": 2
27+
}

gulpfile.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ var gulp = require('gulp'),
33
shell = require('gulp-shell'),
44
jshint = require('gulp-jshint'),
55
jasmine = require('gulp-jasmine'),
6-
stylish = require('jshint-stylish');
6+
stylish = require('jshint-stylish'),
7+
jscs = require('gulp-jscs');
78

89
gulp.task('jsdoc', shell.task([
910
'./node_modules/.bin/jsdoc -c ./doc-config.json'
@@ -21,4 +22,10 @@ gulp.task('test', function () {
2122
.pipe(jasmine());
2223
});
2324

25+
26+
gulp.task('jscs', function () {
27+
return gulp.src(['src/**/*.js', 'test/**/*.js'])
28+
.pipe(jscs());
29+
});
30+
2431
gulp.task('build', ['lint', 'test']);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"devDependencies": {
1010
"gulp": "^3.8.10",
1111
"gulp-jasmine": "^1.0.1",
12+
"gulp-jscs": "^1.4.0",
1213
"gulp-jshint": "^1.9.0",
1314
"gulp-shell": "^0.2.11",
1415
"jsdoc": "3.3.0-alpha13",

src/combinatorics/cartesianproduct.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@
2424
exports.cartesianProduct = cartesianProduct;
2525

2626
}(typeof exports === 'undefined' ? window : exports));
27-

src/combinatorics/combinations.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@
2828
exports.combinations = combinations;
2929

3030
}(typeof exports === 'undefined' ? window : exports));
31-

src/compression/runlength/runlength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@
7070

7171
exports.runLength = runLengthEncoding;
7272

73-
}(typeof exports === 'undefined' ? window : exports));
73+
}(typeof exports === 'undefined' ? window : exports));

src/data-structures/binary-search-tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,4 @@
429429
this._existsInSubtree(node, root._right);
430430
};
431431

432-
})(typeof window === 'undefined' ? module.exports : window);
432+
})(typeof window === 'undefined' ? module.exports : window);

src/data-structures/heap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,4 @@
190190
return !this._heap.length;
191191
};
192192

193-
})(typeof window === 'undefined' ? module.exports : window);
193+
})(typeof window === 'undefined' ? module.exports : window);

src/data-structures/interval-tree.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param {Node} left Left child node.
3333
* @param {Node} right Right child node.
3434
*/
35-
exports.Node = function(start, end, left, right) {
35+
exports.Node = function (start, end, left, right) {
3636
/**
3737
* Node interval.
3838
* @member {Array}
@@ -46,7 +46,7 @@
4646
/**
4747
* Parent node.
4848
* @member {Node}
49-
*/
49+
*/
5050
this.parentNode = null;
5151
/**
5252
* Left child node.
@@ -66,7 +66,7 @@
6666
* @public
6767
* @constructor
6868
*/
69-
exports.IntervalTree = function() {
69+
exports.IntervalTree = function () {
7070
/**
7171
* Root node of the tree.
7272
* @member {Node}
@@ -295,7 +295,7 @@
295295

296296
/**
297297
* Remove interval from the tree.
298-
*
298+
*
299299
* @public
300300
* @method
301301
* @param {Array} intreval Array with start and end of the interval.
@@ -304,4 +304,4 @@
304304
return this._removeHelper(interval, this.root);
305305
};
306306

307-
})(typeof window === 'undefined' ? module.exports : window);
307+
})(typeof window === 'undefined' ? module.exports : window);

src/data-structures/linked-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,4 @@
262262
this.last = temp;
263263
};
264264

265-
})(typeof window === 'undefined' ? module.exports : window);
265+
})(typeof window === 'undefined' ? module.exports : window);

0 commit comments

Comments
 (0)
X Tutup