diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..745e3f3ed1 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +.tmp/** +app/bower_components/** +app/scripts/vendor/** +dist/** diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000..996a5a5664 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,48 @@ +{ + "env": { + "amd": true, + "es6": true, + "mocha": true, + "node": true + }, + "rules": { + "camelcase": 0, + "comma-dangle": 0, + "complexity": [2, 6], + "consistent-return": 0, + "curly": [2, "all"], + "dot-notation": 0, + "eol-last": 2, + "eqeqeq": [2, "allow-null"], + "global-strict": [0, "never"], + "handle-callback-err": 0, + "key-spacing": 0, + "new-cap": 0, + "no-cond-assign": [2, "except-parens"], + "no-debugger": 2, + "no-empty": 0, + "no-eval": 2, + "no-irregular-whitespace": 2, + "no-loop-func": 0, + "no-multiple-empty-lines": [2, {"max": 2}], + "no-multi-spaces": 0, + "no-new": 2, + "no-script-url": 2, + "no-sequences": 2, + "no-shadow": 0, + "no-spaced-func": 0, + "no-trailing-spaces": 2, + "no-undef": 2, + "no-underscore-dangle": 0, + "no-unused-vars": [2, {"vars": "all", "args": "none"}], + "no-use-before-define": true, + "no-with": 2, + "quotes": [2, "single", "avoid-escape"], + "semi": [2, "always"], + "space-unary-ops": 0, + "strict": 2, + "valid-typeof": 1, + "wrap-iife": 0, + "yoda": 0 + } +} diff --git a/.jshintrc b/.jshintrc index 9fa346c065..36830724a0 100644 --- a/.jshintrc +++ b/.jshintrc @@ -18,7 +18,7 @@ "sub": true, "trailing": true, "undef": true, - "unused": true, + "unused": "vars", "globals": { "define": false, "Promise": true diff --git a/app/.eslintrc b/app/.eslintrc new file mode 100644 index 0000000000..c1eacf9069 --- /dev/null +++ b/app/.eslintrc @@ -0,0 +1,21 @@ +{ + "env": { + "browser": true, + "builtin": true, + "jquery": true, + "node": false + }, + "rules": { + "globals": { + "router": false + }, + "no-bitwise": 2, + "no-caller": 2, + "no-console": 0, + "no-extend-native": 2, + "no-multi-str": 2, + "no-proto": 2, + "strict": [2, "global"], + "valid-typeof": 2 + } +} diff --git a/app/scripts/head/start.js b/app/scripts/head/start.js index 18ae842632..58763aab99 100644 --- a/app/scripts/head/start.js +++ b/app/scripts/head/start.js @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/*globals FxaHead */ 'use strict'; (function () { diff --git a/app/scripts/head/startup-styles.js b/app/scripts/head/startup-styles.js index 190ea9811f..45f292b6f1 100644 --- a/app/scripts/head/startup-styles.js +++ b/app/scripts/head/startup-styles.js @@ -9,7 +9,6 @@ // NOTE: This file must run in IE8+, so no ES5/ES6 features! //jshint es3: true, es5: false, esnext: false - 'use strict'; // This is loaded in the HEAD of the doc & uses a modified version of diff --git a/app/scripts/lib/able.js b/app/scripts/lib/able.js index 14f8eaba6c..9ed9885bbc 100644 --- a/app/scripts/lib/able.js +++ b/app/scripts/lib/able.js @@ -10,7 +10,6 @@ * via window.able. If able is disabled in production, choose * will always return `undefined` and `report` will return an empty array. */ - 'use strict'; define([], function () { diff --git a/app/scripts/lib/app-start.js b/app/scripts/lib/app-start.js index d5b9925dbd..479816802b 100644 --- a/app/scripts/lib/app-start.js +++ b/app/scripts/lib/app-start.js @@ -14,7 +14,6 @@ * 5) If cookies are disabled, go to the /cookies_disabled page. * 6) Start the app if cookies are enabled. */ - 'use strict'; define([ @@ -353,7 +352,8 @@ function ( }, initializeAuthenticationBroker: function () { - //jshint maxcomplexity: 7 + /*jshint maxcomplexity: 7 */ + /*eslint complexity: [2, 7] */ if (! this._authenticationBroker) { if (this._isFxDesktopV2()) { this._authenticationBroker = new FxDesktopV2AuthenticationBroker({ diff --git a/app/scripts/lib/assertion.js b/app/scripts/lib/assertion.js index 056f4a1874..fa047f7c12 100644 --- a/app/scripts/lib/assertion.js +++ b/app/scripts/lib/assertion.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/lib/auth-errors.js b/app/scripts/lib/auth-errors.js index c2c8e9dd02..b5741d59f3 100644 --- a/app/scripts/lib/auth-errors.js +++ b/app/scripts/lib/auth-errors.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // provides functions to work with errors returned by the auth server. - 'use strict'; define([ diff --git a/app/scripts/lib/base64url.js b/app/scripts/lib/base64url.js index dacb9cc8d2..4f4683b41f 100644 --- a/app/scripts/lib/base64url.js +++ b/app/scripts/lib/base64url.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; /** diff --git a/app/scripts/lib/channels/base.js b/app/scripts/lib/channels/base.js index 9164195a81..db330fbdbd 100644 --- a/app/scripts/lib/channels/base.js +++ b/app/scripts/lib/channels/base.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; // A channel interface. diff --git a/app/scripts/lib/channels/duplex.js b/app/scripts/lib/channels/duplex.js index 45d32c3fda..d15ae22515 100644 --- a/app/scripts/lib/channels/duplex.js +++ b/app/scripts/lib/channels/duplex.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; /** diff --git a/app/scripts/lib/channels/fx-desktop.js b/app/scripts/lib/channels/fx-desktop.js index 1311a4011a..864accef2f 100644 --- a/app/scripts/lib/channels/fx-desktop.js +++ b/app/scripts/lib/channels/fx-desktop.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; // Firefox for desktop native=>FxA glue code. diff --git a/app/scripts/lib/channels/iframe.js b/app/scripts/lib/channels/iframe.js index 3b66f3f6b5..30ea53d32b 100644 --- a/app/scripts/lib/channels/iframe.js +++ b/app/scripts/lib/channels/iframe.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; /** diff --git a/app/scripts/lib/channels/inter-tab.js b/app/scripts/lib/channels/inter-tab.js index 458d524333..ed1910f771 100644 --- a/app/scripts/lib/channels/inter-tab.js +++ b/app/scripts/lib/channels/inter-tab.js @@ -6,7 +6,6 @@ * This is a special channel that communicates between two * tabs of the same browser. It uses localStorage to communicate. */ - 'use strict'; define([ diff --git a/app/scripts/lib/channels/mixins/postmessage_receiver.js b/app/scripts/lib/channels/mixins/postmessage_receiver.js index fa83519c20..005b85c6e0 100644 --- a/app/scripts/lib/channels/mixins/postmessage_receiver.js +++ b/app/scripts/lib/channels/mixins/postmessage_receiver.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; /** diff --git a/app/scripts/lib/channels/null.js b/app/scripts/lib/channels/null.js index 57e6e7e2d4..dbd779a3f5 100644 --- a/app/scripts/lib/channels/null.js +++ b/app/scripts/lib/channels/null.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; // A shell of a channel. Doesn't do anything yet, but is a useful standin. diff --git a/app/scripts/lib/channels/receivers/web-channel.js b/app/scripts/lib/channels/receivers/web-channel.js index e833305de2..4b5ef17616 100644 --- a/app/scripts/lib/channels/receivers/web-channel.js +++ b/app/scripts/lib/channels/receivers/web-channel.js @@ -7,7 +7,6 @@ * https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/WebChannel.jsm */ - 'use strict'; define([ diff --git a/app/scripts/lib/channels/senders/null.js b/app/scripts/lib/channels/senders/null.js index a805c6e632..11ac79265f 100644 --- a/app/scripts/lib/channels/senders/null.js +++ b/app/scripts/lib/channels/senders/null.js @@ -5,7 +5,6 @@ /** * A null sender. Sends messages nowhere. */ - 'use strict'; define([ diff --git a/app/scripts/lib/channels/senders/web-channel.js b/app/scripts/lib/channels/senders/web-channel.js index 90686a9cfe..46ca015341 100644 --- a/app/scripts/lib/channels/senders/web-channel.js +++ b/app/scripts/lib/channels/senders/web-channel.js @@ -6,7 +6,6 @@ * Send a message to the browser over a WebChannel. See * https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/WebChannel.jsm */ - 'use strict'; define([ diff --git a/app/scripts/lib/channels/web.js b/app/scripts/lib/channels/web.js index c01ada2db4..5d25bc3ada 100644 --- a/app/scripts/lib/channels/web.js +++ b/app/scripts/lib/channels/web.js @@ -5,7 +5,6 @@ // A channel that completes the OAuth flow using Firefox WebChannel events // https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/WebChannel.jsm // https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/FxAccountsOAuthClient.jsm - 'use strict'; define([ diff --git a/app/scripts/lib/config-loader.js b/app/scripts/lib/config-loader.js index 82ed55ceaf..907b5e7264 100644 --- a/app/scripts/lib/config-loader.js +++ b/app/scripts/lib/config-loader.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // fetch config from the backend and provide some helper functions. - 'use strict'; define([ diff --git a/app/scripts/lib/constants.js b/app/scripts/lib/constants.js index 1c6383398d..a283be6304 100644 --- a/app/scripts/lib/constants.js +++ b/app/scripts/lib/constants.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([], function () { diff --git a/app/scripts/lib/cropper.js b/app/scripts/lib/cropper.js index c154ae1be1..86c97fe553 100644 --- a/app/scripts/lib/cropper.js +++ b/app/scripts/lib/cropper.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/lib/environment.js b/app/scripts/lib/environment.js index e42f5a0b1d..f3d7772d6b 100644 --- a/app/scripts/lib/environment.js +++ b/app/scripts/lib/environment.js @@ -10,7 +10,6 @@ // No ES5/ES6 features! //jshint es3: true, es5: false, esnext: false - 'use strict'; // This is loaded in the HEAD of the doc & uses a modified version of diff --git a/app/scripts/lib/ephemeral-messages.js b/app/scripts/lib/ephemeral-messages.js index b08edb2828..b4a6aefe1c 100644 --- a/app/scripts/lib/ephemeral-messages.js +++ b/app/scripts/lib/ephemeral-messages.js @@ -4,7 +4,6 @@ // an ephemeral messages model. Ephemeral messages are allowed // a single `get` and no more. - 'use strict'; define([ diff --git a/app/scripts/lib/errors.js b/app/scripts/lib/errors.js index 2cbeb919a2..204a93a2d3 100644 --- a/app/scripts/lib/errors.js +++ b/app/scripts/lib/errors.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/lib/fxa-client.js b/app/scripts/lib/fxa-client.js index 5b23c2331a..81049a0323 100644 --- a/app/scripts/lib/fxa-client.js +++ b/app/scripts/lib/fxa-client.js @@ -5,7 +5,6 @@ // a very light wrapper around the real FxaClient to reduce boilerplate code // and to allow us to develop to features that are not yet present in the real // client. - 'use strict'; define([ diff --git a/app/scripts/lib/marketing-email-client.js b/app/scripts/lib/marketing-email-client.js index 932abf56a0..820fbff47d 100644 --- a/app/scripts/lib/marketing-email-client.js +++ b/app/scripts/lib/marketing-email-client.js @@ -5,7 +5,6 @@ /** * A client to talk to the basket marketing email server */ - 'use strict'; define([ diff --git a/app/scripts/lib/marketing-email-errors.js b/app/scripts/lib/marketing-email-errors.js index 6cf85752b1..fb4b6c058c 100644 --- a/app/scripts/lib/marketing-email-errors.js +++ b/app/scripts/lib/marketing-email-errors.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // provides functions to work with errors returned by the auth server. - 'use strict'; define([ diff --git a/app/scripts/lib/metrics.js b/app/scripts/lib/metrics.js index 36161be9de..75e7c75f4e 100644 --- a/app/scripts/lib/metrics.js +++ b/app/scripts/lib/metrics.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -'use strict'; /* * A metrics module! @@ -14,6 +13,7 @@ * Metrics are automatically sent to the server on window.unload * but can also be sent by calling metrics.flush(); */ +'use strict'; define([ 'underscore', @@ -62,6 +62,7 @@ define([ function Metrics (options) { /*jshint maxcomplexity:18 */ + /*eslint complexity: [2, 18] */ options = options || {}; // by default, send the metrics to the content server. diff --git a/app/scripts/lib/null-storage.js b/app/scripts/lib/null-storage.js index 1728e3478a..5f9b682242 100644 --- a/app/scripts/lib/null-storage.js +++ b/app/scripts/lib/null-storage.js @@ -4,7 +4,6 @@ // This is a memory store that's api compatible with localStorage/sessionStorage. // It's used for testing lib/storage. - 'use strict'; define([ diff --git a/app/scripts/lib/oauth-client.js b/app/scripts/lib/oauth-client.js index 97c5f27b10..0f21543497 100644 --- a/app/scripts/lib/oauth-client.js +++ b/app/scripts/lib/oauth-client.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/lib/oauth-errors.js b/app/scripts/lib/oauth-errors.js index 51db66d1cf..78654d1143 100644 --- a/app/scripts/lib/oauth-errors.js +++ b/app/scripts/lib/oauth-errors.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // provides functions to work with errors returned by the auth server. - 'use strict'; define([ diff --git a/app/scripts/lib/profile-client.js b/app/scripts/lib/profile-client.js index f4c2e5337d..5d40cb04d9 100644 --- a/app/scripts/lib/profile-client.js +++ b/app/scripts/lib/profile-client.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // This module handles communication with the fxa-profile-server. - 'use strict'; define([ diff --git a/app/scripts/lib/profile-errors.js b/app/scripts/lib/profile-errors.js index 53c1ac89d2..de50b6d1a0 100644 --- a/app/scripts/lib/profile-errors.js +++ b/app/scripts/lib/profile-errors.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/lib/relier-keys.js b/app/scripts/lib/relier-keys.js index a1ad77454f..a347d4d369 100644 --- a/app/scripts/lib/relier-keys.js +++ b/app/scripts/lib/relier-keys.js @@ -5,7 +5,6 @@ /** * Derive relier-specific encryption keys from account master keys. */ - 'use strict'; define([ diff --git a/app/scripts/lib/screen-info.js b/app/scripts/lib/screen-info.js index e0db4dcec6..40d9e084d4 100644 --- a/app/scripts/lib/screen-info.js +++ b/app/scripts/lib/screen-info.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // module to calculate screen dimentions given a window. - 'use strict'; define([ @@ -12,6 +11,7 @@ define([ function ScreenInfo(win) { /*jshint maxcomplexity:8 */ + /*eslint complexity: [2, 8] */ var documentElement = win.document.documentElement || {}; var screen = win.screen || {}; diff --git a/app/scripts/lib/session.js b/app/scripts/lib/session.js index 3544f29270..afb4abe9f1 100644 --- a/app/scripts/lib/session.js +++ b/app/scripts/lib/session.js @@ -4,7 +4,6 @@ // Session saves session information about the user. Data is automatically // saved to sessionStorage and automatically loaded from sessionStorage on startup. - 'use strict'; define([ diff --git a/app/scripts/lib/storage.js b/app/scripts/lib/storage.js index 5858b988ba..e9cf9a6f2c 100644 --- a/app/scripts/lib/storage.js +++ b/app/scripts/lib/storage.js @@ -4,7 +4,6 @@ // This module abstracts interaction with storage backends such as localStorage // or sessionStorage. - 'use strict'; define([ @@ -24,7 +23,7 @@ define([ var item; try { item = JSON.parse(this._backend.getItem(fullKey(key))); - } catch (e) { + } catch (e) { //eslint-disable-line no-empty } return item; }; diff --git a/app/scripts/lib/strings.js b/app/scripts/lib/strings.js index 68c052ff13..90944cc58c 100644 --- a/app/scripts/lib/strings.js +++ b/app/scripts/lib/strings.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/lib/xhr.js b/app/scripts/lib/xhr.js index 517c7234ab..aaaf001c99 100644 --- a/app/scripts/lib/xhr.js +++ b/app/scripts/lib/xhr.js @@ -11,7 +11,6 @@ * dataType is set. `ajax` is a low level function and does not set * a default data type. See issue #1786. */ - 'use strict'; define([ diff --git a/app/scripts/lib/xss.js b/app/scripts/lib/xss.js index 392e8b1072..82c8e1bd46 100644 --- a/app/scripts/lib/xss.js +++ b/app/scripts/lib/xss.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Basic XSS protection - 'use strict'; define([ diff --git a/app/scripts/main.js b/app/scripts/main.js index c5cf6bc89b..be4036270e 100644 --- a/app/scripts/main.js +++ b/app/scripts/main.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; require([ diff --git a/app/scripts/models/account.js b/app/scripts/models/account.js index 6766077616..38467d7b00 100644 --- a/app/scripts/models/account.js +++ b/app/scripts/models/account.js @@ -4,7 +4,6 @@ // This model abstracts interaction between the user's account // and the profile server and also handles (de)serialization. - 'use strict'; define([ diff --git a/app/scripts/models/auth_brokers/fx-desktop-v2.js b/app/scripts/models/auth_brokers/fx-desktop-v2.js index 5a291cf068..79f9d1f395 100644 --- a/app/scripts/models/auth_brokers/fx-desktop-v2.js +++ b/app/scripts/models/auth_brokers/fx-desktop-v2.js @@ -9,7 +9,6 @@ * * If Sync is iframed by web content, v2 of the protocol is assumed. */ - 'use strict'; define([ diff --git a/app/scripts/models/auth_brokers/fx-desktop.js b/app/scripts/models/auth_brokers/fx-desktop.js index 0b39ea59eb..89f50bb527 100644 --- a/app/scripts/models/auth_brokers/fx-desktop.js +++ b/app/scripts/models/auth_brokers/fx-desktop.js @@ -5,7 +5,6 @@ /** * A broker that knows how to communicate with Firefox when used for Sync. */ - 'use strict'; define([ diff --git a/app/scripts/models/auth_brokers/iframe.js b/app/scripts/models/auth_brokers/iframe.js index a99d061108..ef567b471c 100644 --- a/app/scripts/models/auth_brokers/iframe.js +++ b/app/scripts/models/auth_brokers/iframe.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Finishes the OAuth flow by redirecting the window. - 'use strict'; define([ diff --git a/app/scripts/models/auth_brokers/oauth.js b/app/scripts/models/auth_brokers/oauth.js index d561b19dd6..c582f1b6a6 100644 --- a/app/scripts/models/auth_brokers/oauth.js +++ b/app/scripts/models/auth_brokers/oauth.js @@ -6,7 +6,6 @@ * A broker that knows how to finish an OAuth flow. Should be subclassed * to override `sendOAuthResultToRelier` */ - 'use strict'; define([ diff --git a/app/scripts/models/auth_brokers/redirect.js b/app/scripts/models/auth_brokers/redirect.js index 8a5b9ab712..d61630ea57 100644 --- a/app/scripts/models/auth_brokers/redirect.js +++ b/app/scripts/models/auth_brokers/redirect.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Finishes the OAuth flow by redirecting the window. - 'use strict'; define([ diff --git a/app/scripts/models/auth_brokers/web-channel.js b/app/scripts/models/auth_brokers/web-channel.js index 71f1c3d6e1..4701f7344c 100644 --- a/app/scripts/models/auth_brokers/web-channel.js +++ b/app/scripts/models/auth_brokers/web-channel.js @@ -6,7 +6,6 @@ * A broker that makes use of the WebChannel abstraction to communicate * with the browser */ - 'use strict'; define([ diff --git a/app/scripts/models/cropper-image.js b/app/scripts/models/cropper-image.js index 94dccc8eb1..d504a1b1f1 100644 --- a/app/scripts/models/cropper-image.js +++ b/app/scripts/models/cropper-image.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // This model abstracts images used by the cropper view - 'use strict'; define([ diff --git a/app/scripts/models/form-prefill.js b/app/scripts/models/form-prefill.js index 98113fbe78..312c3713c9 100644 --- a/app/scripts/models/form-prefill.js +++ b/app/scripts/models/form-prefill.js @@ -8,7 +8,6 @@ // should automatically be filled in. // // These values are not persisted across browser sessions. - 'use strict'; define([ diff --git a/app/scripts/models/marketing-email-prefs.js b/app/scripts/models/marketing-email-prefs.js index d744f34457..02329199b6 100644 --- a/app/scripts/models/marketing-email-prefs.js +++ b/app/scripts/models/marketing-email-prefs.js @@ -7,7 +7,6 @@ * on the "Basket" server, not the auth server. Email preferences are * loaded on demand, independently of account information. */ - 'use strict'; define([ diff --git a/app/scripts/models/mixins/search-param.js b/app/scripts/models/mixins/search-param.js index 8c06e904eb..1defe8b827 100644 --- a/app/scripts/models/mixins/search-param.js +++ b/app/scripts/models/mixins/search-param.js @@ -5,7 +5,6 @@ /** * A mixin that allows models to get/import search parameters */ - 'use strict'; define([ @@ -64,6 +63,3 @@ define([ } }; }); - - - diff --git a/app/scripts/models/notifications.js b/app/scripts/models/notifications.js index 2309f184b9..d1c656e956 100644 --- a/app/scripts/models/notifications.js +++ b/app/scripts/models/notifications.js @@ -5,7 +5,6 @@ /** * The notifier broadcasts messages across multiple channels (iframe, tabs, browsers, etc). */ - 'use strict'; define([ diff --git a/app/scripts/models/profile-image.js b/app/scripts/models/profile-image.js index 942f44b438..5883ccf801 100644 --- a/app/scripts/models/profile-image.js +++ b/app/scripts/models/profile-image.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // This model abstracts profile images - 'use strict'; define([ diff --git a/app/scripts/models/reliers/base.js b/app/scripts/models/reliers/base.js index 94afebb53c..d8aa2f8d67 100644 --- a/app/scripts/models/reliers/base.js +++ b/app/scripts/models/reliers/base.js @@ -6,7 +6,6 @@ * The base relier. It's the base of all other reliers, or a NullRelier, * depending on how you want to use it. */ - 'use strict'; define([ diff --git a/app/scripts/models/reliers/fx-desktop.js b/app/scripts/models/reliers/fx-desktop.js index 9c4aad80d1..b67deab1ce 100644 --- a/app/scripts/models/reliers/fx-desktop.js +++ b/app/scripts/models/reliers/fx-desktop.js @@ -9,7 +9,6 @@ * - context * - migration */ - 'use strict'; define([ diff --git a/app/scripts/models/reliers/oauth.js b/app/scripts/models/reliers/oauth.js index deda38404d..d2071d483d 100644 --- a/app/scripts/models/reliers/oauth.js +++ b/app/scripts/models/reliers/oauth.js @@ -5,7 +5,6 @@ /** * An OAuth Relier - holds OAuth information. */ - 'use strict'; define([ diff --git a/app/scripts/models/reliers/relier.js b/app/scripts/models/reliers/relier.js index 8142204da2..303c41c405 100644 --- a/app/scripts/models/reliers/relier.js +++ b/app/scripts/models/reliers/relier.js @@ -5,7 +5,6 @@ /** * A relier is a model that holds information about the RP. */ - 'use strict'; define([ diff --git a/app/scripts/models/user.js b/app/scripts/models/user.js index 047528c725..035699c411 100644 --- a/app/scripts/models/user.js +++ b/app/scripts/models/user.js @@ -8,7 +8,6 @@ // // i.e. User hasMany Accounts. - 'use strict'; define([ diff --git a/app/scripts/models/verification/account-unlock.js b/app/scripts/models/verification/account-unlock.js index 959f19fa57..4954d3ac0d 100644 --- a/app/scripts/models/verification/account-unlock.js +++ b/app/scripts/models/verification/account-unlock.js @@ -6,7 +6,6 @@ /** * A model to hold account unlock verification data */ - 'use strict'; define([ diff --git a/app/scripts/models/verification/base.js b/app/scripts/models/verification/base.js index 9d62672485..e368b21e5d 100644 --- a/app/scripts/models/verification/base.js +++ b/app/scripts/models/verification/base.js @@ -11,7 +11,6 @@ * hashes. The `validation` hash contains the same keys as the `defaults` * whose values are validation functions. */ - 'use strict'; define([ diff --git a/app/scripts/models/verification/reset-password.js b/app/scripts/models/verification/reset-password.js index c63b2e3707..44d1a6b858 100644 --- a/app/scripts/models/verification/reset-password.js +++ b/app/scripts/models/verification/reset-password.js @@ -5,7 +5,6 @@ /** * A model to hold reset password verification data */ - 'use strict'; define([ diff --git a/app/scripts/models/verification/sign-up.js b/app/scripts/models/verification/sign-up.js index 429d0ddb9e..9896891566 100644 --- a/app/scripts/models/verification/sign-up.js +++ b/app/scripts/models/verification/sign-up.js @@ -5,7 +5,6 @@ /** * A model to hold sign up verification data */ - 'use strict'; define([ diff --git a/app/scripts/require_config.js b/app/scripts/require_config.js index 6fd5b3c040..96cf26ed26 100644 --- a/app/scripts/require_config.js +++ b/app/scripts/require_config.js @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + 'use strict'; require.config({ baseUrl: '/scripts', diff --git a/app/scripts/router.js b/app/scripts/router.js index 958abd5b87..24c90c3c2b 100644 --- a/app/scripts/router.js +++ b/app/scripts/router.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/base.js b/app/scripts/views/base.js index e1036af511..f0322c2ed5 100644 --- a/app/scripts/views/base.js +++ b/app/scripts/views/base.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -88,6 +87,7 @@ function (Cocktail, _, Backbone, $, p, AuthErrors, var BaseView = Backbone.View.extend({ constructor: function (options) { /*jshint maxcomplexity:10 */ + /*eslint complexity: [2, 10] */ options = options || {}; this.subviews = []; diff --git a/app/scripts/views/cannot_create_account.js b/app/scripts/views/cannot_create_account.js index a4db6cd948..287adfb9e1 100644 --- a/app/scripts/views/cannot_create_account.js +++ b/app/scripts/views/cannot_create_account.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/change_password.js b/app/scripts/views/change_password.js index 1043ca23ad..20f01c93a5 100644 --- a/app/scripts/views/change_password.js +++ b/app/scripts/views/change_password.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/clear_storage.js b/app/scripts/views/clear_storage.js index 8b606b486e..dc43bb7a2d 100644 --- a/app/scripts/views/clear_storage.js +++ b/app/scripts/views/clear_storage.js @@ -6,7 +6,6 @@ * This is a very small view to allow selenium tests * to clear browser storage state between tests. */ - 'use strict'; define([ diff --git a/app/scripts/views/close_button.js b/app/scripts/views/close_button.js index 4d55b8adab..81a42f0e73 100644 --- a/app/scripts/views/close_button.js +++ b/app/scripts/views/close_button.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; /** diff --git a/app/scripts/views/complete_account_unlock.js b/app/scripts/views/complete_account_unlock.js index 9b6c6e23e8..42c62abcd0 100644 --- a/app/scripts/views/complete_account_unlock.js +++ b/app/scripts/views/complete_account_unlock.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/complete_reset_password.js b/app/scripts/views/complete_reset_password.js index 710696a411..b6e4c5dd63 100644 --- a/app/scripts/views/complete_reset_password.js +++ b/app/scripts/views/complete_reset_password.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/complete_sign_up.js b/app/scripts/views/complete_sign_up.js index 6dcdd05ff4..4a4223f8af 100644 --- a/app/scripts/views/complete_sign_up.js +++ b/app/scripts/views/complete_sign_up.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/confirm.js b/app/scripts/views/confirm.js index e59c13426f..3e504a982f 100644 --- a/app/scripts/views/confirm.js +++ b/app/scripts/views/confirm.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/confirm_account_unlock.js b/app/scripts/views/confirm_account_unlock.js index edfd95abb2..622da69d21 100644 --- a/app/scripts/views/confirm_account_unlock.js +++ b/app/scripts/views/confirm_account_unlock.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/confirm_reset_password.js b/app/scripts/views/confirm_reset_password.js index df9c33b889..f70ac9ffb6 100644 --- a/app/scripts/views/confirm_reset_password.js +++ b/app/scripts/views/confirm_reset_password.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/cookies_disabled.js b/app/scripts/views/cookies_disabled.js index 73a6d5de2d..906a0f0aec 100644 --- a/app/scripts/views/cookies_disabled.js +++ b/app/scripts/views/cookies_disabled.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/coppa/coppa-date-picker.js b/app/scripts/views/coppa/coppa-date-picker.js index cecf0a6adf..5f32383411 100644 --- a/app/scripts/views/coppa/coppa-date-picker.js +++ b/app/scripts/views/coppa/coppa-date-picker.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/decorators/allow_only_one_submit.js b/app/scripts/views/decorators/allow_only_one_submit.js index ca96652639..4efeccf804 100644 --- a/app/scripts/views/decorators/allow_only_one_submit.js +++ b/app/scripts/views/decorators/allow_only_one_submit.js @@ -7,7 +7,6 @@ * * Requires the invokeHandler function. */ - 'use strict'; define([ diff --git a/app/scripts/views/decorators/progress_indicator.js b/app/scripts/views/decorators/progress_indicator.js index 134de6ed8f..125bab3739 100644 --- a/app/scripts/views/decorators/progress_indicator.js +++ b/app/scripts/views/decorators/progress_indicator.js @@ -11,7 +11,6 @@ * * Requires the invokeHandler function. */ - 'use strict'; define([ diff --git a/app/scripts/views/delete_account.js b/app/scripts/views/delete_account.js index ecb640e6f3..1a9e99d502 100644 --- a/app/scripts/views/delete_account.js +++ b/app/scripts/views/delete_account.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/force_auth.js b/app/scripts/views/force_auth.js index 3cff1e72e2..783d43c9c9 100644 --- a/app/scripts/views/force_auth.js +++ b/app/scripts/views/force_auth.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/form.js b/app/scripts/views/form.js index 5a39bd44d7..1806be7d29 100644 --- a/app/scripts/views/form.js +++ b/app/scripts/views/form.js @@ -16,7 +16,6 @@ * * See documentation for an explanation of each. */ - 'use strict'; define([ diff --git a/app/scripts/views/legal.js b/app/scripts/views/legal.js index a8327267c3..042fbb16fb 100644 --- a/app/scripts/views/legal.js +++ b/app/scripts/views/legal.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/legal_copy.js b/app/scripts/views/legal_copy.js index ef186bdfa0..640c7d21e7 100644 --- a/app/scripts/views/legal_copy.js +++ b/app/scripts/views/legal_copy.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/marketing_snippet.js b/app/scripts/views/marketing_snippet.js index 7873b33327..55dbdfc12c 100644 --- a/app/scripts/views/marketing_snippet.js +++ b/app/scripts/views/marketing_snippet.js @@ -8,7 +8,6 @@ * Shows `Get Sync on Firefox for Android` for users that complete * signup for sync in Firefox Desktop. */ - 'use strict'; define([ diff --git a/app/scripts/views/marketing_snippet_ios.js b/app/scripts/views/marketing_snippet_ios.js index b6444bf707..f42b9be541 100644 --- a/app/scripts/views/marketing_snippet_ios.js +++ b/app/scripts/views/marketing_snippet_ios.js @@ -8,7 +8,6 @@ * Shows `Get Sync on Firefox for Android` for users that complete * signup for sync in Firefox Desktop. */ - 'use strict'; define([ diff --git a/app/scripts/views/mixins/avatar-mixin.js b/app/scripts/views/mixins/avatar-mixin.js index 01765664b6..04b2e371fe 100644 --- a/app/scripts/views/mixins/avatar-mixin.js +++ b/app/scripts/views/mixins/avatar-mixin.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // helper functions for views with a profile image. Meant to be mixed into views. - 'use strict'; define([ diff --git a/app/scripts/views/mixins/back-mixin.js b/app/scripts/views/mixins/back-mixin.js index 864e64ac40..2893d1788b 100644 --- a/app/scripts/views/mixins/back-mixin.js +++ b/app/scripts/views/mixins/back-mixin.js @@ -7,7 +7,6 @@ * * @class BackMixin */ - 'use strict'; define([ diff --git a/app/scripts/views/mixins/checkbox-mixin.js b/app/scripts/views/mixins/checkbox-mixin.js index f682a88d17..472fed02b8 100644 --- a/app/scripts/views/mixins/checkbox-mixin.js +++ b/app/scripts/views/mixins/checkbox-mixin.js @@ -5,7 +5,6 @@ /** * Log when checkbox values are changed, if the checkbox has an id. */ - 'use strict'; define([ diff --git a/app/scripts/views/mixins/floating-placeholder-mixin.js b/app/scripts/views/mixins/floating-placeholder-mixin.js index 48e0235702..13a6d28328 100644 --- a/app/scripts/views/mixins/floating-placeholder-mixin.js +++ b/app/scripts/views/mixins/floating-placeholder-mixin.js @@ -4,7 +4,6 @@ // FormView plugin to convert a placeholder into a // floating label if the input changes. - 'use strict'; define([ diff --git a/app/scripts/views/mixins/marketing-mixin.js b/app/scripts/views/mixins/marketing-mixin.js index 9fe29f2dd6..74da2ead11 100644 --- a/app/scripts/views/mixins/marketing-mixin.js +++ b/app/scripts/views/mixins/marketing-mixin.js @@ -6,7 +6,6 @@ * A view mixin that takes care of logging marketing impressions * and clicks. */ - 'use strict'; define([ diff --git a/app/scripts/views/mixins/password-mixin.js b/app/scripts/views/mixins/password-mixin.js index b08580c59e..7a326ed032 100644 --- a/app/scripts/views/mixins/password-mixin.js +++ b/app/scripts/views/mixins/password-mixin.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // helper functions for views with passwords. Meant to be mixed into views. - 'use strict'; define([ diff --git a/app/scripts/views/mixins/resend-mixin.js b/app/scripts/views/mixins/resend-mixin.js index 677d97caf4..85b2bef82c 100644 --- a/app/scripts/views/mixins/resend-mixin.js +++ b/app/scripts/views/mixins/resend-mixin.js @@ -4,7 +4,6 @@ // helper functions for views with passwords. Meant to be mixed into views. // Note, this mixin overrides beforeSubmit and is incompatible with Cocktail. - 'use strict'; define([ diff --git a/app/scripts/views/mixins/service-mixin.js b/app/scripts/views/mixins/service-mixin.js index 96f7610f3b..b3f4434a0d 100644 --- a/app/scripts/views/mixins/service-mixin.js +++ b/app/scripts/views/mixins/service-mixin.js @@ -4,7 +4,6 @@ // The service-mixin is used in views that know about services, which is mostly // OAuth services but also Sync. - 'use strict'; define([ diff --git a/app/scripts/views/mixins/settings-mixin.js b/app/scripts/views/mixins/settings-mixin.js index c948be9183..eb8bc7656b 100644 --- a/app/scripts/views/mixins/settings-mixin.js +++ b/app/scripts/views/mixins/settings-mixin.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // helper functions for views with a profile image. Meant to be mixed into views. - 'use strict'; define([ diff --git a/app/scripts/views/mixins/timer-mixin.js b/app/scripts/views/mixins/timer-mixin.js index 394f76b262..fc673b0ed9 100644 --- a/app/scripts/views/mixins/timer-mixin.js +++ b/app/scripts/views/mixins/timer-mixin.js @@ -9,10 +9,8 @@ * callbacks passed to setTimeout will be called in the context of * the view. */ - 'use strict'; - define([ 'underscore' ], diff --git a/app/scripts/views/permissions.js b/app/scripts/views/permissions.js index 605a74e4e0..5c6db3eece 100644 --- a/app/scripts/views/permissions.js +++ b/app/scripts/views/permissions.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/pp.js b/app/scripts/views/pp.js index cdb3c66a70..3e81d1d254 100644 --- a/app/scripts/views/pp.js +++ b/app/scripts/views/pp.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/ready.js b/app/scripts/views/ready.js index 1695fdc213..8d2461d944 100644 --- a/app/scripts/views/ready.js +++ b/app/scripts/views/ready.js @@ -6,7 +6,6 @@ * Prints a message to the user that says * "All ready! You can go visit {{ service }}" */ - 'use strict'; define([ diff --git a/app/scripts/views/reset_password.js b/app/scripts/views/reset_password.js index 7575271f90..ee6827ffdf 100644 --- a/app/scripts/views/reset_password.js +++ b/app/scripts/views/reset_password.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/settings.js b/app/scripts/views/settings.js index 8d99c1e403..90758e4712 100644 --- a/app/scripts/views/settings.js +++ b/app/scripts/views/settings.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/settings/avatar.js b/app/scripts/views/settings/avatar.js index 79310fba89..8e7225f56a 100644 --- a/app/scripts/views/settings/avatar.js +++ b/app/scripts/views/settings/avatar.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/settings/avatar_camera.js b/app/scripts/views/settings/avatar_camera.js index e395fbafe2..db8a879a77 100644 --- a/app/scripts/views/settings/avatar_camera.js +++ b/app/scripts/views/settings/avatar_camera.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; /* exceptsPaths: canvasToBlob */ diff --git a/app/scripts/views/settings/avatar_change.js b/app/scripts/views/settings/avatar_change.js index 3a09545379..2e3c268343 100644 --- a/app/scripts/views/settings/avatar_change.js +++ b/app/scripts/views/settings/avatar_change.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/settings/avatar_crop.js b/app/scripts/views/settings/avatar_crop.js index 82752450f0..24d570db11 100644 --- a/app/scripts/views/settings/avatar_crop.js +++ b/app/scripts/views/settings/avatar_crop.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/settings/avatar_gravatar.js b/app/scripts/views/settings/avatar_gravatar.js index aa3927f859..5de547cb17 100644 --- a/app/scripts/views/settings/avatar_gravatar.js +++ b/app/scripts/views/settings/avatar_gravatar.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/settings/communication_preferences.js b/app/scripts/views/settings/communication_preferences.js index 9fa526ef93..a054d8b822 100644 --- a/app/scripts/views/settings/communication_preferences.js +++ b/app/scripts/views/settings/communication_preferences.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/sign_in.js b/app/scripts/views/sign_in.js index 8e927426fc..fa138815bd 100644 --- a/app/scripts/views/sign_in.js +++ b/app/scripts/views/sign_in.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/sign_up.js b/app/scripts/views/sign_up.js index 3cf0ba78cf..f773dfe846 100644 --- a/app/scripts/views/sign_up.js +++ b/app/scripts/views/sign_up.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/tooltip.js b/app/scripts/views/tooltip.js index b47e732374..5403579d6e 100644 --- a/app/scripts/views/tooltip.js +++ b/app/scripts/views/tooltip.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // It's a tooltip! - 'use strict'; define([ diff --git a/app/scripts/views/tos.js b/app/scripts/views/tos.js index 0448d93d76..80e99b5e42 100644 --- a/app/scripts/views/tos.js +++ b/app/scripts/views/tos.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/scripts/views/unexpected_error.js b/app/scripts/views/unexpected_error.js index ae4bc5a6cd..4db7225ba6 100644 --- a/app/scripts/views/unexpected_error.js +++ b/app/scripts/views/unexpected_error.js @@ -6,7 +6,6 @@ * This is a very small view to allow selenium tests * to clear browser storage state between tests. */ - 'use strict'; define([ diff --git a/app/tests/lib/blanket_lcov.js b/app/tests/lib/blanket_lcov.js index b56dd382ac..82d43e850e 100644 --- a/app/tests/lib/blanket_lcov.js +++ b/app/tests/lib/blanket_lcov.js @@ -5,7 +5,6 @@ /** * Based on bower_components/blanket/src/reporters/lcov_reporter.js */ - 'use strict'; //lcov_reporter diff --git a/app/tests/lib/helpers.js b/app/tests/lib/helpers.js index 5f83e33415..8c32a03e6a 100644 --- a/app/tests/lib/helpers.js +++ b/app/tests/lib/helpers.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/mocks/crosstab.js b/app/tests/mocks/crosstab.js index 7cb87752ea..0b19c9b93e 100644 --- a/app/tests/mocks/crosstab.js +++ b/app/tests/mocks/crosstab.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -35,6 +34,3 @@ define([ return CrossTabMock; }; }); - - - diff --git a/app/tests/spec/head/startup-styles.js b/app/tests/spec/head/startup-styles.js index a96f181198..ee1e067f0c 100644 --- a/app/tests/spec/head/startup-styles.js +++ b/app/tests/spec/head/startup-styles.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/lib/able.js b/app/tests/spec/lib/able.js index 4b8cf842f2..70038ec9e8 100644 --- a/app/tests/spec/lib/able.js +++ b/app/tests/spec/lib/able.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/app-start.js b/app/tests/spec/lib/app-start.js index d5ac4e157e..aa4e9ef1ed 100644 --- a/app/tests/spec/lib/app-start.js +++ b/app/tests/spec/lib/app-start.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/assertion.js b/app/tests/spec/lib/assertion.js index 0aade96a47..51cb57ed37 100644 --- a/app/tests/spec/lib/assertion.js +++ b/app/tests/spec/lib/assertion.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - /* exceptsPaths: vendor/jwcrypto/lib/algs/rs */ define([ 'chai', diff --git a/app/tests/spec/lib/base64url.js b/app/tests/spec/lib/base64url.js index 3c8a3543fc..f5c2ba7982 100644 --- a/app/tests/spec/lib/base64url.js +++ b/app/tests/spec/lib/base64url.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/lib/channels/duplex.js b/app/tests/spec/lib/channels/duplex.js index f749ff353f..c32cbdbcfe 100644 --- a/app/tests/spec/lib/channels/duplex.js +++ b/app/tests/spec/lib/channels/duplex.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/channels/fx-desktop.js b/app/tests/spec/lib/channels/fx-desktop.js index b49cfcb34f..4698e746b5 100644 --- a/app/tests/spec/lib/channels/fx-desktop.js +++ b/app/tests/spec/lib/channels/fx-desktop.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/channels/iframe.js b/app/tests/spec/lib/channels/iframe.js index b7edb3396c..aa7afe2a6d 100644 --- a/app/tests/spec/lib/channels/iframe.js +++ b/app/tests/spec/lib/channels/iframe.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/channels/inter-tab.js b/app/tests/spec/lib/channels/inter-tab.js index 919b8c48b7..1965f9f836 100644 --- a/app/tests/spec/lib/channels/inter-tab.js +++ b/app/tests/spec/lib/channels/inter-tab.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/lib/channels/null.js b/app/tests/spec/lib/channels/null.js index 856c4943f9..bbd076fd93 100644 --- a/app/tests/spec/lib/channels/null.js +++ b/app/tests/spec/lib/channels/null.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/lib/channels/receivers/web-channel.js b/app/tests/spec/lib/channels/receivers/web-channel.js index f5f2f9e9d6..9a99dfaa19 100644 --- a/app/tests/spec/lib/channels/receivers/web-channel.js +++ b/app/tests/spec/lib/channels/receivers/web-channel.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/channels/senders/web-channel.js b/app/tests/spec/lib/channels/senders/web-channel.js index 9629a561c6..97a2038978 100644 --- a/app/tests/spec/lib/channels/senders/web-channel.js +++ b/app/tests/spec/lib/channels/senders/web-channel.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/channels/web.js b/app/tests/spec/lib/channels/web.js index 365af542d7..0597b25bfa 100644 --- a/app/tests/spec/lib/channels/web.js +++ b/app/tests/spec/lib/channels/web.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -31,7 +29,7 @@ function (chai, sinon, WebChannel, WindowMock) { it('requires an id', function () { assert.throws(function () { - new WebChannel(); + new WebChannel();//eslint-disable-line no-new }, 'WebChannel must have an id'); }); diff --git a/app/tests/spec/lib/cropper.js b/app/tests/spec/lib/cropper.js index 1e0dbb21dd..6afcafb7a1 100644 --- a/app/tests/spec/lib/cropper.js +++ b/app/tests/spec/lib/cropper.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', '../../mocks/router', diff --git a/app/tests/spec/lib/environment.js b/app/tests/spec/lib/environment.js index 518ff5a7db..bfe3d1b2ef 100644 --- a/app/tests/spec/lib/environment.js +++ b/app/tests/spec/lib/environment.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/lib/null-storage.js b/app/tests/spec/lib/null-storage.js index 4ffc5e9949..2cf59e7c50 100644 --- a/app/tests/spec/lib/null-storage.js +++ b/app/tests/spec/lib/null-storage.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/null-storage' diff --git a/app/tests/spec/lib/oauth-client.js b/app/tests/spec/lib/oauth-client.js index 1f33387bac..613bc0d274 100644 --- a/app/tests/spec/lib/oauth-client.js +++ b/app/tests/spec/lib/oauth-client.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/profile-client.js b/app/tests/spec/lib/profile-client.js index c40fe18129..5249b78f0f 100644 --- a/app/tests/spec/lib/profile-client.js +++ b/app/tests/spec/lib/profile-client.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/relier-keys.js b/app/tests/spec/lib/relier-keys.js index 519fa22092..866ef5d9f1 100644 --- a/app/tests/spec/lib/relier-keys.js +++ b/app/tests/spec/lib/relier-keys.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/relier-keys' diff --git a/app/tests/spec/lib/resume-token.js b/app/tests/spec/lib/resume-token.js index 3f16887a3a..33fbde98af 100644 --- a/app/tests/spec/lib/resume-token.js +++ b/app/tests/spec/lib/resume-token.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/resume-token' diff --git a/app/tests/spec/lib/router.js b/app/tests/spec/lib/router.js index 9cbf91c5c4..4a12abd5b5 100644 --- a/app/tests/spec/lib/router.js +++ b/app/tests/spec/lib/router.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/service-name.js b/app/tests/spec/lib/service-name.js index b85ac3c8fd..07f4cff518 100644 --- a/app/tests/spec/lib/service-name.js +++ b/app/tests/spec/lib/service-name.js @@ -3,10 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // test the service-name library - 'use strict'; - define([ 'chai', 'lib/translator', diff --git a/app/tests/spec/lib/session.js b/app/tests/spec/lib/session.js index bb07d3c50f..c6f64b7188 100644 --- a/app/tests/spec/lib/session.js +++ b/app/tests/spec/lib/session.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/session' diff --git a/app/tests/spec/lib/storage.js b/app/tests/spec/lib/storage.js index f11685beed..4fce89c20e 100644 --- a/app/tests/spec/lib/storage.js +++ b/app/tests/spec/lib/storage.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/lib/strings.js b/app/tests/spec/lib/strings.js index 4130e4bef3..d2335bebd2 100644 --- a/app/tests/spec/lib/strings.js +++ b/app/tests/spec/lib/strings.js @@ -3,10 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // test the interpolated library - 'use strict'; - define([ 'chai', 'lib/strings' diff --git a/app/tests/spec/lib/translator.js b/app/tests/spec/lib/translator.js index a3fe9ab32d..2dbe08e6bc 100644 --- a/app/tests/spec/lib/translator.js +++ b/app/tests/spec/lib/translator.js @@ -3,10 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // test the translation library - 'use strict'; - define([ 'chai', 'lib/translator' diff --git a/app/tests/spec/lib/url.js b/app/tests/spec/lib/url.js index 9c0e3d7d21..1ad3d99530 100644 --- a/app/tests/spec/lib/url.js +++ b/app/tests/spec/lib/url.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/url' diff --git a/app/tests/spec/lib/xhr.js b/app/tests/spec/lib/xhr.js index 221ca92082..8cb758fdb6 100644 --- a/app/tests/spec/lib/xhr.js +++ b/app/tests/spec/lib/xhr.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -12,8 +11,7 @@ define([ 'lib/xhr', 'lib/promise' ], -function (chai, sinon, $, _, Xhr, p, undefined) { - +function (chai, sinon, $, _, Xhr, p) { var assert = chai.assert; var xhr; diff --git a/app/tests/spec/lib/xss.js b/app/tests/spec/lib/xss.js index d07fee44e3..ed81f7e49b 100644 --- a/app/tests/spec/lib/xss.js +++ b/app/tests/spec/lib/xss.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'underscore', @@ -39,7 +37,9 @@ function (chai, _, XSS, Constants) { }); it('disallows javascript: href', function () { - expectEmpty('javascript:alert(1)'); // jshint ignore:line + /*eslint-disable */ + expectEmpty('javascript:alert(1)'); // jshint ignore:line + /*eslint-enable */ }); it('disallows href without a scheme', function () { diff --git a/app/tests/spec/models/account.js b/app/tests/spec/models/account.js index 5a35d12811..6fe0289a59 100644 --- a/app/tests/spec/models/account.js +++ b/app/tests/spec/models/account.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/auth_brokers/base.js b/app/tests/spec/models/auth_brokers/base.js index cdf32f39b1..3a5ecf4526 100644 --- a/app/tests/spec/models/auth_brokers/base.js +++ b/app/tests/spec/models/auth_brokers/base.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/auth_brokers/fx-desktop-v2.js b/app/tests/spec/models/auth_brokers/fx-desktop-v2.js index 1f2d13722c..60c74ed510 100644 --- a/app/tests/spec/models/auth_brokers/fx-desktop-v2.js +++ b/app/tests/spec/models/auth_brokers/fx-desktop-v2.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/auth_brokers/fx-desktop.js b/app/tests/spec/models/auth_brokers/fx-desktop.js index 9c79862dec..5320281c53 100644 --- a/app/tests/spec/models/auth_brokers/fx-desktop.js +++ b/app/tests/spec/models/auth_brokers/fx-desktop.js @@ -1,8 +1,6 @@ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/auth_brokers/iframe.js b/app/tests/spec/models/auth_brokers/iframe.js index bbf9fd9c5c..71cf94fee5 100644 --- a/app/tests/spec/models/auth_brokers/iframe.js +++ b/app/tests/spec/models/auth_brokers/iframe.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/auth_brokers/oauth.js b/app/tests/spec/models/auth_brokers/oauth.js index a3afb854db..83ad6e87a1 100644 --- a/app/tests/spec/models/auth_brokers/oauth.js +++ b/app/tests/spec/models/auth_brokers/oauth.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/auth_brokers/redirect.js b/app/tests/spec/models/auth_brokers/redirect.js index 13ec671543..638cdf1072 100644 --- a/app/tests/spec/models/auth_brokers/redirect.js +++ b/app/tests/spec/models/auth_brokers/redirect.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/auth_brokers/web-channel.js b/app/tests/spec/models/auth_brokers/web-channel.js index 3d2b8ba43e..3b2ae2268f 100644 --- a/app/tests/spec/models/auth_brokers/web-channel.js +++ b/app/tests/spec/models/auth_brokers/web-channel.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/form-prefill.js b/app/tests/spec/models/form-prefill.js index 3c667c789c..7b0e3c99ed 100644 --- a/app/tests/spec/models/form-prefill.js +++ b/app/tests/spec/models/form-prefill.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -17,6 +16,3 @@ define([ }); }); }); - - - diff --git a/app/tests/spec/models/marketing-email-prefs.js b/app/tests/spec/models/marketing-email-prefs.js index a9bcbb855b..438146f7db 100644 --- a/app/tests/spec/models/marketing-email-prefs.js +++ b/app/tests/spec/models/marketing-email-prefs.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/mixins/search-param.js b/app/tests/spec/models/mixins/search-param.js index b2c6c71148..afff316ccc 100644 --- a/app/tests/spec/models/mixins/search-param.js +++ b/app/tests/spec/models/mixins/search-param.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/notifications.js b/app/tests/spec/models/notifications.js index 964fdd0fb9..a393b979a2 100644 --- a/app/tests/spec/models/notifications.js +++ b/app/tests/spec/models/notifications.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/oauth-token.js b/app/tests/spec/models/oauth-token.js index f6d387edf3..11f7db214d 100644 --- a/app/tests/spec/models/oauth-token.js +++ b/app/tests/spec/models/oauth-token.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', diff --git a/app/tests/spec/models/profile-image.js b/app/tests/spec/models/profile-image.js index 4b3974f7ab..bc835972c6 100644 --- a/app/tests/spec/models/profile-image.js +++ b/app/tests/spec/models/profile-image.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/profile-errors', diff --git a/app/tests/spec/models/reliers/base.js b/app/tests/spec/models/reliers/base.js index e17b3d5b5f..312519fcb1 100644 --- a/app/tests/spec/models/reliers/base.js +++ b/app/tests/spec/models/reliers/base.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/reliers/fx-desktop.js b/app/tests/spec/models/reliers/fx-desktop.js index 82e4c68c98..6fcced6f94 100644 --- a/app/tests/spec/models/reliers/fx-desktop.js +++ b/app/tests/spec/models/reliers/fx-desktop.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/reliers/oauth.js b/app/tests/spec/models/reliers/oauth.js index 1bbb493f23..79fb6d0bed 100644 --- a/app/tests/spec/models/reliers/oauth.js +++ b/app/tests/spec/models/reliers/oauth.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/reliers/relier.js b/app/tests/spec/models/reliers/relier.js index 281377016e..9434aa60a7 100644 --- a/app/tests/spec/models/reliers/relier.js +++ b/app/tests/spec/models/reliers/relier.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/user.js b/app/tests/spec/models/user.js index dfef326f7e..cddc970181 100644 --- a/app/tests/spec/models/user.js +++ b/app/tests/spec/models/user.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; diff --git a/app/tests/spec/models/verification/base.js b/app/tests/spec/models/verification/base.js index 03ec716147..ff56247b44 100644 --- a/app/tests/spec/models/verification/base.js +++ b/app/tests/spec/models/verification/base.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/verification/reset-password.js b/app/tests/spec/models/verification/reset-password.js index a2e513ecde..afa794afa7 100644 --- a/app/tests/spec/models/verification/reset-password.js +++ b/app/tests/spec/models/verification/reset-password.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/models/verification/sign-up.js b/app/tests/spec/models/verification/sign-up.js index c8ebb965c1..4a7b43f01b 100644 --- a/app/tests/spec/models/verification/sign-up.js +++ b/app/tests/spec/models/verification/sign-up.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/views/base.js b/app/tests/spec/views/base.js index 4c6a1978a5..56bfd79231 100644 --- a/app/tests/spec/views/base.js +++ b/app/tests/spec/views/base.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -16,7 +14,6 @@ define([ 'lib/metrics', 'lib/auth-errors', 'lib/fxa-client', - 'models/reliers/relier', 'models/user', 'stache!templates/test_template', '../../mocks/dom-event', @@ -25,7 +22,7 @@ define([ '../../lib/helpers' ], function (chai, $, sinon, BaseView, p, Translator, EphemeralMessages, Metrics, - AuthErrors, FxaClient, Relier, User, Template, DOMEventMock, RouterMock, + AuthErrors, FxaClient, User, Template, DOMEventMock, RouterMock, WindowMock, TestHelpers) { var requiresFocus = TestHelpers.requiresFocus; var wrapAssertion = TestHelpers.wrapAssertion; @@ -40,7 +37,6 @@ function (chai, $, sinon, BaseView, p, Translator, EphemeralMessages, Metrics, var translator; var metrics; var fxaClient; - var relier; var user; var screenName = 'screen'; @@ -60,7 +56,6 @@ function (chai, $, sinon, BaseView, p, Translator, EphemeralMessages, Metrics, windowMock = new WindowMock(); ephemeralMessages = new EphemeralMessages(); metrics = new Metrics(); - relier = new Relier(); fxaClient = new FxaClient(); user = new User(); @@ -596,4 +591,3 @@ function (chai, $, sinon, BaseView, p, Translator, EphemeralMessages, Metrics, }); }); }); - diff --git a/app/tests/spec/views/cannot_create_account.js b/app/tests/spec/views/cannot_create_account.js index 0d18ff9a62..e78f73fae3 100644 --- a/app/tests/spec/views/cannot_create_account.js +++ b/app/tests/spec/views/cannot_create_account.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -55,5 +53,3 @@ function (chai, sinon, View, Relier) { }); }); }); - - diff --git a/app/tests/spec/views/change_password.js b/app/tests/spec/views/change_password.js index 0dbc503766..caa1c76bf2 100644 --- a/app/tests/spec/views/change_password.js +++ b/app/tests/spec/views/change_password.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -218,5 +216,3 @@ function (chai, $, sinon, AuthErrors, FxaClient, Metrics, p, }); }); }); - - diff --git a/app/tests/spec/views/clear_storage.js b/app/tests/spec/views/clear_storage.js index a8474b761b..1e5661ee66 100644 --- a/app/tests/spec/views/clear_storage.js +++ b/app/tests/spec/views/clear_storage.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'views/clear_storage' diff --git a/app/tests/spec/views/close_button.js b/app/tests/spec/views/close_button.js index 141691b19b..8dd0a0c22d 100644 --- a/app/tests/spec/views/close_button.js +++ b/app/tests/spec/views/close_button.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -98,5 +96,3 @@ function (chai, sinon, $, WindowMock, TestHelpers, p, Metrics, }); }); }); - - diff --git a/app/tests/spec/views/complete_account_unlock.js b/app/tests/spec/views/complete_account_unlock.js index d1f2aa74a3..00854df5cb 100644 --- a/app/tests/spec/views/complete_account_unlock.js +++ b/app/tests/spec/views/complete_account_unlock.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -36,7 +34,6 @@ function (chai, sinon, p, View, AuthErrors, Metrics, Constants, FxaClient, var relier; var broker; var user; - var account; var validCode = TestHelpers.createRandomHexString(Constants.CODE_LENGTH); var invalidCode = TestHelpers.createRandomHexString(Constants.CODE_LENGTH - 1); var validUid = TestHelpers.createRandomHexString(Constants.UID_LENGTH); @@ -98,12 +95,6 @@ function (chai, sinon, p, View, AuthErrors, Metrics, Constants, FxaClient, } }); - account = user.initAccount({ - sessionToken: 'foo', - email: 'a@a.com', - uid: validUid - }); - initView(); }); @@ -224,6 +215,3 @@ function (chai, sinon, p, View, AuthErrors, Metrics, Constants, FxaClient, }); }); }); - - - diff --git a/app/tests/spec/views/complete_reset_password.js b/app/tests/spec/views/complete_reset_password.js index 9d747d8795..ea94a746c1 100644 --- a/app/tests/spec/views/complete_reset_password.js +++ b/app/tests/spec/views/complete_reset_password.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -273,7 +271,6 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, }); it('non-direct-access signs the user in and redirects to `/reset_password_complete` if broker does not say halt', function () { - var account; view.$('[type=password]').val(PASSWORD); sinon.stub(fxaClient, 'signIn', function () { @@ -283,8 +280,7 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, return p(true); }); sinon.stub(user, 'setSignedInAccount', function (newAccount) { - account = newAccount; - return p(account); + return p(newAccount); }); sinon.spy(broker, 'afterCompleteResetPassword'); sinon.stub(relier, 'isDirectAccess', function () { @@ -309,15 +305,16 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, } )); assert.equal(routerMock.page, 'reset_password_complete'); - assert.isTrue(broker.afterCompleteResetPassword.calledWith(account)); assert.isTrue(loginSpy.called); assert.isTrue(TestHelpers.isEventLogged( metrics, 'complete_reset_password.verification.success')); + return user.setSignedInAccount.returnValues[0].then(function (returnValue) { + assert.isTrue(broker.afterCompleteResetPassword.calledWith(returnValue)); + }); }); }); it('direct access signs the user in and redirects to `/settings` if broker does not say halt', function () { - var account; view.$('[type=password]').val(PASSWORD); sinon.stub(fxaClient, 'signIn', function () { @@ -327,8 +324,7 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, return p(true); }); sinon.stub(user, 'setSignedInAccount', function (newAccount) { - account = newAccount; - return p(account); + return p(newAccount); }); sinon.stub(relier, 'isDirectAccess', function () { return true; @@ -340,9 +336,7 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, }); }); - it('halts if the broker says halt', function () { - var account; view.$('[type=password]').val(PASSWORD); sinon.stub(fxaClient, 'signIn', function () { @@ -352,8 +346,7 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, return p(true); }); sinon.stub(user, 'setSignedInAccount', function (newAccount) { - account = newAccount; - return p(account); + return p(newAccount); }); sinon.stub(broker, 'afterCompleteResetPassword', function () { return p({ halt: true }); @@ -372,7 +365,9 @@ function (chai, sinon, p, AuthErrors, Metrics, FxaClient, InterTabChannel, } )); assert.notEqual(routerMock.page, 'reset_password_complete'); - assert.isTrue(broker.afterCompleteResetPassword.calledWith(account)); + return user.setSignedInAccount.returnValues[0].then(function (returnValue) { + assert.isTrue(broker.afterCompleteResetPassword.calledWith(returnValue)); + }); }); }); diff --git a/app/tests/spec/views/complete_sign_up.js b/app/tests/spec/views/complete_sign_up.js index e2b61c00e3..cdc59fec5d 100644 --- a/app/tests/spec/views/complete_sign_up.js +++ b/app/tests/spec/views/complete_sign_up.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -378,6 +376,3 @@ function (chai, sinon, p, View, AuthErrors, Metrics, Constants, }); }); }); - - - diff --git a/app/tests/spec/views/confirm_account_unlock.js b/app/tests/spec/views/confirm_account_unlock.js index b63d5902a6..a772b128fd 100644 --- a/app/tests/spec/views/confirm_account_unlock.js +++ b/app/tests/spec/views/confirm_account_unlock.js @@ -177,7 +177,6 @@ function (chai, sinon, p, Session, AuthErrors, Metrics, FxaClient, }); }); - it('if caused by a signin, redirects to `/account_unlock_complete` if broker does not halt', function () { sinon.stub(fxaClient, 'signIn', function () { return p({ diff --git a/app/tests/spec/views/confirm_reset_password.js b/app/tests/spec/views/confirm_reset_password.js index 1c3c8a7b19..3468960a87 100644 --- a/app/tests/spec/views/confirm_reset_password.js +++ b/app/tests/spec/views/confirm_reset_password.js @@ -257,7 +257,6 @@ function (chai, sinon, p, AuthErrors, View, Metrics, EphemeralMessages, }, done); }); - view.render(); }); diff --git a/app/tests/spec/views/cookies_disabled.js b/app/tests/spec/views/cookies_disabled.js index 5726dae817..c10f959255 100644 --- a/app/tests/spec/views/cookies_disabled.js +++ b/app/tests/spec/views/cookies_disabled.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'jquery', 'chai', @@ -86,4 +84,3 @@ function ($, chai, sinon, View, WindowMock) { }); }); - diff --git a/app/tests/spec/views/coppa/coppa-date-picker.js b/app/tests/spec/views/coppa/coppa-date-picker.js index 3af41c0f8c..9e20844451 100644 --- a/app/tests/spec/views/coppa/coppa-date-picker.js +++ b/app/tests/spec/views/coppa/coppa-date-picker.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -254,5 +252,3 @@ function (chai, $, moment, sinon, View, FormPrefill) { }); }); }); - - diff --git a/app/tests/spec/views/delete_account.js b/app/tests/spec/views/delete_account.js index efb919bb1c..b80a39a922 100644 --- a/app/tests/spec/views/delete_account.js +++ b/app/tests/spec/views/delete_account.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -47,7 +45,6 @@ function (chai, $, sinon, View, FxaClient, p, AuthErrors, Metrics, user = new User(); metrics = new Metrics(); - view = new View({ router: routerMock, fxaClient: fxaClient, @@ -189,5 +186,3 @@ function (chai, $, sinon, View, FxaClient, p, AuthErrors, Metrics, }); }); }); - - diff --git a/app/tests/spec/views/force_auth.js b/app/tests/spec/views/force_auth.js index ab796bbb6a..fbcb5ca7e2 100644 --- a/app/tests/spec/views/force_auth.js +++ b/app/tests/spec/views/force_auth.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -62,7 +60,6 @@ function (chai, $, sinon, View, FxaClient, p, AuthErrors, Relier, Broker, router = view = null; }); - describe('missing email address', function () { beforeEach(function () { initDeps(); @@ -74,7 +71,6 @@ function (chai, $, sinon, View, FxaClient, p, AuthErrors, Relier, Broker, }); }); - describe('with registered email', function () { beforeEach(function () { initDeps(); @@ -292,5 +288,3 @@ function (chai, $, sinon, View, FxaClient, p, AuthErrors, Relier, Broker, }); }); }); - - diff --git a/app/tests/spec/views/form.js b/app/tests/spec/views/form.js index ff2c83954b..041cea8c05 100644 --- a/app/tests/spec/views/form.js +++ b/app/tests/spec/views/form.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -711,4 +709,3 @@ function (chai, sinon, $, p, FormView, Template, Constants, Metrics, AuthErrors, }); }); }); - diff --git a/app/tests/spec/views/marketing_snippet.js b/app/tests/spec/views/marketing_snippet.js index 5b1efcf801..98f4a9e6b5 100644 --- a/app/tests/spec/views/marketing_snippet.js +++ b/app/tests/spec/views/marketing_snippet.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'views/marketing_snippet', @@ -127,7 +125,6 @@ function (chai, View, Metrics, WindowMock) { }); - describe('a click on the marketing material', function () { it('is logged', function () { createView({ @@ -149,6 +146,3 @@ function (chai, View, Metrics, WindowMock) { }); }); }); - - - diff --git a/app/tests/spec/views/marketing_snippet_ios.js b/app/tests/spec/views/marketing_snippet_ios.js index 66cefaee21..eb1cf308a6 100644 --- a/app/tests/spec/views/marketing_snippet_ios.js +++ b/app/tests/spec/views/marketing_snippet_ios.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -133,7 +131,6 @@ function (chai, sinon, View, Able, Metrics, WindowMock) { }); }); - describe('a click on the marketing material', function () { it('is logged', function () { createView(); @@ -151,6 +148,3 @@ function (chai, sinon, View, Able, Metrics, WindowMock) { }); }); }); - - - diff --git a/app/tests/spec/views/mixins/account-locked-mixin.js b/app/tests/spec/views/mixins/account-locked-mixin.js index 4c78d9bcbb..fba3b128e2 100644 --- a/app/tests/spec/views/mixins/account-locked-mixin.js +++ b/app/tests/spec/views/mixins/account-locked-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/views/mixins/avatar-mixin.js b/app/tests/spec/views/mixins/avatar-mixin.js index cbe865be33..457b4cf9a1 100644 --- a/app/tests/spec/views/mixins/avatar-mixin.js +++ b/app/tests/spec/views/mixins/avatar-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/views/mixins/back-mixin.js b/app/tests/spec/views/mixins/back-mixin.js index 32c59ca69a..da4d863682 100644 --- a/app/tests/spec/views/mixins/back-mixin.js +++ b/app/tests/spec/views/mixins/back-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -33,7 +32,6 @@ define([ window: windowMock }); - return view.render(); }); @@ -71,4 +69,3 @@ define([ }); }); }); - diff --git a/app/tests/spec/views/mixins/checkbox-mixin.js b/app/tests/spec/views/mixins/checkbox-mixin.js index 18364a51eb..0a277e32a5 100644 --- a/app/tests/spec/views/mixins/checkbox-mixin.js +++ b/app/tests/spec/views/mixins/checkbox-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/views/mixins/floating-placeholder-mixin.js b/app/tests/spec/views/mixins/floating-placeholder-mixin.js index 9d2ebd65d8..fd2440c05e 100644 --- a/app/tests/spec/views/mixins/floating-placeholder-mixin.js +++ b/app/tests/spec/views/mixins/floating-placeholder-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -56,6 +55,3 @@ define([ }); }); }); - - - diff --git a/app/tests/spec/views/mixins/loading-mixin.js b/app/tests/spec/views/mixins/loading-mixin.js index dc1ce309a6..012fc7c9fc 100644 --- a/app/tests/spec/views/mixins/loading-mixin.js +++ b/app/tests/spec/views/mixins/loading-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -25,7 +24,6 @@ define([ ); describe('views/mixins/loading-mixin', function () { - var view; var windowMock; beforeEach(function () { @@ -33,7 +31,7 @@ define([ windowMock = new WindowMock(); - view = new View({ + void new View({ screenName: 'loading-view', window: windowMock }); diff --git a/app/tests/spec/views/mixins/password-mixin.js b/app/tests/spec/views/mixins/password-mixin.js index 44a8e8832c..d6e6d7a78a 100644 --- a/app/tests/spec/views/mixins/password-mixin.js +++ b/app/tests/spec/views/mixins/password-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -109,7 +108,6 @@ define([ assert.isFalse(TestHelpers.isEventLogged(metrics, 'password-screen.password.hidden')); - view.$('.show-password').click(); assert.isTrue(TestHelpers.isEventLogged(metrics, 'password-screen.password.hidden')); @@ -117,4 +115,3 @@ define([ }); }); }); - diff --git a/app/tests/spec/views/mixins/service-mixin.js b/app/tests/spec/views/mixins/service-mixin.js index c1fb00b915..dc1c5eecbe 100644 --- a/app/tests/spec/views/mixins/service-mixin.js +++ b/app/tests/spec/views/mixins/service-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -47,7 +46,6 @@ define([ broker: broker }); - return view.render(); }); @@ -84,4 +82,3 @@ define([ }); }); }); - diff --git a/app/tests/spec/views/mixins/timer-mixin.js b/app/tests/spec/views/mixins/timer-mixin.js index adb377ab79..079cbf2951 100644 --- a/app/tests/spec/views/mixins/timer-mixin.js +++ b/app/tests/spec/views/mixins/timer-mixin.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/views/oauth_sign_in.js b/app/tests/spec/views/oauth_sign_in.js index 8fc686ccb4..8d65b3dcf4 100644 --- a/app/tests/spec/views/oauth_sign_in.js +++ b/app/tests/spec/views/oauth_sign_in.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -147,5 +146,3 @@ function (chai, $, sinon, View, Session, FxaClient, p, Metrics, OAuthRelier, }); }); }); - - diff --git a/app/tests/spec/views/oauth_sign_up.js b/app/tests/spec/views/oauth_sign_up.js index 831a25bd68..3ce36950db 100644 --- a/app/tests/spec/views/oauth_sign_up.js +++ b/app/tests/spec/views/oauth_sign_up.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ @@ -259,5 +258,3 @@ function (chai, $, sinon, View, p, Session, FxaClient, Metrics, OAuthClient, }); }); }); - - diff --git a/app/tests/spec/views/permissions.js b/app/tests/spec/views/permissions.js index 4ff2fe4c5b..56cba09040 100644 --- a/app/tests/spec/views/permissions.js +++ b/app/tests/spec/views/permissions.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -27,7 +25,6 @@ function (chai, $, sinon, p, View, Metrics, FxaClient, EphemeralMessages, describe('views/permissions', function () { var view; - var email; var routerMock; var metrics; var windowMock; @@ -35,17 +32,16 @@ function (chai, $, sinon, p, View, Metrics, FxaClient, EphemeralMessages, var relier; var broker; var user; + var email; var ephemeralMessages; var account; var SERVICE_NAME = 'Relier'; var CLIENT_ID = 'relier'; var SERVICE_URI = 'relier.com'; - var EMAIL = 'a@a.com'; var PERMISSIONS = ['profile:email', 'profile:uid']; beforeEach(function () { email = TestHelpers.createEmail(); - routerMock = new RouterMock(); windowMock = new WindowMock(); metrics = new Metrics(); @@ -63,7 +59,7 @@ function (chai, $, sinon, p, View, Metrics, FxaClient, EphemeralMessages, }); ephemeralMessages = new EphemeralMessages(); account = user.initAccount({ - email: EMAIL, + email: email, uid: 'uid', sessionToken: 'fake session token' }); @@ -122,7 +118,7 @@ function (chai, $, sinon, p, View, Metrics, FxaClient, EphemeralMessages, assert.include(view.$('#permission-request').text(), SERVICE_NAME, 'service name shows in paragraph'); - assert.equal(view.$('.email').val(), EMAIL, + assert.equal(view.$('.email').val(), email, 'shows email in permissions list'); }); }); diff --git a/app/tests/spec/views/pp.js b/app/tests/spec/views/pp.js index b41e71b085..3713d3f149 100644 --- a/app/tests/spec/views/pp.js +++ b/app/tests/spec/views/pp.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -115,5 +113,3 @@ function (chai, sinon, View, p, WindowMock) { }); }); }); - - diff --git a/app/tests/spec/views/progress_indicator.js b/app/tests/spec/views/progress_indicator.js index 6226f0c9cc..0125d441a8 100644 --- a/app/tests/spec/views/progress_indicator.js +++ b/app/tests/spec/views/progress_indicator.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; define([ diff --git a/app/tests/spec/views/ready.js b/app/tests/spec/views/ready.js index ce74bb25d4..67745a70c2 100644 --- a/app/tests/spec/views/ready.js +++ b/app/tests/spec/views/ready.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -175,6 +173,3 @@ function (chai, sinon, View, Session, FxaClient, Able, FxDesktopRelier, }); }); }); - - - diff --git a/app/tests/spec/views/reset_password.js b/app/tests/spec/views/reset_password.js index 5328f3b467..360ca006fd 100644 --- a/app/tests/spec/views/reset_password.js +++ b/app/tests/spec/views/reset_password.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'underscore', 'chai', diff --git a/app/tests/spec/views/settings.js b/app/tests/spec/views/settings.js index 1ae0b4e7cd..3568780748 100644 --- a/app/tests/spec/views/settings.js +++ b/app/tests/spec/views/settings.js @@ -1,17 +1,14 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', 'sinon', 'views/settings', '../../mocks/router', - '../../mocks/window', '../../lib/helpers', 'lib/fxa-client', 'lib/promise', @@ -23,14 +20,13 @@ define([ 'models/profile-image', 'models/user' ], -function (chai, $, sinon, View, RouterMock, WindowMock, TestHelpers, +function (chai, $, sinon, View, RouterMock, TestHelpers, FxaClient, p, ProfileErrors, AuthErrors, Able, Metrics, Relier, ProfileImage, User) { var assert = chai.assert; describe('views/settings', function () { var view; var routerMock; - var windowMock; var fxaClient; var relier; var user; @@ -54,7 +50,6 @@ function (chai, $, sinon, View, RouterMock, WindowMock, TestHelpers, beforeEach(function () { routerMock = new RouterMock(); metrics = new Metrics(); - windowMock = new WindowMock(); relier = new Relier(); fxaClient = new FxaClient(); user = new User(); @@ -370,5 +365,3 @@ function (chai, $, sinon, View, RouterMock, WindowMock, TestHelpers, }); }); }); - - diff --git a/app/tests/spec/views/settings/avatar.js b/app/tests/spec/views/settings/avatar.js index c48b9996dc..61191a9d18 100644 --- a/app/tests/spec/views/settings/avatar.js +++ b/app/tests/spec/views/settings/avatar.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -123,5 +121,3 @@ function (chai, $, sinon, View, RouterMock, FxaClientMock, }); }); }); - - diff --git a/app/tests/spec/views/settings/avatar_camera.js b/app/tests/spec/views/settings/avatar_camera.js index 97710c1d33..57adfc4068 100644 --- a/app/tests/spec/views/settings/avatar_camera.js +++ b/app/tests/spec/views/settings/avatar_camera.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -268,5 +266,3 @@ function (chai, $, sinon, View, RouterMock, WindowMock, CanvasMock, }); }); }); - - diff --git a/app/tests/spec/views/settings/avatar_change.js b/app/tests/spec/views/settings/avatar_change.js index e50236dad7..dff503c209 100644 --- a/app/tests/spec/views/settings/avatar_change.js +++ b/app/tests/spec/views/settings/avatar_change.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -270,5 +268,3 @@ function (chai, $, sinon, View, RouterMock, FileReaderMock, ProfileMock, }); }); - - diff --git a/app/tests/spec/views/settings/avatar_crop.js b/app/tests/spec/views/settings/avatar_crop.js index 6f980914b4..51f6719000 100644 --- a/app/tests/spec/views/settings/avatar_crop.js +++ b/app/tests/spec/views/settings/avatar_crop.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - /* exceptsPaths: draggable */ define([ 'chai', @@ -167,5 +165,3 @@ function (chai, $, ui, sinon, View, RouterMock, ProfileMock, User, CropperImage, }); }); }); - - diff --git a/app/tests/spec/views/settings/avatar_gravatar.js b/app/tests/spec/views/settings/avatar_gravatar.js index ccd9e51df5..60f660d972 100644 --- a/app/tests/spec/views/settings/avatar_gravatar.js +++ b/app/tests/spec/views/settings/avatar_gravatar.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -202,4 +200,3 @@ function (chai, $, sinon, View, RouterMock, ProfileMock, TestHelpers, User, }); }); - diff --git a/app/tests/spec/views/settings/communication_preferences.js b/app/tests/spec/views/settings/communication_preferences.js index 3d563e8dda..0d15415321 100644 --- a/app/tests/spec/views/settings/communication_preferences.js +++ b/app/tests/spec/views/settings/communication_preferences.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -181,4 +179,3 @@ function (chai, $, sinon, View, User, Account, MarketingEmailPrefs, Relier, }); }); - diff --git a/app/tests/spec/views/sign_in.js b/app/tests/spec/views/sign_in.js index fe2730ba91..f2f8d6fb7e 100644 --- a/app/tests/spec/views/sign_in.js +++ b/app/tests/spec/views/sign_in.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -445,7 +443,6 @@ function (chai, $, sinon, p, View, Session, AuthErrors, OAuthErrors, Metrics, }); assert.isTrue(view._suggestedAccount().isDefault(), 'null when no email set'); - user.getChooserAccount.restore(); sinon.stub(user, 'getChooserAccount', function () { return user.initAccount({ email: 'a@a.com' }); diff --git a/app/tests/spec/views/sign_up.js b/app/tests/spec/views/sign_up.js index bebba6b558..454dffa5e6 100644 --- a/app/tests/spec/views/sign_up.js +++ b/app/tests/spec/views/sign_up.js @@ -1,10 +1,9 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - + /*global translator */ 'use strict'; - define([ 'chai', 'jquery', @@ -194,7 +193,6 @@ function (chai, $, sinon, p, View, Coppa, Session, AuthErrors, Metrics, sinon.spy(view, 'showValidationError'); ephemeralMessages.set('bouncedEmail', 'testuser@testuser.com'); - return view.render() .then(function () { return view.afterVisible(); @@ -727,4 +725,3 @@ function (chai, $, sinon, p, View, Coppa, Session, AuthErrors, Metrics, }); }); - diff --git a/app/tests/spec/views/tooltip.js b/app/tests/spec/views/tooltip.js index fb009079c2..d94b5cbe43 100644 --- a/app/tests/spec/views/tooltip.js +++ b/app/tests/spec/views/tooltip.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'jquery', @@ -69,4 +67,3 @@ function (chai, $, Tooltip) { }); }); - diff --git a/app/tests/spec/views/tos.js b/app/tests/spec/views/tos.js index b8a421c426..6563826772 100644 --- a/app/tests/spec/views/tos.js +++ b/app/tests/spec/views/tos.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'sinon', @@ -119,4 +117,3 @@ function (chai, sinon, View, p, WindowMock) { }); }); - diff --git a/app/tests/spec/views/unexpected_error.js b/app/tests/spec/views/unexpected_error.js index 3a68e95e56..5a9b951010 100644 --- a/app/tests/spec/views/unexpected_error.js +++ b/app/tests/spec/views/unexpected_error.js @@ -1,10 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; - define([ 'chai', 'lib/ephemeral-messages', diff --git a/app/tests/test_start.js b/app/tests/test_start.js index 89a42df412..7a5ecc1186 100644 --- a/app/tests/test_start.js +++ b/app/tests/test_start.js @@ -170,5 +170,3 @@ function (Translator, Session) { }); - - diff --git a/grunttasks/eslint.js b/grunttasks/eslint.js new file mode 100644 index 0000000000..3caeaa5a03 --- /dev/null +++ b/grunttasks/eslint.js @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +'use strict'; + +module.exports = function (grunt) { + grunt.config('eslint', { + options: { + eslintrc: '.eslintrc' + }, + grunt: [ + 'Gruntfile.js', + 'grunttasks/*.js' + ], + app: { + options: { + eslintrc: '<%= yeoman.app %>/.eslintrc' + }, + src: [ + '<%= yeoman.app %>/**/*.js', + '!<%= yeoman.app %>/bower_components/**', + '!<%= yeoman.app %>/scripts/vendor/**' + ] + }, + tests: [ + '<%= yeoman.tests %>/**/*.js' + ], + scripts: [ + 'scripts/*.js' + ], + server: [ + '<%= yeoman.server %>/**/*.js', + ] + }); +}; diff --git a/grunttasks/jsonlint.js b/grunttasks/jsonlint.js index 4b3a12266a..0cc6fbd0cf 100644 --- a/grunttasks/jsonlint.js +++ b/grunttasks/jsonlint.js @@ -8,6 +8,8 @@ module.exports = function (grunt) { config: { src: [ '.bowerrc', + '.eslintrc', + '.jscsrc', '.jshintrc' ] }, diff --git a/grunttasks/lint.js b/grunttasks/lint.js index caa5ed0770..ad330ca725 100644 --- a/grunttasks/lint.js +++ b/grunttasks/lint.js @@ -7,6 +7,7 @@ module.exports = function (grunt) { grunt.registerTask('lint', 'lint all the things', [ + 'eslint', 'jshint', 'jsonlint:app', 'jscs', diff --git a/package.json b/package.json index 88942635fd..d946fdb656 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "grunt-contrib-watch": "0.6.1", "grunt-conventional-changelog": "1.1.0", "grunt-copyright": "0.1.0", + "grunt-eslint": "14.0.0", "grunt-jscs": "1.8.0", "grunt-jsonlint": "1.0.4", "grunt-nsp-shrinkwrap": "0.0.3", diff --git a/scripts/run_locally.js b/scripts/run_locally.js index 936ec5ad28..e31c7dc7fa 100755 --- a/scripts/run_locally.js +++ b/scripts/run_locally.js @@ -2,12 +2,13 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +'use strict'; -const path = require('path'); -const spawn = require('child_process').spawn; +var path = require('path'); +var spawn = require('child_process').spawn; -const BIN_ROOT = path.join(__dirname, '..', 'server', 'bin'); +var BIN_ROOT = path.join(__dirname, '..', 'server', 'bin'); module.exports = function (done) { process.chdir(path.dirname(__dirname)); @@ -21,7 +22,7 @@ module.exports = function (done) { if (done) { done(code); } else { - process.exit(code); + process.exit(code); //eslint-disable-line no-process-exit } }); }; diff --git a/server/bin/fxa-content-server.js b/server/bin/fxa-content-server.js index 74bb636ef9..0874b841fb 100755 --- a/server/bin/fxa-content-server.js +++ b/server/bin/fxa-content-server.js @@ -20,7 +20,6 @@ if (isMain) { process.chdir(path.dirname(__dirname)); } -var config = require('../lib/configuration'); mozlog.config(config.get('logging')); var logger = require('mozlog')('server.main'); diff --git a/server/lib/404.js b/server/lib/404.js index 7f9a16c923..09992d895e 100644 --- a/server/lib/404.js +++ b/server/lib/404.js @@ -1,7 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - 'use strict'; // It's a 404 not found response. diff --git a/server/lib/csp.js b/server/lib/csp.js index 6252b506d1..e451463dcb 100644 --- a/server/lib/csp.js +++ b/server/lib/csp.js @@ -6,13 +6,11 @@ // option 'csp.enabled' is set (default true in development), with a special // exception for the /tests/index.html path, which are the frontend unit // tests. - 'use strict'; var helmet = require('helmet'); var config = require('./configuration'); var url = require('url'); - var SELF = "'self'"; //jshint ignore: line var DATA = 'data:'; var GRAVATAR = 'https://secure.gravatar.com'; diff --git a/server/lib/statsd-collector.js b/server/lib/statsd-collector.js index 6ed0a3a81d..c1a0f8797c 100644 --- a/server/lib/statsd-collector.js +++ b/server/lib/statsd-collector.js @@ -12,6 +12,7 @@ var STATSD_PREFIX = 'fxa.content.'; function getGenericTags(body) { /*jshint maxcomplexity:7 */ + /*eslint complexity: [2, 7] */ // see more about tags here: http://docs.datadoghq.com/guides/metrics/ var tags = [ 'campaign:' + body.campaign, diff --git a/tests/functional/oauth_iframe.js b/tests/functional/oauth_iframe.js index e2bce729ab..6e04498e61 100644 --- a/tests/functional/oauth_iframe.js +++ b/tests/functional/oauth_iframe.js @@ -30,7 +30,6 @@ define([ var PASSWORD = 'password'; var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var OLD_ENOUGH_YEAR = TOO_YOUNG_YEAR - 1; - var user; var email; var client; function openFxaFromRp(context, page) { @@ -58,8 +57,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); - client = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); @@ -74,7 +71,6 @@ define([ var self = this; email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); return openFxaFromRp(self, 'signin') .then(function () { @@ -94,7 +90,6 @@ define([ var self = this; email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); return openFxaFromRp(self, 'signin') .then(function () { diff --git a/tests/functional/oauth_preverified_sign_up.js b/tests/functional/oauth_preverified_sign_up.js index 96798eccde..0dc9ff10e1 100644 --- a/tests/functional/oauth_preverified_sign_up.js +++ b/tests/functional/oauth_preverified_sign_up.js @@ -16,7 +16,6 @@ define([ var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var PASSWORD = 'password'; - var user; var email; registerSuite({ @@ -24,7 +23,6 @@ define([ setup: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); }, beforeEach: function () { diff --git a/tests/functional/oauth_reset_password.js b/tests/functional/oauth_reset_password.js index 17fd3558d7..068f71df5f 100644 --- a/tests/functional/oauth_reset_password.js +++ b/tests/functional/oauth_reset_password.js @@ -20,10 +20,8 @@ define([ var PASSWORD = 'password'; var TIMEOUT = 90 * 1000; - var user; var email; var client; - var accountData; registerSuite({ name: 'oauth reset password', @@ -39,12 +37,11 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); var self = this; return client.signUp(email, PASSWORD, { preVerified: true }) .then(function (result) { - accountData = result; + // do nothing }) .then(function () { // clear localStorage to avoid polluting other tests. diff --git a/tests/functional/oauth_sign_up.js b/tests/functional/oauth_sign_up.js index 944b1c2345..5be1b1e95f 100644 --- a/tests/functional/oauth_sign_up.js +++ b/tests/functional/oauth_sign_up.js @@ -21,7 +21,6 @@ define([ var AUTH_SERVER_ROOT = config.fxaAuthRoot; var PASSWORD = 'password'; - var user; var email; var bouncedEmail; var fxaClient; @@ -32,7 +31,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); bouncedEmail = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); fxaClient = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); diff --git a/tests/functional/oauth_sync_sign_in.js b/tests/functional/oauth_sync_sign_in.js index c21bf3cbf0..bfd055b80c 100644 --- a/tests/functional/oauth_sync_sign_in.js +++ b/tests/functional/oauth_sync_sign_in.js @@ -22,7 +22,6 @@ define([ var client; var email; var email2; - var user; var PASSWORD = '12345678'; var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var OLD_ENOUGH_YEAR = TOO_YOUNG_YEAR - 1; @@ -44,7 +43,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); email2 = TestHelpers.createEmail(); client = new FxaClient(AUTH_SERVER_ROOT, { diff --git a/tests/functional/oauth_webchannel.js b/tests/functional/oauth_webchannel.js index 89eed38677..d84b317228 100644 --- a/tests/functional/oauth_webchannel.js +++ b/tests/functional/oauth_webchannel.js @@ -20,7 +20,6 @@ define([ var PASSWORD = 'password'; var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var OLD_ENOUGH_YEAR = TOO_YOUNG_YEAR - 1; - var user; var email; var client; var ANIMATION_DELAY_MS = 1000; @@ -59,8 +58,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); - client = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); diff --git a/tests/functional/oauth_webchannel_keys.js b/tests/functional/oauth_webchannel_keys.js index 466cad546a..8797a93476 100644 --- a/tests/functional/oauth_webchannel_keys.js +++ b/tests/functional/oauth_webchannel_keys.js @@ -22,7 +22,6 @@ define([ var PASSWORD = 'password'; var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var OLD_ENOUGH_YEAR = TOO_YOUNG_YEAR - 1; - var user; var email; var client; var ANIMATION_DELAY_MS = 1000; @@ -65,8 +64,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); - client = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); diff --git a/tests/functional/sign_in.js b/tests/functional/sign_in.js index b7536bd8b4..e93e8ef4e8 100644 --- a/tests/functional/sign_in.js +++ b/tests/functional/sign_in.js @@ -17,7 +17,6 @@ define([ var AUTH_SERVER_ROOT = config.fxaAuthRoot; var PAGE_URL = config.fxaContentRoot + 'signin'; var PASSWORD = 'password'; - var user; var email; var accountData; var client; @@ -39,7 +38,6 @@ define([ setup: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); client = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); diff --git a/tests/functional/sign_in_cached.js b/tests/functional/sign_in_cached.js index ba17075807..f3fb677a72 100644 --- a/tests/functional/sign_in_cached.js +++ b/tests/functional/sign_in_cached.js @@ -35,8 +35,6 @@ define([ var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var PASSWORD = 'password'; - var user; - var user2; var email; var email2; var client; @@ -62,9 +60,7 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); email2 = TestHelpers.createEmail(); - user2 = TestHelpers.emailToUser(email2); client = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); diff --git a/tests/functional/sync_reset_password.js b/tests/functional/sync_reset_password.js index d49d8b2fc9..c2bcf28c81 100644 --- a/tests/functional/sync_reset_password.js +++ b/tests/functional/sync_reset_password.js @@ -24,7 +24,6 @@ define([ var user; var email; var client; - var accountData; var listenForFxaCommands = FxDesktopHelpers.listenForFxaCommands; var testIsBrowserNotifiedOfLogin = FxDesktopHelpers.testIsBrowserNotifiedOfLogin; @@ -48,7 +47,7 @@ define([ return client.signUp(email, PASSWORD, { preVerified: true }) .then(function (result) { - accountData = result; + // do nothing }) .then(function () { // clear localStorage to avoid polluting other tests. diff --git a/tests/functional/sync_sign_in.js b/tests/functional/sync_sign_in.js index 8aad63413b..fe51922798 100644 --- a/tests/functional/sync_sign_in.js +++ b/tests/functional/sync_sign_in.js @@ -21,7 +21,6 @@ define([ var client; var email; - var user; var PASSWORD = '12345678'; var accountData; @@ -41,7 +40,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - user = TestHelpers.emailToUser(email); client = new FxaClient(AUTH_SERVER_ROOT, { xhr: nodeXMLHttpRequest.XMLHttpRequest }); diff --git a/tests/functional/sync_v2_sign_up.js b/tests/functional/sync_v2_sign_up.js index adab944889..abb31af685 100644 --- a/tests/functional/sync_v2_sign_up.js +++ b/tests/functional/sync_v2_sign_up.js @@ -8,22 +8,17 @@ define([ 'intern!object', 'intern/chai!assert', 'require', - 'intern/node_modules/dojo/node!xmlhttprequest', - 'app/bower_components/fxa-js-client/fxa-client', 'tests/lib/helpers', 'tests/functional/lib/helpers' -], function (intern, registerSuite, assert, require, nodeXMLHttpRequest, - FxaClient, TestHelpers, FunctionalHelpers) { +], function (intern, registerSuite, assert, require, TestHelpers, FunctionalHelpers) { var config = intern.config; var PAGE_URL = config.fxaContentRoot + 'signup?context=iframe&service=sync'; var SIGNIN_URL = config.fxaContentRoot + 'signin'; - var AUTH_SERVER_ROOT = config.fxaAuthRoot; var TOO_YOUNG_YEAR = new Date().getFullYear() - 13; var OLD_ENOUGH_YEAR = TOO_YOUNG_YEAR - 1; - var client; var email; var PASSWORD = '12345678'; @@ -63,11 +58,6 @@ define([ beforeEach: function () { email = TestHelpers.createEmail(); - - client = new FxaClient(AUTH_SERVER_ROOT, { - xhr: nodeXMLHttpRequest.XMLHttpRequest - }); - return FunctionalHelpers.clearBrowserState(this); }, diff --git a/tests/intern.js b/tests/intern.js index 4641a9b4e3..5bf9e6310d 100644 --- a/tests/intern.js +++ b/tests/intern.js @@ -13,6 +13,7 @@ define([ ], function (intern, topic, firefoxProfile) { /*jshint maxcomplexity:11 */ + /*eslint complexity: [2, 11] */ var args = intern.args; var fxaAuthRoot = args.fxaAuthRoot || 'http://127.0.0.1:9000/v1'; var fxaContentRoot = args.fxaContentRoot || 'http://127.0.0.1:3030/';