From 111205c8cd74d553201b42db3041d870ae833165 Mon Sep 17 00:00:00 2001 From: Giovane Date: Wed, 30 Dec 2015 16:03:27 -0200 Subject: Updates jshint to latest version #565 - Change 'use strict' mode to function-level - Update needed files --- web-ui/.jshintrc | 2 +- web-ui/app/js/features/features.js | 2 +- web-ui/app/js/foundation/initialize_foundation.js | 6 ++++-- web-ui/app/js/foundation/off_canvas.js | 3 +-- web-ui/app/js/helpers/contenttype.js | 2 +- web-ui/app/js/helpers/iterator.js | 2 +- web-ui/app/js/mail_list/ui/mail_item_factory.js | 2 +- web-ui/app/js/mail_list/ui/mail_items/mail_item.js | 2 +- web-ui/app/js/mail_list_actions/ui/mail_list_actions.js | 3 +-- web-ui/app/js/mail_view/ui/mail_view.js | 2 +- web-ui/app/js/mail_view/ui/recipients/recipient.js | 2 +- web-ui/app/js/mail_view/ui/recipients/recipients_input.js | 2 +- web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js | 2 +- web-ui/app/js/mail_view/ui/send_button.js | 3 +-- web-ui/app/js/main.js | 3 ++- web-ui/app/js/mixins/with_feature_toggle.js | 2 +- web-ui/app/js/mixins/with_mail_tagging.js | 2 +- web-ui/app/js/page/pane_contract_expand.js | 2 +- web-ui/app/js/services/model/mail.js | 3 +-- web-ui/app/js/style_guide/main.js | 3 +-- web-ui/package.json | 2 +- web-ui/test/spec/page/pane_contract_expand.spec.js | 3 +-- web-ui/test/spec/services/mail_service.spec.js | 4 +--- web-ui/test/test-main.js | 3 ++- web-ui/test/test_data.js | 3 +-- 25 files changed, 30 insertions(+), 35 deletions(-) diff --git a/web-ui/.jshintrc b/web-ui/.jshintrc index c56e2bd2..220aedfe 100644 --- a/web-ui/.jshintrc +++ b/web-ui/.jshintrc @@ -15,7 +15,7 @@ "quotmark": "single", "regexp": true, "smarttabs": true, - "strict": true, + "strict": "function", "trailing": true, "undef": false, "validthis": true, diff --git a/web-ui/app/js/features/features.js b/web-ui/app/js/features/features.js index 4d04df64..80ecc225 100644 --- a/web-ui/app/js/features/features.js +++ b/web-ui/app/js/features/features.js @@ -14,9 +14,9 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define(['helpers/monitored_ajax'], function(monitoredAjax) { + 'use strict'; var cachedDisabledFeatures; var cachedDispatcherFeatures; diff --git a/web-ui/app/js/foundation/initialize_foundation.js b/web-ui/app/js/foundation/initialize_foundation.js index b382a168..42405dfe 100644 --- a/web-ui/app/js/foundation/initialize_foundation.js +++ b/web-ui/app/js/foundation/initialize_foundation.js @@ -1,3 +1,5 @@ -'use strict'; -$(document).foundation(); +(function() { + 'use strict'; + $(document).foundation(); +})(); diff --git a/web-ui/app/js/foundation/off_canvas.js b/web-ui/app/js/foundation/off_canvas.js index 805dfab8..66334470 100644 --- a/web-ui/app/js/foundation/off_canvas.js +++ b/web-ui/app/js/foundation/off_canvas.js @@ -14,9 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define(['flight/lib/component', 'page/events'], function (defineComponent, events) { - + 'use strict'; return defineComponent(function() { this.closeSlider = function (ev){ diff --git a/web-ui/app/js/helpers/contenttype.js b/web-ui/app/js/helpers/contenttype.js index 764b6032..92b456e9 100644 --- a/web-ui/app/js/helpers/contenttype.js +++ b/web-ui/app/js/helpers/contenttype.js @@ -14,8 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define([], function () { + 'use strict'; var exports = {}; // Licence: PUBLIC DOMAIN diff --git a/web-ui/app/js/helpers/iterator.js b/web-ui/app/js/helpers/iterator.js index b5b44379..236c7a40 100644 --- a/web-ui/app/js/helpers/iterator.js +++ b/web-ui/app/js/helpers/iterator.js @@ -14,8 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define(function () { + 'use strict'; return Iterator; diff --git a/web-ui/app/js/mail_list/ui/mail_item_factory.js b/web-ui/app/js/mail_list/ui/mail_item_factory.js index ddfa4c62..7205d35c 100644 --- a/web-ui/app/js/mail_list/ui/mail_item_factory.js +++ b/web-ui/app/js/mail_list/ui/mail_item_factory.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define( [ @@ -23,6 +22,7 @@ define( 'mail_list/ui/mail_items/sent_item' ], function (GenericMailItem, DraftItem, SentItem) { + 'use strict'; var MAIL_ITEM_TYPE = { 'drafts': DraftItem, diff --git a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js index 266db926..c075b0b5 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define( [ @@ -24,6 +23,7 @@ define( ], function (viewHelper, templates, events) { + 'use strict'; function mailItem() { this.updateSelected = function (ev, data) { if (data.ident === this.attr.mail.ident) { this.doSelect(); } diff --git a/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js b/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js index f71ed07c..69e5fde4 100644 --- a/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js +++ b/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define( [ @@ -50,7 +49,7 @@ define( markManyAsReadTrigger, markAsUnreadTrigger ) { - + 'use strict'; return defineComponent(mailsActions); function mailsActions() { diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js index 01db6c4f..76c5b7d9 100644 --- a/web-ui/app/js/mail_view/ui/mail_view.js +++ b/web-ui/app/js/mail_view/ui/mail_view.js @@ -15,7 +15,6 @@ * along with Pixelated. If not, see . */ -'use strict'; define( [ 'flight/lib/component', @@ -29,6 +28,7 @@ define( ], function (defineComponent, templates, mailActions, viewHelpers, withHideAndShow, withMailTagging, events, i18n) { + 'use strict'; return defineComponent(mailView, mailActions, withHideAndShow, withMailTagging); diff --git a/web-ui/app/js/mail_view/ui/recipients/recipient.js b/web-ui/app/js/mail_view/ui/recipients/recipient.js index abfbc8e4..c13a52b1 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipient.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipient.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define( [ @@ -24,6 +23,7 @@ define( ], function (defineComponent, templates, events) { + 'use strict'; return defineComponent(recipient); diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js index db0b10f7..62bc9c4a 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define([ 'flight/lib/component', @@ -22,6 +21,7 @@ define([ 'features' ], function (defineComponent, events, features) { + 'use strict'; function recipientsInput() { var EXIT_KEY_CODE_MAP = { diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js b/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js index 6c52c52e..624ac4f5 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js @@ -15,8 +15,8 @@ * along with Pixelated. If not, see . */ -'use strict'; define(['helpers/iterator'], function (Iterator) { + 'use strict'; return RecipientsIterator; diff --git a/web-ui/app/js/mail_view/ui/send_button.js b/web-ui/app/js/mail_view/ui/send_button.js index b16ea055..b1f35906 100644 --- a/web-ui/app/js/mail_view/ui/send_button.js +++ b/web-ui/app/js/mail_view/ui/send_button.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; - define([ 'flight/lib/component', 'flight/lib/utils', @@ -23,6 +21,7 @@ define([ 'helpers/view_helper' ], function (defineComponent, utils, events, viewHelper) { + 'use strict'; return defineComponent(sendButton); diff --git a/web-ui/app/js/main.js b/web-ui/app/js/main.js index ea68218d..5fb2e46f 100644 --- a/web-ui/app/js/main.js +++ b/web-ui/app/js/main.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; requirejs.config({ baseUrl: '../assets/', @@ -48,6 +47,7 @@ require([ 'flight/lib/compose', 'flight/lib/debug' ], function(compose, debug){ + 'use strict'; debug.enable(true); debug.events.logAll(); }); @@ -65,6 +65,7 @@ require( ], function(compose, registry, advice, withLogging, debug, events, initializeDefault, _monkeyPatched) { + 'use strict'; window.Pixelated = window.Pixelated || {}; window.Pixelated.events = events; diff --git a/web-ui/app/js/mixins/with_feature_toggle.js b/web-ui/app/js/mixins/with_feature_toggle.js index b286cc48..195b08bc 100644 --- a/web-ui/app/js/mixins/with_feature_toggle.js +++ b/web-ui/app/js/mixins/with_feature_toggle.js @@ -15,9 +15,9 @@ * along with Pixelated. If not, see . */ -'use strict'; define(['features'], function(features) { + 'use strict'; function withFeatureToggle(componentName, behaviorForFeatureOff) { return function() { diff --git a/web-ui/app/js/mixins/with_mail_tagging.js b/web-ui/app/js/mixins/with_mail_tagging.js index 8e27d672..1fc1c3bd 100644 --- a/web-ui/app/js/mixins/with_mail_tagging.js +++ b/web-ui/app/js/mixins/with_mail_tagging.js @@ -15,10 +15,10 @@ * along with Pixelated. If not, see . */ -'use strict'; define( ['page/events', 'features'], function (events, features) { + 'use strict'; function withMailTagging () { this.updateTags = function(mail, tags) { this.trigger(document, events.mail.tags.update, {ident: mail.ident, tags: tags}); diff --git a/web-ui/app/js/page/pane_contract_expand.js b/web-ui/app/js/page/pane_contract_expand.js index aee8c44f..9bb435c4 100644 --- a/web-ui/app/js/page/pane_contract_expand.js +++ b/web-ui/app/js/page/pane_contract_expand.js @@ -14,9 +14,9 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; define(['flight/lib/component', 'page/events'], function (describeComponent, events) { + 'use strict'; return describeComponent(paneContractExpand); diff --git a/web-ui/app/js/services/model/mail.js b/web-ui/app/js/services/model/mail.js index c41bcff9..64a10c1c 100644 --- a/web-ui/app/js/services/model/mail.js +++ b/web-ui/app/js/services/model/mail.js @@ -14,9 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; - define(['helpers/contenttype'], function (contentType) { + 'use strict'; function isSentMail() { return _.has(this, 'mailbox') && this.mailbox.toUpperCase() === 'SENT'; } diff --git a/web-ui/app/js/style_guide/main.js b/web-ui/app/js/style_guide/main.js index 170d1187..32c213cf 100644 --- a/web-ui/app/js/style_guide/main.js +++ b/web-ui/app/js/style_guide/main.js @@ -14,9 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -'use strict'; - $(document).ready(function(){ + 'use strict'; $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) { diff --git a/web-ui/package.json b/web-ui/package.json index e03d607c..d067dc68 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -9,7 +9,7 @@ "handlebars": "2.0.0", "html-minifier": "1.0.1", "imagemin": "4.0.0", - "jshint": "2.8.0", + "jshint": "2.9.1-rc2", "karma": "0.12.31", "karma-chrome-launcher": "0.1.7", "karma-firefox-launcher": "0.1.4", diff --git a/web-ui/test/spec/page/pane_contract_expand.spec.js b/web-ui/test/spec/page/pane_contract_expand.spec.js index 6c7ebcfc..5ec7192a 100644 --- a/web-ui/test/spec/page/pane_contract_expand.spec.js +++ b/web-ui/test/spec/page/pane_contract_expand.spec.js @@ -1,7 +1,6 @@ -'use strict'; describeComponent('page/pane_contract_expand', function () { - + 'use strict'; var fixture; beforeEach(function () { diff --git a/web-ui/test/spec/services/mail_service.spec.js b/web-ui/test/spec/services/mail_service.spec.js index d0911768..82714797 100644 --- a/web-ui/test/spec/services/mail_service.spec.js +++ b/web-ui/test/spec/services/mail_service.spec.js @@ -1,7 +1,5 @@ -'use strict'; - describeComponent('services/mail_service', function () { - + 'use strict'; var email1, i18n; var features; diff --git a/web-ui/test/test-main.js b/web-ui/test/test-main.js index cfd2d81c..7d87d9de 100644 --- a/web-ui/test/test-main.js +++ b/web-ui/test/test-main.js @@ -1,6 +1,6 @@ -'use strict'; var tests = Object.keys(window.__karma__.files).filter(function (file) { + 'use strict'; return (/\.spec\.js$/.test(file)); }); @@ -39,6 +39,7 @@ requirejs.config({ deps: tests, callback: function () { + 'use strict'; require(['page/events','test/test_data', 'views/i18n', 'monkey_patching/array', 'views/recipientListFormatter', 'test/custom_matchers'], function (events, testData, i18n, mp, recipientListFormatter, customMatchers) { window.Pixelated = window.Pixelated || {}; window.Pixelated.events = events; diff --git a/web-ui/test/test_data.js b/web-ui/test/test_data.js index 62492bbe..ea9458dc 100644 --- a/web-ui/test/test_data.js +++ b/web-ui/test/test_data.js @@ -1,6 +1,5 @@ -'use strict'; - define(function() { +'use strict'; var rawMail = { header: { to:'jed_waelchi@cummerata.info', -- cgit v1.2.3