styleguide: requireSpaceAfterBinaryOperators PR: #326 PR-URL: https://github.com/apache/couchdb-fauxton/pull/326 Reviewed-By: garren smith <garren.sm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/3d108d27 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/3d108d27 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/3d108d27 Branch: refs/heads/master Commit: 3d108d27308dbab6d3c72e818f8f53c830faab81 Parents: 55c8b18 Author: Robert Kowalski <r...@kowalski.gd> Authored: Sun Mar 22 21:50:44 2015 +0100 Committer: Robert Kowalski <robertkowal...@apache.org> Committed: Wed Mar 25 11:11:49 2015 +0100 ---------------------------------------------------------------------- Gruntfile.js | 18 ++++----- app/addons/activetasks/tests/viewsSpec.js | 2 +- app/addons/auth/base.js | 2 +- app/addons/auth/resources.js | 2 +- app/addons/compaction/resources.js | 2 +- app/addons/cors/tests/componentsSpec.react.jsx | 6 +-- app/addons/documents/base.js | 2 +- app/addons/documents/pagination/stores.js | 2 +- app/addons/documents/resources.js | 10 ++--- app/addons/documents/routes-doc-editor.js | 2 +- app/addons/documents/routes-index-editor.js | 2 +- app/addons/documents/shared-resources.js | 6 +-- app/addons/documents/shared-views.js | 16 ++++---- .../tests/nightwatch/deletesDocument.js | 2 +- .../tests/nightwatch/editDocumentsFromView.js | 2 +- app/addons/documents/tests/resourcesSpec.js | 42 ++++++++++---------- app/addons/documents/views-doceditor.js | 8 ++-- app/addons/documents/views.js | 4 +- app/addons/fauxton/components.js | 6 +-- app/addons/permissions/tests/viewsSpec.js | 3 +- app/addons/plugins/routes.js | 2 +- app/addons/replication/views.js | 4 +- app/addons/verifyinstall/resources.js | 2 +- app/addons/verifyinstall/views.js | 2 +- app/core/base.js | 2 +- app/core/routeObject.js | 2 +- app/core/tests/routeObjectSpec.js | 6 +-- app/core/utils.js | 4 +- tasks/couchserver.js | 14 +++---- tasks/fauxton.js | 4 +- 30 files changed, 91 insertions(+), 90 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/Gruntfile.js ---------------------------------------------------------------------- diff --git a/Gruntfile.js b/Gruntfile.js index 97228ea..98a46a6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -67,7 +67,7 @@ module.exports = function(grunt) { "dist/debug/css/fauxton.css": "assets/less/fauxton.less" } }, - fonts: ["assets/fonts/*.eot", "assets/fonts/*.svg", "assets/fonts/*.ttf", "assets/fonts/*.woff",], + fonts: ["assets/fonts/*.eot", "assets/fonts/*.svg", "assets/fonts/*.ttf", "assets/fonts/*.woff"], img: ["assets/img/**"], // used in concat:index_css to keep file ordering intact // fauxton.css should load first @@ -277,16 +277,16 @@ module.exports = function(grunt) { watch: { js: { - files: helper.watchFiles(['.js'], ["./app/**/*.js", '!./app/load_addons.js',"./assets/**/*.js", "./test/**/*.js"]), + files: helper.watchFiles(['.js'], ["./app/**/*.js", '!./app/load_addons.js', "./assets/**/*.js", "./test/**/*.js"]), tasks: ['watchRun'], }, jsx: { - files: helper.watchFiles(['.jsx'], ["./app/**/*.jsx", '!./app/load_addons.jsx',"./assets/**/*.jsx", "./test/**/*.jsx"]), + files: helper.watchFiles(['.jsx'], ["./app/**/*.jsx", '!./app/load_addons.jsx', "./assets/**/*.jsx", "./test/**/*.jsx"]), tasks: ['watchRun'], }, style: { - files: helper.watchFiles(['.less','.css'],["./app/**/*.css","./app/**/*.less","./assets/**/*.css", "./assets/**/*.less"]), - tasks: ['clean:watch', 'dependencies','less', 'concat:index_css'], + files: helper.watchFiles(['.less', '.css'], ["./app/**/*.css", "./app/**/*.less", "./assets/**/*.css", "./assets/**/*.less"]), + tasks: ['clean:watch', 'dependencies', 'less', 'concat:index_css'], }, html: { // the index.html is added in as a dummy file incase there is no @@ -510,7 +510,7 @@ module.exports = function(grunt) { grunt.registerTask('lint', ['clean', 'jshint']); grunt.registerTask('test', ['jsx', 'lint', 'dependencies', 'gen_initialize:development', 'test_inline']); // lighter weight test task for use inside dev/watch - grunt.registerTask('test_inline', ['mochaSetup','jst', 'concat:test_config_js','mocha_phantomjs']); + grunt.registerTask('test_inline', ['mochaSetup', 'jst', 'concat:test_config_js', 'mocha_phantomjs']); // Fetch dependencies (from git or local dir), lint them and make load_addons grunt.registerTask('dependencies', ['get_deps', 'gen_load_addons:default']); @@ -527,13 +527,13 @@ module.exports = function(grunt) { grunt.registerTask('dev', ['debugDev', 'couchserver']); // build a debug release - grunt.registerTask('debug', ['lint', 'dependencies', "gen_initialize:development", 'jsx', 'concat:requirejs','less', 'concat:index_css', 'template:development', 'copy:debug']); - grunt.registerTask('debugDev', ['clean', 'dependencies', "gen_initialize:development",'jsx', 'jshint','less', 'concat:index_css', 'template:development', 'copy:debug']); + grunt.registerTask('debug', ['lint', 'dependencies', "gen_initialize:development", 'jsx', 'concat:requirejs', 'less', 'concat:index_css', 'template:development', 'copy:debug']); + grunt.registerTask('debugDev', ['clean', 'dependencies', "gen_initialize:development", 'jsx', 'jshint', 'less', 'concat:index_css', 'template:development', 'copy:debug']); grunt.registerTask('watchRun', ['clean:watch', 'dependencies', 'jshint']); // build a release - grunt.registerTask('release_commons_prefix', ['clean' ,'dependencies']); + grunt.registerTask('release_commons_prefix', ['clean', 'dependencies']); grunt.registerTask('release_commons_suffix', ['jshint', 'shell:build-jsx', 'build', 'copy:dist', 'copy:ace', 'copy:zeroclip']); grunt.registerTask('release', ['release_commons_prefix', 'gen_initialize:release', 'release_commons_suffix']); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/activetasks/tests/viewsSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/activetasks/tests/viewsSpec.js b/app/addons/activetasks/tests/viewsSpec.js index 1048095..6f28f5b 100644 --- a/app/addons/activetasks/tests/viewsSpec.js +++ b/app/addons/activetasks/tests/viewsSpec.js @@ -47,7 +47,7 @@ define([ it("Should clearInterval", function () { var $range = tabMenu.$('#pollingRange'); - var clearIntervalMock = sinon.spy(window,'clearInterval'); + var clearIntervalMock = sinon.spy(window, 'clearInterval'); $range.trigger('input'); assert.ok(clearIntervalMock.calledOnce); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/auth/base.js ---------------------------------------------------------------------- diff --git a/app/addons/auth/base.js b/app/addons/auth/base.js index 5aacdd3..d1f6d65 100644 --- a/app/addons/auth/base.js +++ b/app/addons/auth/base.js @@ -96,7 +96,7 @@ function(app, FauxtonAPI, Auth) { }; var authDenied = function () { - var url = window.location.hash.replace('#',''); + var url = window.location.hash.replace('#', ''); FauxtonAPI.navigate('/login?urlback=' + url, {replace: true}); }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/auth/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/auth/resources.js b/app/addons/auth/resources.js index b879d31..b8fc9b0 100644 --- a/app/addons/auth/resources.js +++ b/app/addons/auth/resources.js @@ -342,7 +342,7 @@ function (app, FauxtonAPI, CouchdbSession) { setTab: function (selectedTab) { this.selectedTab = selectedTab; this.$('.active').removeClass('active'); - var $tab = this.$('a[data-select="' + selectedTab +'"]'); + var $tab = this.$('a[data-select="' + selectedTab + '"]'); $tab.parent().addClass('active'); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/compaction/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/resources.js b/app/addons/compaction/resources.js index 6633677..a982a17 100644 --- a/app/addons/compaction/resources.js +++ b/app/addons/compaction/resources.js @@ -38,7 +38,7 @@ function (app, FauxtonAPI) { Compaction.compactView = function (db, designDoc) { // /some_database/_compact/designname return $.ajax({ - url: db.url() + '/_compact/' + designDoc.replace('_design/','') , + url: db.url() + '/_compact/' + designDoc.replace('_design/', '') , contentType: 'application/json', type: 'POST' }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/cors/tests/componentsSpec.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/cors/tests/componentsSpec.react.jsx b/app/addons/cors/tests/componentsSpec.react.jsx index 20d84c3..d71f355 100644 --- a/app/addons/cors/tests/componentsSpec.react.jsx +++ b/app/addons/cors/tests/componentsSpec.react.jsx @@ -103,20 +103,20 @@ define([ it('calls validates each domain', function () { var spy = sinon.spy(Resources, 'validateCORSDomain'); - TestUtils.Simulate.change($(inputEl.getDOMNode()).find('input')[0],{target: {value: newOrigin}}); + TestUtils.Simulate.change($(inputEl.getDOMNode()).find('input')[0], {target: {value: newOrigin}}); TestUtils.Simulate.click($(inputEl.getDOMNode()).find('.btn')[0]); assert.ok(spy.calledWith(newOrigin)); }); it('calls addOrigin on add click with valid domain', function () { - TestUtils.Simulate.change($(inputEl.getDOMNode()).find('input')[0],{target: {value: newOrigin}}); + TestUtils.Simulate.change($(inputEl.getDOMNode()).find('input')[0], {target: {value: newOrigin}}); TestUtils.Simulate.click($(inputEl.getDOMNode()).find('.btn')[0]); assert.ok(addOrigin.calledWith(newOrigin)); }); it('shows notification if origin is not valid', function () { var spy = sinon.spy(FauxtonAPI, 'addNotification'); - TestUtils.Simulate.change($(inputEl.getDOMNode()).find('input')[0],{target: {value: 'badOrigin'}}); + TestUtils.Simulate.change($(inputEl.getDOMNode()).find('input')[0], {target: {value: 'badOrigin'}}); TestUtils.Simulate.click($(inputEl.getDOMNode()).find('.btn')[0]); assert.ok(spy.calledOnce); }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/base.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/base.js b/app/addons/documents/base.js index 5c74fa2..bbdd90f 100644 --- a/app/addons/documents/base.js +++ b/app/addons/documents/base.js @@ -61,7 +61,7 @@ function(app, FauxtonAPI, Documents) { }, showNewlySavedView: function (database, designDocs, viewName) { - return '/database/' + database +'/' + designDocs + '/_view/' + viewName; + return '/database/' + database + '/' + designDocs + '/_view/' + viewName; }, fragment: function (database, designDocs, viewName) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/pagination/stores.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/pagination/stores.js b/app/addons/documents/pagination/stores.js index 3802d7c..f63f766 100644 --- a/app/addons/documents/pagination/stores.js +++ b/app/addons/documents/pagination/stores.js @@ -14,7 +14,7 @@ define([ 'app', 'api', 'addons/documents/pagination/actiontypes' -],function (app, FauxtonAPI, ActionTypes) { +], function (app, FauxtonAPI, ActionTypes) { var Stores = {}; var maxDocLimit = 10000; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js index cc44fc4..025c4ea 100644 --- a/app/addons/documents/resources.js +++ b/app/addons/documents/resources.js @@ -67,7 +67,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { // treated separately. For instance, we could default into the // json editor for docs, or into a ddoc specific page. safeID: function() { - var ddoc = this.id.replace(/^_design\//,""); + var ddoc = this.id.replace(/^_design\//, ""); return "_design/" + app.utils.safeURLName(ddoc); } }); @@ -186,7 +186,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { this.idxType = "_view"; this.view = options.view; - this.design = options.design.replace('_design/',''); + this.design = options.design.replace('_design/', ''); this.perPageLimit = options.perPageLimit || 20; if (!this.params.limit) { @@ -318,7 +318,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { this.database = options.database; this.rows = options.rows; this.view = options.view; - this.design = options.design.replace('_design/',''); + this.design = options.design.replace('_design/', ''); this.params = _.extend({limit: 20, reduce: false}, options.params); this.idxType = "_view"; @@ -383,7 +383,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { title: 'Replicate Database', icon: 'fonticon-replicate', url: FauxtonAPI.urls('replication', 'app', database.get('id')) - },{ + }, { title: 'Delete', icon: 'fonticon-trash', trigger: 'database:delete' @@ -404,7 +404,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { title: 'New Doc', url: newUrlPrefix + '/new', icon: 'fonticon-plus-circled' - },{ + }, { title: 'New View', url: newUrlPrefix + '/new_view', icon: 'fonticon-plus-circled' http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/routes-doc-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js index 384f0ab..296d665 100644 --- a/app/addons/documents/routes-doc-editor.js +++ b/app/addons/documents/routes-doc-editor.js @@ -120,7 +120,7 @@ function(app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { var databaseName = options[0]; this.database = this.database || new Databases.Model({id: databaseName}); - this.doc = new Documents.NewDoc(null,{ + this.doc = new Documents.NewDoc(null, { database: this.database }); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/routes-index-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js index af51646..4905f3a 100644 --- a/app/addons/documents/routes-index-editor.js +++ b/app/addons/documents/routes-index-editor.js @@ -82,7 +82,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Documents, Index, ] })); - viewName = viewName.replace(/\?.*$/,''); + viewName = viewName.replace(/\?.*$/, ''); this.footer = this.setView('#footer', new Documents.Views.Footer()); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/shared-resources.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/shared-resources.js b/app/addons/documents/shared-resources.js index a3cba90..6299e2c 100644 --- a/app/addons/documents/shared-resources.js +++ b/app/addons/documents/shared-resources.js @@ -156,7 +156,7 @@ define([ // json editor for docs, or into a ddoc specific page. safeID: function() { if (this.isDdoc()){ - var ddoc = this.id.replace(/^_design\//,""); + var ddoc = this.id.replace(/^_design\//, ""); return "_design/" + app.utils.safeURLName(ddoc); }else{ return app.utils.safeURLName(this.id); @@ -221,7 +221,7 @@ define([ this.database = options.database; this.params = _.clone(options.params); - this.on("remove",this.decrementTotalRows , this); + this.on("remove", this.decrementTotalRows, this); this.perPageLimit = options.perPageLimit || 20; if (!this.params.limit) { @@ -271,7 +271,7 @@ define([ decrementTotalRows: function () { if (this.viewMeta.total_rows) { - this.viewMeta.total_rows = this.viewMeta.total_rows -1; + this.viewMeta.total_rows = this.viewMeta.total_rows - 1; this.trigger('totalRows:decrement'); } }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/shared-views.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/shared-views.js b/app/addons/documents/shared-views.js index c3d145d..6f614bd 100644 --- a/app/addons/documents/shared-views.js +++ b/app/addons/documents/shared-views.js @@ -70,7 +70,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { var database = this.collection.database, addLinks = FauxtonAPI.getExtensions('sidebar:links'), databaseName = database.id, - newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL','app', databaseName); + newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName); return _.reduce(addLinks, function (menuLinks, link) { @@ -85,7 +85,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { title: 'New Doc', url: newUrlPrefix + '/new', icon: 'fonticon-plus-circled' - },{ + }, { title: 'New View', url: newUrlPrefix + '/new_view', icon: 'fonticon-plus-circled' @@ -127,7 +127,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { this.designDocList.push(view); } - },this); + }, this); }, afterRender: function () { @@ -167,7 +167,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { this.$(e.currentTarget).toggleClass("down"); }, buildIndexList: function(designDocs, info){ - var design = this.model.id.replace(/^_design\//,""); + var design = this.model.id.replace(/^_design\//, ""); var databaseId = this.model.database.id; if (_.isUndefined(designDocs[info.selector])) { return; } @@ -182,7 +182,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { }, serialize: function(){ - var ddocName = this.model.id.replace(/^_design\//,""), + var ddocName = this.model.id.replace(/^_design\//, ""), docSafe = app.utils.safeURLName(ddocName), databaseName = this.collection.database.safeID(); @@ -194,10 +194,10 @@ function(app, FauxtonAPI, Components, Documents, Databases) { }, getSidebarLinks: function () { //these are for each Design doc '+' links - var ddocName = this.model.id.replace(/^_design\//,""), + var ddocName = this.model.id.replace(/^_design\//, ""), docSafe = app.utils.safeURLName(ddocName), databaseName = this.collection.database.id, - newUrlPrefix = FauxtonAPI.urls('databaseBaseURL','app', databaseName); + newUrlPrefix = FauxtonAPI.urls('databaseBaseURL', 'app', databaseName); return _.reduce(FauxtonAPI.getExtensions('sidebar:links'), function (menuLinks, link) { @@ -229,7 +229,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { _.each(sidebarListTypes, function (info) { this.buildIndexList(ddocDocs, info); - },this); + }, this); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/tests/nightwatch/deletesDocument.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/nightwatch/deletesDocument.js b/app/addons/documents/tests/nightwatch/deletesDocument.js index dce5b66..1f46bc1 100644 --- a/app/addons/documents/tests/nightwatch/deletesDocument.js +++ b/app/addons/documents/tests/nightwatch/deletesDocument.js @@ -32,7 +32,7 @@ module.exports = { .waitForElementVisible('#global-notifications .alert.alert-info', waitTime, false) .url(baseUrl + '/' + newDatabaseName + '/_all_docs') .waitForElementPresent('pre', waitTime, false) - .getText('pre',function (result) { + .getText('pre', function (result) { var data = result.value, createdDocumentNotPresent = data.indexOf(newDocumentName); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/tests/nightwatch/editDocumentsFromView.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/nightwatch/editDocumentsFromView.js b/app/addons/documents/tests/nightwatch/editDocumentsFromView.js index e05d270..bc8a214 100644 --- a/app/addons/documents/tests/nightwatch/editDocumentsFromView.js +++ b/app/addons/documents/tests/nightwatch/editDocumentsFromView.js @@ -41,7 +41,7 @@ module.exports = { //navigated to editor .waitForElementVisible('#editor-container', waitTime, false) - .verify.urlContains('#/database/' + newDatabaseName +'/document_10'); + .verify.urlContains('#/database/' + newDatabaseName + '/document_10'); }, 'Edit is not allowed for Map Views where reduce is checked' : function (client) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/tests/resourcesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/resourcesSpec.js b/app/addons/documents/tests/resourcesSpec.js index 2de4080..1b467c9 100644 --- a/app/addons/documents/tests/resourcesSpec.js +++ b/app/addons/documents/tests/resourcesSpec.js @@ -91,7 +91,7 @@ define([ describe('QueryParams', function() { describe('parse', function() { it('should not parse arbitrary parameters', function() { - var params = {"foo":"[1]]"}; + var params = {"foo": "[1]]"}; var result = Models.QueryParams.parse(params); assert.deepEqual(result, params); @@ -105,8 +105,8 @@ define([ var result = Models.QueryParams.parse(params); assert.deepEqual(result, { - "startkey":["a","b"], - "endkey":["c","d"] + "startkey": ["a", "b"], + "endkey": ["c", "d"] }); }); @@ -116,7 +116,7 @@ define([ }; var result = Models.QueryParams.parse(params); - assert.deepEqual(result, {"key":[1,2]}); + assert.deepEqual(result, {"key": [1, 2]}); }); it('does not modify input', function() { @@ -132,7 +132,7 @@ define([ describe('stringify', function() { it('should not stringify arbitrary parameters', function() { - var params = {"foo":[1,2,3]}; + var params = {"foo": [1, 2, 3]}; var result = Models.QueryParams.stringify(params); assert.deepEqual(result, params); @@ -140,8 +140,8 @@ define([ it('stringifies startkey, endkey', function() { var params = { - "startkey":["a","b"], - "endkey":["c","d"] + "startkey": ["a", "b"], + "endkey": ["c", "d"] }; var result = Models.QueryParams.stringify(params); @@ -153,14 +153,14 @@ define([ }); it('stringifies key', function() { - var params = {"key":["a","b"]}; + var params = {"key":[ "a", "b"]}; var result = Models.QueryParams.stringify(params); - assert.deepEqual(result, { "key":"[\"a\",\"b\"]" }); + assert.deepEqual(result, { "key": "[\"a\",\"b\"]" }); }); it('does not modify input', function() { - var params = {"key":["a","b"]}; + var params = {"key": ["a", "b"]}; var clone = _.clone(params); var result = Models.QueryParams.stringify(params); @@ -169,8 +169,8 @@ define([ it('is symmetrical with parse', function() { var params = { - "startkey":["a","b"], - "endkey":["c","d"], + "startkey": ["a", "b"], + "endkey": ["c", "d"], "foo": "[1,2]", "bar": "abc" }; @@ -221,8 +221,8 @@ define([ it("clears the memory if no errors happened", function () { collection.handleResponse([ - {"ok":true,"id":"1","rev":"10-72cd2edbcc0d197ce96188a229a7af01"}, - {"ok":true,"id":"2","rev":"6-da537822b9672a4b2f42adb1be04a5b1"} + {"ok": true, "id": "1", "rev": "10-72cd2edbcc0d197ce96188a229a7af01"}, + {"ok": true, "id": "2", "rev": "6-da537822b9672a4b2f42adb1be04a5b1"} ]); assert.equal(collection.length, 1); @@ -234,8 +234,8 @@ define([ }); collection.handleResponse([ - {"ok":true,"id":"Deferred","rev":"10-72cd2edbcc0d197ce96188a229a7af01"}, - {"ok":true,"id":"DeskSet","rev":"6-da537822b9672a4b2f42adb1be04a5b1"} + {"ok": true, "id": "Deferred", "rev":"10-72cd2edbcc0d197ce96188a229a7af01"}, + {"ok": true, "id": "DeskSet", "rev":"6-da537822b9672a4b2f42adb1be04a5b1"} ]); }); @@ -244,16 +244,16 @@ define([ assert.deepEqual(ids, ['Deferred']); }); collection.handleResponse([ - {"error":"confclict","id":"Deferred","rev":"10-72cd2edbcc0d197ce96188a229a7af01"}, - {"ok":true,"id":"DeskSet","rev":"6-da537822b9672a4b2f42adb1be04a5b1"} + {"error": "confclict", "id": "Deferred", "rev":"10-72cd2edbcc0d197ce96188a229a7af01"}, + {"ok": true, "id": "DeskSet", "rev": "6-da537822b9672a4b2f42adb1be04a5b1"} ]); }); it("removes successfull deleted from the collection but keeps one with errors", function () { collection.handleResponse([ - {"error":"confclict","id":"1","rev":"10-72cd2edbcc0d197ce96188a229a7af01"}, - {"ok":true,"id":"2","rev":"6-da537822b9672a4b2f42adb1be04a5b1"}, - {"error":"conflict","id":"3","rev":"6-da537822b9672a4b2f42adb1be04a5b1"} + {"error": "confclict", "id": "1", "rev": "10-72cd2edbcc0d197ce96188a229a7af01"}, + {"ok": true, "id":"2", "rev": "6-da537822b9672a4b2f42adb1be04a5b1"}, + {"error": "conflict", "id":"3", "rev": "6-da537822b9672a4b2f42adb1be04a5b1"} ]); assert.ok(collection.get('1')); assert.ok(collection.get('3')); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/views-doceditor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js index 616c3a8..f091a7d 100644 --- a/app/addons/documents/views-doceditor.js +++ b/app/addons/documents/views-doceditor.js @@ -165,8 +165,8 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify) { event.preventDefault(); var newId = this.$('#dup-id').val(), isDDoc = newId.match(/^_design\//), - removeDDocID = newId.replace(/^_design\//,''), - encodedID = isDDoc? '_design/' + app.utils.safeURLName(removeDDocID) : app.utils.safeURLName(newId); + removeDDocID = newId.replace(/^_design\//, ''), + encodedID = isDDoc ? '_design/' + app.utils.safeURLName(removeDDocID) : app.utils.safeURLName(newId); this.hideModal(); FauxtonAPI.triggerRouteEvent('duplicateDoc', encodedID); @@ -178,7 +178,7 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify) { this.clear_error_msg(); this.$('.modal').modal(); // hack to get modal visible - $('.modal-backdrop').css('z-index',1025); + $('.modal-backdrop').css('z-index', 1025); }, showModal: function () { @@ -493,7 +493,7 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify) { var selEnd = this.editor.getSelectionEnd().row; // one JS(ON) string can't span more than one line - we edit one string, so ensure we don't select several lines - if (selStart >=0 && selEnd >= 0 && selStart === selEnd && this.editor.isRowExpanded(selStart)) { + if (selStart >= 0 && selEnd >= 0 && selStart === selEnd && this.editor.isRowExpanded(selStart)) { var editLine = this.editor.getLine(selStart), editMatch = editLine.match(/^([ \t]*)(["|'][a-zA-Z0-9_]*["|']: )?(["|'].*["|'],?[ \t]*)$/); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js index 3e8b8fb..323a5c8 100644 --- a/app/addons/documents/views.js +++ b/app/addons/documents/views.js @@ -107,7 +107,7 @@ function (app, FauxtonAPI, Components, Documents, selectAllMenu: function(e) { FauxtonAPI.triggerRouteEvent("toggleSelectHeader"); - FauxtonAPI.Events.trigger("documents:showSelectAll",this.selectVisible); + FauxtonAPI.Events.trigger("documents:showSelectAll", this.selectVisible); }, // updates the API bar when the route changes @@ -531,7 +531,7 @@ function (app, FauxtonAPI, Components, Documents, jumpToDoc: function (event) { event.preventDefault(); var docId = this.$('#jump-to-doc-id').val().trim(); - FauxtonAPI.navigate('/database/' + app.utils.safeURLName(this.database.id) +'/' + app.utils.safeURLName(docId), {trigger: true}); + FauxtonAPI.navigate('/database/' + app.utils.safeURLName(this.database.id) + '/' + app.utils.safeURLName(docId), {trigger: true}); }, afterRender: function () { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index cf34afb..e532ff6 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -14,8 +14,8 @@ define('ace_configuration', ["app", "ace/ace"], function (app, ace) { var path = app.host + app.root + 'js/ace'; var config = require("ace/config"); config.set("packaged", true); - config.set("workerPath",path); - config.set("modePath",path); + config.set("workerPath", path); + config.set("modePath", path); config.set("themePath", path); return ace; }); @@ -730,7 +730,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { // By default CouchDB view functions don't pass lint return _.every(errors, function(error) { return this.isIgnorableError(error.raw); - },this); + }, this); }, // List of JSHINT errors to ignore http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/permissions/tests/viewsSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/permissions/tests/viewsSpec.js b/app/addons/permissions/tests/viewsSpec.js index 68e79ff..c0d0b9b 100644 --- a/app/addons/permissions/tests/viewsSpec.js +++ b/app/addons/permissions/tests/viewsSpec.js @@ -49,7 +49,8 @@ define([ assert.ok(saveMock.calledOnce); var args = saveMock.args; - assert.deepEqual(args[0][0], {"admins":{"names":["_user"],"roles":[]},"members":{"names":[],"roles":[]}}); + assert.deepEqual(args[0][0], + {"admins": {"names": ["_user"], "roles":[]}, "members": {"names":[], "roles":[]}}); }); it('Should save model', function () { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/plugins/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/plugins/routes.js b/app/addons/plugins/routes.js index 7eb3a11..5077c53 100644 --- a/app/addons/plugins/routes.js +++ b/app/addons/plugins/routes.js @@ -20,7 +20,7 @@ function(app, FauxtonAPI, plugins) { layout: "one_pane", crumbs: [ - {"name": "Plugins","link": "_plugins"} + {"name": "Plugins", "link": "_plugins"} ], routes: { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/replication/views.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js index dbb226d..8e98812 100644 --- a/app/addons/replication/views.js +++ b/app/addons/replication/views.js @@ -77,11 +77,11 @@ function(app, FauxtonAPI, Components, Replication) { }, enableFields: function () { - this.$el.find('input','select').attr('disabled', false); + this.$el.find('input', 'select').attr('disabled', false); }, disableFields: function () { - this.$el.find('input:hidden','select:hidden').attr('disabled', true); + this.$el.find('input:hidden', 'select:hidden').attr('disabled', true); }, showFields: function (e) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/verifyinstall/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/verifyinstall/resources.js b/app/addons/verifyinstall/resources.js index a422ee7..b7f9469 100644 --- a/app/addons/verifyinstall/resources.js +++ b/app/addons/verifyinstall/resources.js @@ -113,7 +113,7 @@ function (app, FauxtonAPI, Databases, Documents) { reduce: '_sum' } } - },{ + }, { database: db }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/addons/verifyinstall/views.js ---------------------------------------------------------------------- diff --git a/app/addons/verifyinstall/views.js b/app/addons/verifyinstall/views.js index a7e9b9a..bc48542 100644 --- a/app/addons/verifyinstall/views.js +++ b/app/addons/verifyinstall/views.js @@ -52,7 +52,7 @@ function(app, FauxtonAPI, VerifyInstall) { }, disableButton: function () { - this.$('#start').attr('disabled','disabled').text('Verifying'); + this.$('#start').attr('disabled', 'disabled').text('Verifying'); }, formatError: function (id) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/core/base.js ---------------------------------------------------------------------- diff --git a/app/core/base.js b/app/core/base.js index 73f0a4c..12bc342 100644 --- a/app/core/base.js +++ b/app/core/base.js @@ -120,7 +120,7 @@ function(Backbone, LayoutManager) { var views = extensions[name]; if (!views) { return; } - var _cb = arguments[arguments.length -1]; + var _cb = arguments[arguments.length - 1]; if (_.isObject(view) && !cb) { _cb = function (item) { return _.isEqual(item, view);}; } http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/core/routeObject.js ---------------------------------------------------------------------- diff --git a/app/core/routeObject.js b/app/core/routeObject.js index bef8f14..a1c3865 100644 --- a/app/core/routeObject.js +++ b/app/core/routeObject.js @@ -198,7 +198,7 @@ function(FauxtonAPI, Backbone) { var args = Array.prototype.slice.call(arguments); this.trigger.apply(this, args); - args.splice(0,1, eventName, this); + args.splice(0, 1, eventName, this); broadcaster.trigger.apply(broadcaster, args); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/core/tests/routeObjectSpec.js ---------------------------------------------------------------------- diff --git a/app/core/tests/routeObjectSpec.js b/app/core/tests/routeObjectSpec.js index 83367dd..b454d14 100644 --- a/app/core/tests/routeObjectSpec.js +++ b/app/core/tests/routeObjectSpec.js @@ -73,7 +73,7 @@ define([ it("Should call establish of routeObject", function () { - var establishSpy = sinon.spy(testRouteObject,"establish"); + var establishSpy = sinon.spy(testRouteObject, "establish"); testRouteObject.renderWith('the-route', mockLayout, 'args'); assert.ok(establishSpy.calledOnce, 'Calls establish'); @@ -81,7 +81,7 @@ define([ it("Should render views", function () { var view = new FauxtonAPI.View(), - getViewsSpy = sinon.stub(testRouteObject,"getViews"), + getViewsSpy = sinon.stub(testRouteObject, "getViews"), viewSpy = sinon.stub(view, "establish"); view.hasRendered = false; @@ -99,7 +99,7 @@ define([ it("Should not re-render a view", function () { var view = new FauxtonAPI.View(), - getViewsSpy = sinon.stub(testRouteObject,"getViews"), + getViewsSpy = sinon.stub(testRouteObject, "getViews"), viewSpy = sinon.stub(view, "establish"); view.hasRendered = true; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/app/core/utils.js ---------------------------------------------------------------------- diff --git a/app/core/utils.js b/app/core/utils.js index 568f0de..1238240 100644 --- a/app/core/utils.js +++ b/app/core/utils.js @@ -33,7 +33,7 @@ function ($, _) { getParams: function(queryString) { if (queryString) { // I think this could be combined into one if - if (queryString.substring(0,1) === "?") { + if (queryString.substring(0, 1) === "?") { queryString = queryString.substring(1); } else if (queryString.indexOf('?') > -1) { queryString = queryString.split('?')[1]; @@ -89,7 +89,7 @@ function ($, _) { }, removeSpecialCharacters: function(name){ - return name.replace(/[^\w\s]/gi,""); + return name.replace(/[^\w\s]/gi, ""); }, safeURLName: function(name){ http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/tasks/couchserver.js ---------------------------------------------------------------------- diff --git a/tasks/couchserver.js b/tasks/couchserver.js index d9b8845..d79e556 100644 --- a/tasks/couchserver.js +++ b/tasks/couchserver.js @@ -41,7 +41,7 @@ module.exports = function (grunt) { var proxy = httpProxy.createServer(proxy_settings); http.createServer(function (req, res) { - var url = req.url.replace('app/',''), + var url = req.url.replace('app/', ''), accept = req.headers.accept.split(','), filePath; @@ -52,21 +52,21 @@ module.exports = function (grunt) { } if (!!url.match(/^\/addons\/.*\/assets\/js/)) { - filePath = path.join(app_dir, url.replace('/_utils/fauxton/','')); + filePath = path.join(app_dir, url.replace('/_utils/fauxton/', '')); } else if (!!url.match(/assets/)) { // serve any javascript or css files from here assets dir url = url.replace(/\?.*/, ''); - filePath = path.join('./',url); + filePath = path.join('./', url); } else if (!!url.match(/mocha|\/test\/core\/|test\.config/)) { - filePath = path.join('./test', url.replace('/test/','')); + filePath = path.join('./test', url.replace('/test/', '')); } else if (!!url.match(/fonts/)) { - filePath = path.join(dist_dir,url.split('?v=')[0]); + filePath = path.join(dist_dir, url.split('?v=')[0]); } else if (!!url.match(/\.css|img/)) { url = url.replace(/\?.*/, ''); - filePath = path.join(dist_dir,url); + filePath = path.join(dist_dir, url); } else if (!!url.match(/\.js$|\.html$/)) { // server js from app directory - filePath = path.join(app_dir, url.replace('/_utils/fauxton/','')); + filePath = path.join(app_dir, url.replace('/_utils/fauxton/', '')); } else if (!!url.match(/ZeroClipboard/)) { filePath = "./assets/js/plugins/zeroclipboard/ZeroClipboard.swf" } else if (!!url.match(/testrunner/)) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d108d27/tasks/fauxton.js ---------------------------------------------------------------------- diff --git a/tasks/fauxton.js b/tasks/fauxton.js index 5b427ee..0393b8e 100644 --- a/tasks/fauxton.js +++ b/tasks/fauxton.js @@ -108,7 +108,7 @@ module.exports = function(grunt) { grunt.file.write(dest, tmpl(app)); }); - grunt.registerMultiTask('mochaSetup','Generate a config.js and runner.html for tests', function(){ + grunt.registerMultiTask('mochaSetup', 'Generate a config.js and runner.html for tests', function(){ var data = this.data, configInfo, _ = grunt.util._, @@ -131,7 +131,7 @@ module.exports = function(grunt) { } }; - eval(grunt.file.read(data.config) +''); + eval(grunt.file.read(data.config) + ''); grunt.file.write('./test/test.config.js', configTemplate({configInfo: configInfo, testFiles: testFiles})); });