Skip to content

Commit

Permalink
Add JSCS
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 5, 2015
1 parent 64892c4 commit e7ce136
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
15 changes: 15 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
//"validateIndentation": 2, index.js uses 2, and tests.js uses 4. https://github.com/jscs-dev/node-jscs/issues/1106
"validateQuoteMarks": "'",
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowQuotedKeysInObjects": true,
"disallowMultipleLineStrings": true,
"disallowMultipleSpaces": true,
"requireLineFeedAtFileEnd": true,
"requireSemicolons": true
}
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
;(function(root, factory) {
"use strict";
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
Expand All @@ -17,7 +17,7 @@
root.DeepDiff = factory();
}
}(this, function(undefined) {
"use strict";
'use strict';

var $scope, conflict, conflictResolution = [];
if (typeof global === 'object' && global) {
Expand Down Expand Up @@ -191,7 +191,7 @@
stack.length = stack.length - 1;
}
} else if (lhs !== rhs) {
if (!(ltype === "number" && isNaN(lhs) && isNaN(rhs))) {
if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
changes(new DiffEdit(currentPath, lhs, rhs));
}
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
"devDependencies": {
"deep-equal": "~1.0.0",
"expect.js": "^0.3.1",
"jscs": "^1.12.0",
"jshint": "^2.6.3",
"mocha": "^2.2.1",
"uglifyjs": "^2.4.10"
},
"scripts": {
"uglify": "uglifyjs index.js -o releases/deep-diff-$npm_package_version.min.js -r '$,require,exports,module,window,global' -m --comments '/^!/'",
"pretest": "jshint index.js test/",
"pretest": "jscs index.js test/ && jshint index.js test/",
"test": "mocha"
}
}
36 changes: 18 additions & 18 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,35 +360,35 @@ describe('deep-diff', function() {

describe('regression test for bug #10, ', function() {
var lhs = {
"id": "Release",
"phases": [{
"id": "Phase1",
"tasks": [{
"id": "Task1"
id: 'Release',
phases: [{
id: 'Phase1',
tasks: [{
id: 'Task1'
}, {
"id": "Task2"
id: 'Task2'
}]
}, {
"id": "Phase2",
"tasks": [{
"id": "Task3"
id: 'Phase2',
tasks: [{
id: 'Task3'
}]
}]
};
var rhs = {
"id": "Release",
"phases": [{
id: 'Release',
phases: [{
// E: Phase1 -> Phase2
"id": "Phase2",
"tasks": [{
"id": "Task3"
id: 'Phase2',
tasks: [{
id: 'Task3'
}]
}, {
"id": "Phase1",
"tasks": [{
"id": "Task1"
id: 'Phase1',
tasks: [{
id: 'Task1'
}, {
"id": "Task2"
id: 'Task2'
}]
}]
};
Expand Down

0 comments on commit e7ce136

Please sign in to comment.