Skip to content

Commit f01a9aa

Browse files
committed
Use ESLint and JSCS instead of JSHint. Fix tests failed on Node.js 4
1 parent 14d2b9b commit f01a9aa

File tree

276 files changed

+3623
-3563
lines changed

Some content is hidden

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

276 files changed

+3623
-3563
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
coverage/
3+
tmp/

.eslintrc

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"root": true,
4+
"rules": {
5+
"curly": [2, "multi-line"],
6+
"no-console": 0,
7+
"no-path-concat": 2,
8+
"handle-callback-err": 2,
9+
"no-use-before-define": [2, "nofunc"],
10+
"no-shadow-restricted-names": 2,
11+
"block-scoped-var": 2,
12+
"dot-notation": 2,
13+
"eqeqeq": [2, "allow-null"],
14+
"no-else-return": 1,
15+
"no-extend-native": 2,
16+
"no-extra-bind": 2,
17+
"no-implied-eval": 2,
18+
"no-lone-blocks": 2,
19+
"no-loop-func": 2,
20+
"no-multi-spaces": 2,
21+
"no-multi-str": 2,
22+
"no-native-reassign": 2,
23+
"no-new-wrappers": 2,
24+
"no-redeclare": 2,
25+
"no-return-assign": 2,
26+
"no-throw-literal": 2,
27+
"no-unused-expressions": [2, {
28+
"allowShortCircuit": true,
29+
"allowTernary": true
30+
}],
31+
"no-useless-call": 2,
32+
"no-useless-concat": 2,
33+
"no-with": 2,
34+
"radix": 2,
35+
"no-self-compare": 2,
36+
"no-unused-vars": [2, {
37+
"vars": "all",
38+
"args": "none"
39+
}],
40+
"strict": [2, "global"]
41+
},
42+
"env": {
43+
"node": true
44+
}
45+
}

.jscsrc

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"excludeFiles": ["node_modules/**", "coverage/**", "tmp/**"],
3+
"validateIndentation": 2,
4+
"validateLineBreaks": "LF",
5+
"validateQuoteMarks": "'",
6+
"requireSemicolons": true,
7+
"disallowEmptyBlocks": true,
8+
"disallowKeywordsOnNewLine": ["else"],
9+
"disallowKeywords": ["with"],
10+
"disallowMixedSpacesAndTabs": true,
11+
"disallowMultipleLineBreaks": true,
12+
"disallowMultipleLineStrings": true,
13+
"disallowMultipleVarDecl": "exceptUndefined",
14+
"disallowNewlineBeforeBlockStatements": true,
15+
"disallowOperatorBeforeLineBreak": ["."],
16+
"disallowSpaceBeforeBinaryOperators": [","],
17+
"disallowSpaceAfterObjectKeys": true,
18+
"disallowSpaceAfterPrefixUnaryOperators": true,
19+
"disallowSpaceBeforeComma": true,
20+
"disallowSpaceBeforePostfixUnaryOperators": true,
21+
"disallowSpaceBeforeSemicolon": true,
22+
"disallowSpacesInCallExpression": true,
23+
"disallowSpacesInFunctionDeclaration": {
24+
"beforeOpeningRoundBrace": true
25+
},
26+
"disallowSpacesInFunctionExpression": {
27+
"beforeOpeningRoundBrace": true
28+
},
29+
"disallowSpacesInsideParentheses": true,
30+
"disallowSpacesInsideParenthesizedExpression": {
31+
"allExcept": [ "{", "}" ]
32+
},
33+
"disallowTrailingComma": true,
34+
"disallowTrailingWhitespace": true,
35+
"disallowYodaConditions": true,
36+
"requireBlocksOnNewline": true,
37+
"requireCapitalizedConstructors": true,
38+
"requireCommaBeforeLineBreak": true,
39+
"requireCurlyBraces": [
40+
"for",
41+
"while",
42+
"do",
43+
"try",
44+
"catch"
45+
],
46+
"requireDotNotation": true,
47+
"requireLineBreakAfterVariableAssignment": true,
48+
"requireLineFeedAtFileEnd": true,
49+
"requirePaddingNewLinesAfterBlocks": true,
50+
"requirePaddingNewLinesAfterUseStrict": true,
51+
"requireParenthesesAroundIIFE": true,
52+
"requireSpaceAfterBinaryOperators": true,
53+
"requireSpaceAfterKeywords": [
54+
"do",
55+
"for",
56+
"if",
57+
"else",
58+
"switch",
59+
"case",
60+
"try",
61+
"catch",
62+
"void",
63+
"while",
64+
"with",
65+
"return",
66+
"typeof"
67+
],
68+
"requireSpaceBeforeBinaryOperators": true,
69+
"requireSpaceBeforeBlockStatements": true,
70+
"requireSpaceBetweenArguments": true,
71+
"requireSpacesInFunction": {
72+
"beforeOpeningCurlyBrace": true
73+
},
74+
"requireSpacesInConditionalExpression": true,
75+
"requireSpacesInForStatement": true,
76+
"requireSpacesInFunctionDeclaration": {
77+
"beforeOpeningCurlyBrace": true
78+
},
79+
"requireSpacesInFunctionExpression": {
80+
"beforeOpeningCurlyBrace": true
81+
},
82+
"validateNewlineAfterArrayElements": true,
83+
"validateParameterSeparator": ", ",
84+
"disallowMultipleSpaces": true
85+
}

.jshintrc

-14
This file was deleted.

.npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ test/
22
tmp/
33
coverage/
44
*.log
5-
.jshintrc
65
.travis.yml
76
gulpfile.js
87
.idea/

.travis.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
language: node_js
22

3+
sudo: false
4+
5+
cache:
6+
apt: true
7+
directories:
8+
- node_modules
9+
310
node_js:
411
- "0.10"
512
- "0.12"
6-
- iojs
13+
- "4"
714

815
script:
9-
- npm test
16+
- npm run eslint
17+
- npm run jscs
18+
- npm run test-cov
1019

1120
after_script:
1221
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

appveyor.yml

+5-12
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,13 @@ init:
55
# Test against these versions of Node.js.
66
environment:
77
matrix:
8-
# node.js
98
- nodejs_version: "0.10"
109
- nodejs_version: "0.12"
11-
# io.js
12-
- nodejs_version: "1"
13-
14-
# Allow failing jobs for bleeding-edge Node.js versions.
15-
matrix:
16-
allow_failures:
17-
- nodejs_version: "1"
10+
- nodejs_version: "4"
1811

1912
# Install scripts. (runs after repo cloning)
2013
install:
21-
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
22-
- cmd: npm install -g npm@2
23-
- set PATH=%APPDATA%\npm;%PATH%
14+
- ps: Install-Product node $env:nodejs_version
2415
- npm install
2516

2617
# Post-install test scripts.
@@ -29,7 +20,9 @@ test_script:
2920
- node --version
3021
- npm --version
3122
# Run tests
32-
- npm test
23+
- npm run eslint
24+
- npm run jscs
25+
- npm run test-cov
3326

3427
# Don't actually build.
3528
build: off

gulpfile.js

-48
This file was deleted.

lib/box/file.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Promise = require('bluebird');
66
var escapeBOM = fs.escapeBOM;
77
var escapeEOL = fs.escapeEOL;
88

9-
function File(data){
9+
function File(data) {
1010
this.source = data.source;
1111
this.path = data.path;
1212
this.type = data.type;
@@ -15,7 +15,7 @@ function File(data){
1515
this.stats = data.stats;
1616
}
1717

18-
function wrapReadOptions(options){
18+
function wrapReadOptions(options) {
1919
options = options || {};
2020
if (typeof options === 'string') options = {encoding: options};
2121
if (!options.hasOwnProperty('encoding')) options.encoding = 'utf8';
@@ -25,12 +25,12 @@ function wrapReadOptions(options){
2525
return options;
2626
}
2727

28-
function escapeContent(str){
28+
function escapeContent(str) {
2929
return escapeBOM(escapeEOL(str));
3030
}
3131

32-
File.prototype.read = function(options, callback){
33-
if (!callback && typeof options === 'function'){
32+
File.prototype.read = function(options, callback) {
33+
if (!callback && typeof options === 'function') {
3434
callback = options;
3535
options = {};
3636
}
@@ -40,8 +40,8 @@ File.prototype.read = function(options, callback){
4040

4141
options = wrapReadOptions(options);
4242

43-
return new Promise(function(resolve, reject){
44-
if (!options.cache || !content){
43+
return new Promise(function(resolve, reject) {
44+
if (!options.cache || !content) {
4545
return fs.readFile(self.source, options).then(resolve, reject);
4646
}
4747

@@ -55,12 +55,12 @@ File.prototype.read = function(options, callback){
5555
}).nodeify(callback);
5656
};
5757

58-
File.prototype.readSync = function(options){
58+
File.prototype.readSync = function(options) {
5959
var content = this.content;
6060

6161
options = wrapReadOptions(options);
6262

63-
if (!options.cache || !content){
63+
if (!options.cache || !content) {
6464
return fs.readFileSync(this.source, options);
6565
}
6666

@@ -73,8 +73,8 @@ File.prototype.readSync = function(options){
7373
return result;
7474
};
7575

76-
File.prototype.stat = function(options, callback){
77-
if (!callback && typeof options === 'function'){
76+
File.prototype.stat = function(options, callback) {
77+
if (!callback && typeof options === 'function') {
7878
callback = options;
7979
options = {};
8080
}
@@ -85,14 +85,14 @@ File.prototype.stat = function(options, callback){
8585
var cache = options.hasOwnProperty('cache') ? options.cache : true;
8686
var self = this;
8787

88-
return new Promise(function(resolve, reject){
88+
return new Promise(function(resolve, reject) {
8989
if (stats && cache) return resolve(stats);
9090

9191
fs.stat(self.source).then(resolve, reject);
9292
}).nodeify(callback);
9393
};
9494

95-
File.prototype.statSync = function(options){
95+
File.prototype.statSync = function(options) {
9696
options = options || {};
9797

9898
var cache = options.hasOwnProperty('cache') ? options.cache : true;
@@ -103,4 +103,4 @@ File.prototype.statSync = function(options){
103103
return fs.statSync(this.source);
104104
};
105105

106-
module.exports = File;
106+
module.exports = File;

0 commit comments

Comments
 (0)