Skip to content
This repository was archived by the owner on Mar 26, 2018. It is now read-only.

Commit 196873a

Browse files
committed
Merge pull request #63 from stephanebachelier/jscs
WIP Adding JSCS to the repo
2 parents d2c2613 + 86af73b commit 196873a

File tree

7 files changed

+42
-17
lines changed

7 files changed

+42
-17
lines changed

.jscsrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"preset": "google",
3+
"maximumLineLength": null,
4+
"disallowMultipleLineBreaks": null,
5+
"disallowSpacesInAnonymousFunctionExpression": null,
6+
"requireSpacesInFunction": {
7+
"beforeOpeningCurlyBrace": true
8+
},
9+
"requireSpacesInAnonymousFunctionExpression": {
10+
"beforeOpeningRoundBrace": true
11+
}
12+
}

Gruntfile.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ module.exports = function (grunt) {
1616
'!test/tmp/*'
1717
]
1818
},
19+
20+
jscs: {
21+
options: {
22+
config: '.jscsrc'
23+
},
24+
all: {
25+
src: ['<%= jshint.all %>']
26+
}
27+
},
28+
1929
copy: {
2030
test: {
2131
flatten: true,
@@ -83,9 +93,11 @@ module.exports = function (grunt) {
8393
grunt.loadNpmTasks('grunt-contrib-copy');
8494
grunt.loadNpmTasks('grunt-simple-mocha');
8595
grunt.loadNpmTasks('grunt-contrib-jshint');
96+
grunt.loadNpmTasks('grunt-jscs');
8697

8798
grunt.registerTask('default', [
8899
'jshint',
100+
'jscs',
89101
'clean',
90102
'copy',
91103
'filerev',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"grunt-contrib-clean": "^0.6.0",
3333
"grunt-contrib-copy": "^0.5.0",
3434
"grunt-contrib-jshint": "^0.10.0",
35+
"grunt-jscs": "^1.5.0",
3536
"grunt-simple-mocha": "^0.4.0"
3637
},
3738
"peerDependencies": {

tasks/filerev.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,23 @@ module.exports = function (grunt) {
7373
// Source maps
7474
var sourceMap = false;
7575
if (ext === '.js' || ext === '.css') {
76-
var map = file + '.map';
77-
resultPath += '.map';
78-
if (grunt.file.exists(map)) {
79-
if (move) {
80-
fs.renameSync(map, resultPath);
81-
} else {
82-
grunt.file.copy(map, resultPath);
83-
}
84-
sourceMap = true;
85-
}
76+
var map = file + '.map';
77+
resultPath += '.map';
78+
if (grunt.file.exists(map)) {
79+
if (move) {
80+
fs.renameSync(map, resultPath);
81+
} else {
82+
grunt.file.copy(map, resultPath);
83+
}
84+
sourceMap = true;
85+
}
8686
}
8787

8888
filerev.summary[path.normalize(file)] = path.join(dirname, newName);
8989
grunt.verbose.writeln(chalk.green('✔ ') + file + chalk.gray(' changed to ') + newName);
9090
if (sourceMap) {
91-
filerev.summary[path.normalize(file + '.map')] = path.join(dirname, newName + '.map');
92-
grunt.verbose.writeln(chalk.green('✔ ') + file + '.map' + chalk.gray(' changed to ') + newName + '.map');
91+
filerev.summary[path.normalize(file + '.map')] = path.join(dirname, newName + '.map');
92+
grunt.verbose.writeln(chalk.green('✔ ') + file + '.map' + chalk.gray(' changed to ') + newName + '.map');
9393
}
9494

9595
});

test/fixtures/math.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/physics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
'use strict';
2-
window.f = function(m, a) { return m*a; };
2+
window.f = function (m, a) { return m * a; };

test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var assert = require('assert');
55
var hashes = {
66
'test/fixtures/file.png' : 'test/tmp/file.26365248.png',
77
'test/fixtures/cfgfile.png' : 'test/tmp/cfgfile.da63.png',
8-
'test/fixtures/math.js' : 'test/tmp/withSourceMaps/math.2f56179e.js',
9-
'test/fixtures/math.js.map' : 'test/tmp/withSourceMaps/math.2f56179e.js.map',
10-
'test/fixtures/physics.js' : 'test/tmp/withSourceMaps/physics.14a0a482.js',
8+
'test/fixtures/math.js' : 'test/tmp/withSourceMaps/math.6272e937.js',
9+
'test/fixtures/math.js.map' : 'test/tmp/withSourceMaps/math.6272e937.js.map',
10+
'test/fixtures/physics.js' : 'test/tmp/withSourceMaps/physics.28cb15fd.js',
1111
'test/fixtures/another.png' : 'test/tmp/another-processed-92279d3f.png'
1212
};
1313

0 commit comments

Comments
 (0)