Permalink
Browse files

Replace jshint with eslint. Fix whitespace errors and bugs found by e…

…slint.
  • Loading branch information...
1 parent 5f40f5d commit 772bb2eedf8249465f47d6b5dd5ec8ad8e1ac822 @iwehrman iwehrman committed Jan 23, 2016
Showing with 637 additions and 720 deletions.
  1. +35 −0 .eslintrc.json
  2. +0 −1 .jscsrc
  3. +0 −70 .jshintrc
  4. +9 −7 Gruntfile.js
  5. +2 −2 package.json
  6. +31 −31 src/js/actions/export.js
  7. +4 −4 src/js/actions/guides.js
  8. +24 −24 src/js/actions/layers.js
  9. +40 −32 src/js/actions/libraries.js
  10. +10 −10 src/js/actions/mask.js
  11. +10 −10 src/js/actions/sampler.js
  12. +31 −32 src/js/actions/search/libraries.js
  13. +16 −16 src/js/actions/shapes.js
  14. +4 −4 src/js/actions/tool/superselect.js
  15. +27 −27 src/js/actions/tools.js
  16. +18 −18 src/js/actions/transform.js
  17. +3 −3 src/js/jsx/PanelColumn.jsx
  18. +1 −1 src/js/jsx/ToolbarIcon.jsx
  19. +1 −1 src/js/jsx/help/FirstLaunch.jsx
  20. +44 −43 src/js/jsx/search/SearchBar.jsx
  21. +16 −16 src/js/jsx/sections/layers/LayerFace.jsx
  22. +20 −20 src/js/jsx/sections/libraries/LibraryList.jsx
  23. +2 −1 src/js/jsx/sections/libraries/assets/AssetPreviewImage.jsx
  24. +11 −11 src/js/jsx/sections/nodoc/ArtboardPresets.jsx
  25. +5 −5 src/js/jsx/sections/style/Fill.jsx
  26. +0 −28 src/js/jsx/sections/style/StrokeAlignment.jsx
  27. +14 −14 src/js/jsx/sections/style/Type.jsx
  28. +12 −12 src/js/jsx/sections/style/VectorFill.jsx
  29. +8 −8 src/js/jsx/shared/Carousel.jsx
  30. +13 −13 src/js/jsx/shared/ColorInput.jsx
  31. +2 −2 src/js/jsx/shared/Datalist.jsx
  32. +5 −5 src/js/jsx/shared/SplitButton.jsx
  33. +7 −7 src/js/jsx/shared/TextInput.jsx
  34. +42 −42 src/js/jsx/tools/ArtboardAdderOverlay.jsx
  35. +4 −3 src/js/jsx/tools/GuidesOverlay.jsx
  36. +1 −29 src/js/jsx/tools/SuperselectOverlay.jsx
  37. +13 −13 src/js/models/bounds.js
  38. +1 −1 src/js/models/documentexports.js
  39. +2 −1 src/js/models/exportasset.js
  40. +9 −9 src/js/models/layer.js
  41. +35 −36 src/js/models/layerstructure.js
  42. +2 −2 src/js/stores/document.js
  43. +8 −8 src/js/util/dom.js
  44. +2 −1 src/js/util/gridsort.js
  45. +6 −6 src/js/util/layeractions.js
  46. +26 −26 src/js/util/libraries.js
  47. +2 −1 src/js/util/log.js
  48. +3 −8 src/js/util/synchronization.js
  49. +14 −14 src/js/util/system.js
  50. +22 −22 src/js/util/ui.js
  51. +2 −3 test/spec/jsx/NumberInput-test.jsx
  52. +3 −2 test/spec/jsx/SplitButton-test.jsx
  53. +14 −14 test/spec/util/spaces-logger.js
  54. +1 −1 webpack.config.js
View
@@ -0,0 +1,35 @@
+{
+ "rules": {
+ "indent": [
+ 2,
+ 4
+ ],
+ "quotes": [
+ 2,
+ "double"
+ ],
+ "linebreak-style": [
+ 2,
+ "unix"
+ ],
+ "semi": [
+ 2,
+ "always"
+ ]
+ },
+ "env": {
+ "es6": true,
+ "browser": true
+ },
+ "extends": "eslint:recommended",
+ "ecmaFeatures": {
+ "jsx": true
+ },
+ "globals": {
+ "define": false,
+ "__PG_DEBUG__": false
+ },
+ "plugins": [
+ "react"
+ ]
+}
View
@@ -50,7 +50,6 @@
"disallowTrailingComma": true,
"disallowTrailingWhitespaceInSource": true,
"esnext": true,
- "esprima": "esprima-fb",
"excludeFiles": [
".jscsrc",
".jshintrc",
View
@@ -1,70 +0,0 @@
-{
- "bitwise" : true,
- "camelcase" : true,
- "curly" : true,
- "eqeqeq" : true,
- "es3" : false,
- "forin" : true,
- "immed" : true,
- "indent" : 4,
- "latedef" : true,
- "newcap" : true,
- "noarg" : true,
- "noempty" : true,
- "nonew" : true,
- "nocomma" : true,
- "plusplus" : false,
- "quotmark" : "double",
- "undef" : true,
- "unused" : true,
- "strict" : true,
- "trailing" : true,
- "maxlen" : 120,
-
- "asi" : false,
- "boss" : false,
- "debug" : false,
- "eqnull" : false,
- "es5" : false,
- "esnext" : true,
- "evil" : false,
- "expr" : false,
- "funcscope" : false,
- "globalstrict" : false,
- "iterator" : false,
- "lastsemic" : false,
- "laxbreak" : false,
- "laxcomma" : false,
- "loopfunc" : false,
- "moz" : false,
- "multistr" : false,
- "proto" : false,
- "scripturl" : false,
- "smarttabs" : false,
- "shadow" : false,
- "sub" : false,
- "supernew" : false,
- "validthis" : false,
-
- "browser" : false,
- "couch" : false,
- "devel" : false,
- "dojo" : false,
- "jquery" : false,
- "mootools" : false,
- "node" : false,
- "nonstandard" : false,
- "prototypejs" : false,
- "rhino" : false,
- "worker" : false,
- "wsh" : false,
- "yui" : false,
-
- "nomen" : false,
- "onevar" : false,
- "passfail" : false,
- "white" : true,
-
- "predef" : ["define"],
- "globals" : { "window": true, "__PG_DEBUG__": true }
-}
View
@@ -21,7 +21,7 @@
*
*/
-/* jshint browser: false, node: true */
+/* eslint-env node */
module.exports = function (grunt) {
"use strict";
@@ -43,9 +43,9 @@ module.exports = function (grunt) {
process.env.SPACES_DEV_MODE = DEV_MODE;
grunt.initConfig({
- jshint: {
+ eslint: {
options: {
- jshintrc: true
+ configFile: ".eslintrc.json"
},
all: [
"*.js",
@@ -54,7 +54,9 @@ module.exports = function (grunt) {
"src/**/*.jsx",
"test/**/*.js",
"test/**/*.jsx",
- "!npm-shrinkwrap.json"
+ "!npm-shrinkwrap.json",
+ "!manifest.json",
+ "!package.json"
]
},
jscs: {
@@ -228,7 +230,7 @@ module.exports = function (grunt) {
}
},
concurrent: {
- test: ["jshint", "jscs", "jsdoc", "jsonlint", "lintspaces"],
+ test: ["eslint", "jscs", "jsdoc", "jsonlint", "lintspaces"],
build: {
tasks: ["watch:styles", "watch:dictionaries", "watch:sources", "webpack:watch"],
options: {
@@ -246,7 +248,7 @@ module.exports = function (grunt) {
}
});
- grunt.loadNpmTasks("grunt-jsxhint");
+ grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-jscs");
grunt.loadNpmTasks("grunt-jsdoc");
grunt.loadNpmTasks("grunt-jsonlint");
@@ -266,7 +268,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-notify");
grunt.registerTask("seqtest", "Runs the linter tests sequentially",
- ["jshint", "jscs", "jsdoc", "jsonlint", "lintspaces"]
+ ["eslint", "jscs", "jsdoc", "jsonlint", "lintspaces"]
);
grunt.registerTask("test", "Runs linter tests",
["concurrent:test"]
View
@@ -35,7 +35,7 @@
"babel-loader": "^6.2.1",
"babel-preset-react": "^6.3.13",
"es6-promise": "^3.0.2",
- "esprima-fb": "^15001.1001.0-dev-harmony-fb",
+ "eslint-plugin-react": "^3.15.0",
"expose-loader": "^0.7.1",
"file-loader": "^0.8.4",
"grunt": "^0.4.5",
@@ -46,10 +46,10 @@
"grunt-contrib-less": "^1.1.0",
"grunt-contrib-uglify": "^0.10.1",
"grunt-contrib-watch": "^0.6.1",
+ "grunt-eslint": "^17.3.1",
"grunt-jscs": "^2.3.0",
"grunt-jsdoc": "^0.6.8",
"grunt-jsonlint": "^1.0.4",
- "grunt-jsxhint": "^0.6.0",
"grunt-lintspaces": "^0.7.0",
"grunt-merge-json": "^0.9.5",
"grunt-notify": "^0.4.3",
View
@@ -114,11 +114,11 @@ define(function (require, exports) {
};
var playOptions = suppressHistory ? undefined : {
- historyStateInfo: {
- name: nls.localize("strings.ACTIONS.MODIFY_EXPORT_ASSETS"),
- target: documentLib.referenceBy.id(documentID)
- }
- };
+ historyStateInfo: {
+ name: nls.localize("strings.ACTIONS.MODIFY_EXPORT_ASSETS"),
+ target: documentLib.referenceBy.id(documentID)
+ }
+ };
// prepare play objects for document or layer level, based on existence of layerIDs
if (layerIDs) {
@@ -560,10 +560,10 @@ define(function (require, exports) {
if (layer && (!layerExports || layerExports.isEmpty())) {
var payload = {
- documentID: documentID,
- layerIDs: Immutable.List.of(layer.id),
- exportEnabled: true
- };
+ documentID: documentID,
+ layerIDs: Immutable.List.of(layer.id),
+ exportEnabled: true
+ };
return this.dispatchAsync(events.document.history.LAYER_EXPORT_ENABLED_CHANGED, payload)
.bind(this)
.then(function () {
@@ -832,31 +832,31 @@ define(function (require, exports) {
// prompt for folder and then export to the result.
// resolve immediately if no folder is returned
- return this.transfer(promptForFolder)
- .bind(this)
- .then(function (baseDir) {
- if (!baseDir) {
- return Promise.resolve();
- }
-
- _lastFolderPath = baseDir;
+ var promptPromise = this.transfer(promptForFolder);
- return _setAssetsRequested.call(this, document.id)
- .bind(this)
- .then(_setServiceBusy.bind(this, true))
- .then(function () {
- // fetch documentExports anew, in case quick-add added any assets
- var documentExports = this.flux.stores.export.getDocumentExports(document.id, true);
+ return Promise.join(promptPromise, quickAddPromise, function (baseDir) {
+ if (!baseDir) {
+ return Promise.resolve();
+ }
- // Iterate over the root document assets, and export them
- var exportList = documentExports.rootExports.map(function (asset, index) {
- return _exportAsset.call(this, document, null, index, asset, _lastFolderPath);
- }, this);
+ _lastFolderPath = baseDir;
- _batchExports.call(this, exportList);
- return Promise.resolve();
- });
- });
+ return _setAssetsRequested.call(this, document.id)
+ .bind(this)
+ .then(_setServiceBusy.bind(this, true))
+ .then(function () {
+ // fetch documentExports anew, in case quick-add added any assets
+ var documentExports = this.flux.stores.export.getDocumentExports(document.id, true);
+
+ // Iterate over the root document assets, and export them
+ var exportList = documentExports.rootExports.map(function (asset, index) {
+ return _exportAsset.call(this, document, null, index, asset, _lastFolderPath);
+ }, this);
+
+ _batchExports.call(this, exportList);
+ return Promise.resolve();
+ });
+ }.bind(this));
};
exportDocumentAssets.action = {
reads: [locks.JS_DOC, locks.JS_EXPORT],
View
@@ -72,10 +72,10 @@ define(function (require, exports) {
*/
var _getGuidesForDocumentRef = function (docRef) {
var rangeOpts = {
- range: "guide",
- index: 1,
- count: -1
- };
+ range: "guide",
+ index: 1,
+ count: -1
+ };
var requiredPromise = descriptor.getPropertiesRange(docRef, rangeOpts,
_guideProperties, { failOnMissingProperty: true }),
View
@@ -156,8 +156,8 @@ define(function (require, exports) {
extensionPromise = Promise.resolve();
} else {
var extensionPlayObjects = references.map(function (ref) {
- return layerLib.getExtensionData(ref[0], ref[1], METADATA_NAMESPACE);
- });
+ return layerLib.getExtensionData(ref[0], ref[1], METADATA_NAMESPACE);
+ });
extensionPromise = descriptor.batchPlayObjects(extensionPlayObjects)
.map(function (extensionData) {
@@ -631,9 +631,9 @@ define(function (require, exports) {
.bind(this)
.then(function (descriptors) {
var payload = {
- documentID: document.id,
- descriptors: descriptors
- };
+ documentID: document.id,
+ descriptors: descriptors
+ };
this.dispatch(events.document.history.RESET_LAYERS_BY_INDEX, payload);
});
};
@@ -660,11 +660,11 @@ define(function (require, exports) {
var docRef = documentLib.referenceBy.id(document.id),
layerRefs = layers.map(function (layer) {
- return [
- docRef,
- layerLib.referenceBy.id(layer.id)
- ];
- }).toArray();
+ return [
+ docRef,
+ layerLib.referenceBy.id(layer.id)
+ ];
+ }).toArray();
// convert to range fetch in case of all-layers?
return descriptor.batchMultiGetProperties(layerRefs, ["layerID", "visible"])
@@ -765,16 +765,16 @@ define(function (require, exports) {
}
var collapsedAncestorSet = layers.reduce(function (collapsedAncestors, layer) {
- if (document.layers.hasCollapsedAncestor(layer)) {
- document.layers.strictAncestors(layer).forEach(function (ancestor) {
- if (!ancestor.expanded) {
- collapsedAncestors.add(ancestor);
- }
- });
- }
- return collapsedAncestors;
- }, new Set(), this),
- collapsedAncestors = Immutable.Set(collapsedAncestorSet).toList();
+ if (document.layers.hasCollapsedAncestor(layer)) {
+ document.layers.strictAncestors(layer).forEach(function (ancestor) {
+ if (!ancestor.expanded) {
+ collapsedAncestors.add(ancestor);
+ }
+ });
+ }
+ return collapsedAncestors;
+ }, new Set(), this),
+ collapsedAncestors = Immutable.Set(collapsedAncestorSet).toList();
return this.transfer("groups.setGroupExpansion", document, collapsedAncestors, true);
};
@@ -1383,9 +1383,9 @@ define(function (require, exports) {
.bind(this)
.then(function (payload) {
return _getSelectedLayerIndices(document).then(function (selectedIndices) {
- payload.selectedIndices = selectedIndices;
- return payload;
- });
+ payload.selectedIndices = selectedIndices;
+ return payload;
+ });
})
.then(function (payload) {
this.dispatch(events.document.history.REORDER_LAYERS, payload);
@@ -1682,7 +1682,7 @@ define(function (require, exports) {
payload),
layerPlayObjects = layerSpec.map(function (layer) {
var layerRef = layerLib.referenceBy.id(layer.id),
- proportionalObj = layerLib.setProportionalScaling(layerRef, proportional);
+ proportionalObj = layerLib.setProportionalScaling(layerRef, proportional);
return {
layer: layer,
Oops, something went wrong.

0 comments on commit 772bb2e

Please sign in to comment.