Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.

Commit 1e4c9bf

Browse files
committed
Use "idiomatic" preset instead of "jquery"
Fixes #76
1 parent 0c86a48 commit 1e4c9bf

File tree

7 files changed

+95
-95
lines changed

7 files changed

+95
-95
lines changed

.jscsrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"preset": "jquery"
2+
"preset": "idiomatic"
33
}

Gruntfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = function( grunt ) {
22
"use strict";
33

4-
grunt.initConfig( {
4+
grunt.initConfig({
55
jshint: {
66
options: {
77
jshintrc: ".jshintrc"
@@ -15,15 +15,15 @@ module.exports = function( grunt ) {
1515
methods: "test/methods.js",
1616
enmasse: "test/enmasse.js"
1717
}
18-
} );
18+
});
1919

2020
// Load grunt tasks from NPM packages
2121
require( "load-grunt-tasks" )( grunt );
2222
require( "time-grunt" )( grunt );
2323

2424
grunt.loadTasks( "tasks" );
2525

26-
grunt.registerTask( "lint", [ "jshint", "jscs" ] );
27-
grunt.registerTask( "test", [ "lint", "nodeunit" ] );
26+
grunt.registerTask( "lint", [ "jshint", "jscs" ]);
27+
grunt.registerTask( "test", [ "lint", "nodeunit" ]);
2828
grunt.registerTask( "default", "test" );
2929
};

tasks/jscs.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ module.exports = function( grunt ) {
99

1010
grunt.registerMultiTask( "jscs", "JavaScript Code Style checker", function() {
1111
var done = this.async(),
12-
options = this.options( {
12+
options = this.options({
1313

1414
// `null` is a default value, but its equivalent to `true`,
1515
// With this way it's easy to distinguish specified value
1616
config: null
17-
} ),
17+
}),
1818

1919
jscs = new JSCS( options ),
2020
runs = this.filesSrc.map( jscs.checker.execute, jscs.checker );
2121

22-
Vow.allResolved( runs ).spread( function() {
22+
Vow.allResolved( runs ).spread(function() {
2323
var results = [];
2424

2525
// Filter unsuccessful promises
2626
filter.call( arguments, function( promise ) {
2727
return promise.isFulfilled();
2828

2929
// Make array of errors
30-
} ).forEach( function( promise ) {
30+
}).forEach(function( promise ) {
3131
results.push.apply( results, promise.valueOf() );
32-
} );
32+
});
3333

3434
jscs.setErrors( results ).report().notify();
3535

3636
done( options.force || !jscs.count() );
37-
} );
38-
} );
37+
});
38+
});
3939
};

tasks/lib/jscs.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ exports.init = function( grunt ) {
3131
* @param {errorsCollection} errorsCollection
3232
*/
3333
function defaultReporter( errorsCollection ) {
34-
errorsCollection.forEach( function( errors ) {
34+
errorsCollection.forEach(function( errors ) {
3535
if ( !errors.isEmpty() ) {
36-
errors.getErrorList().forEach( function( error ) {
36+
errors.getErrorList().forEach(function( error ) {
3737
grunt.log.writeln( errors.explainError( error, true ) );
38-
} );
38+
});
3939
}
40-
} );
40+
});
4141
}
4242

4343
/**
@@ -63,9 +63,9 @@ exports.init = function( grunt ) {
6363
JSCS.prototype.execute = function( path ) {
6464
var run = this.checker.execute( path );
6565

66-
run.fail( function( error ) {
66+
run.fail(function( error ) {
6767
grunt.warn( error );
68-
} );
68+
});
6969

7070
return run;
7171
};
@@ -193,9 +193,9 @@ exports.init = function( grunt ) {
193193
JSCS.prototype.setErrors = function( errorsCollection ) {
194194

195195
// Filter excluded files ("excludeFiles" option)
196-
this._errors = errorsCollection.filter( function( errors ) {
196+
this._errors = errorsCollection.filter(function( errors ) {
197197
return errors;
198-
} );
198+
});
199199

200200
return this;
201201
};
@@ -216,9 +216,9 @@ exports.init = function( grunt ) {
216216
JSCS.prototype.count = function() {
217217
var result = 0;
218218

219-
this._errors.forEach( function( errors ) {
219+
this._errors.forEach(function( errors ) {
220220
result += errors.getErrorCount();
221-
} );
221+
});
222222

223223
return result;
224224
};
@@ -239,7 +239,7 @@ exports.init = function( grunt ) {
239239

240240
return hooker.preempt();
241241
}
242-
} );
242+
});
243243
}
244244

245245
this._result = this._reporter( this._errors );

test/enmasse.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,73 +5,73 @@ var grunt = require( "grunt" );
55
grunt.file.setBase( "test/enmasse" );
66

77
exports.fail = function( test ) {
8-
grunt.util.spawn( {
8+
grunt.util.spawn({
99
cmd: "grunt",
1010
args: [ "jscs:fail" ]
1111
}, function( error, result ) {
1212
test.equal( result.code, 3 );
1313

1414
test.done();
15-
} );
15+
});
1616
};
1717

1818
exports.broken = function( test ) {
19-
grunt.util.spawn( {
19+
grunt.util.spawn({
2020
cmd: "grunt",
2121
args: [ "jscs:broken" ]
2222
}, function( error, result ) {
2323
test.equal( result.code, 3 );
2424

2525
test.done();
26-
} );
26+
});
2727
};
2828

2929
exports.force = function( test ) {
30-
grunt.util.spawn( {
30+
grunt.util.spawn({
3131
cmd: "grunt",
3232
args: [ "jscs:force" ]
3333
}, function( error, result ) {
3434
test.equal( result.code, 0 );
3535

3636
test.done();
37-
} );
37+
});
3838
};
3939

4040
exports.forceAndFatal = function( test ) {
41-
grunt.util.spawn( {
41+
grunt.util.spawn({
4242
cmd: "grunt",
4343
args: [ "jscs:force", "fatal" ]
4444
}, function( error, result ) {
4545
test.equal( result.code, 1 );
4646

4747
test.done();
48-
} );
48+
});
4949
};
5050

5151
exports.success = function( test ) {
52-
grunt.util.spawn( {
52+
grunt.util.spawn({
5353
cmd: "grunt",
5454
args: [ "jscs:success" ]
5555
}, function( error, result ) {
5656
test.equal( result.code, 0 );
5757

5858
test.done();
59-
} );
59+
});
6060
};
6161

6262
exports.onlyInline = function( test ) {
63-
grunt.util.spawn( {
63+
grunt.util.spawn({
6464
cmd: "grunt",
6565
args: [ "jscs:only-inline" ]
6666
}, function( error, result ) {
6767
test.equal( result.code, 0 );
6868

6969
test.done();
70-
} );
70+
});
7171
};
7272

7373
exports.merge = function( test ) {
74-
grunt.util.spawn( {
74+
grunt.util.spawn({
7575
cmd: "grunt",
7676
args: [ "jscs:merge" ]
7777
}, function( error, result ) {
@@ -80,11 +80,11 @@ exports.merge = function( test ) {
8080
test.equal( result.code, 3 );
8181

8282
test.done();
83-
} );
83+
});
8484
};
8585

8686
exports.mergeWithPath = function( test ) {
87-
grunt.util.spawn( {
87+
grunt.util.spawn({
8888
cmd: "grunt",
8989
args: [ "jscs:merge-with-path" ]
9090
}, function( error, result ) {
@@ -93,11 +93,11 @@ exports.mergeWithPath = function( test ) {
9393
test.equal( result.code, 3 );
9494

9595
test.done();
96-
} );
96+
});
9797
};
9898

9999
exports.dot = function( test ) {
100-
grunt.util.spawn( {
100+
grunt.util.spawn({
101101
cmd: "grunt",
102102
args: [ "jscs:dot" ]
103103
}, function( error, result ) {
@@ -107,7 +107,7 @@ exports.dot = function( test ) {
107107
test.equal( result.stdout.split( "Illegal keyword: with" ).length, 3 );
108108

109109
test.done();
110-
} );
110+
});
111111
};
112112

113113
exports.fix = fixable( true );
@@ -116,7 +116,7 @@ exports.fixFail = fixable( false );
116116
function fixable( expectFailure ) {
117117
return function( test ) {
118118
grunt.file.copy( "../fixtures/fixable.source.js", "../fixtures/fixable.js" );
119-
grunt.util.spawn( {
119+
grunt.util.spawn({
120120
cmd: "grunt",
121121
args: [ expectFailure ? "jscs:fix-fail" : "jscs:fix" ]
122122
}, function( error, result ) {
@@ -130,6 +130,6 @@ function fixable( expectFailure ) {
130130
}
131131

132132
test.done();
133-
} );
133+
});
134134
};
135135
}

test/enmasse/Gruntfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

33
module.exports = function( grunt ) {
4-
grunt.initConfig( {
4+
grunt.initConfig({
55
jscs: {
66
fail: {
77
files: {
@@ -102,11 +102,11 @@ module.exports = function( grunt ) {
102102
}
103103
}
104104
}
105-
} );
105+
});
106106

107107
grunt.loadTasks( "../../tasks" );
108108
grunt.registerTask( "default", "jscs" );
109109
grunt.registerTask( "fatal", function() {
110110
grunt.fatal( "test" );
111-
} );
111+
});
112112
};

0 commit comments

Comments
 (0)