Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
chore(lint): switch from JSHint to ESLint
Browse files Browse the repository at this point in the history
Fixes #2550
Switch from JSHint to ESLint
Add rules to ESLint
Also have JSHint in parallel
Remove old dependencies reported by amdcheck
Remove unused variables reported by ESLint
  • Loading branch information
TDA committed Jun 12, 2015
1 parent 84bbd90 commit 1e02332
Show file tree
Hide file tree
Showing 239 changed files with 153 additions and 444 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
@@ -0,0 +1,4 @@
.tmp/**
app/bower_components/**
app/scripts/vendor/**
dist/**
48 changes: 48 additions & 0 deletions .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
}
}
2 changes: 1 addition & 1 deletion .jshintrc
Expand Up @@ -18,7 +18,7 @@
"sub": true,
"trailing": true,
"undef": true,
"unused": true,
"unused": "vars",
"globals": {
"define": false,
"Promise": true
Expand Down
21 changes: 21 additions & 0 deletions 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
}
}
1 change: 1 addition & 0 deletions 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 () {
Expand Down
1 change: 0 additions & 1 deletion app/scripts/head/startup-styles.js
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/able.js
Expand Up @@ -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 () {
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/lib/app-start.js
Expand Up @@ -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([
Expand Down Expand Up @@ -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({
Expand Down
1 change: 0 additions & 1 deletion 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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/auth-errors.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion 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';

/**
Expand Down
1 change: 0 additions & 1 deletion 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.
Expand Down
1 change: 0 additions & 1 deletion 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';

/**
Expand Down
1 change: 0 additions & 1 deletion 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.
Expand Down
1 change: 0 additions & 1 deletion 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';

/**
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/channels/inter-tab.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion 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';

/**
Expand Down
1 change: 0 additions & 1 deletion 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.
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/channels/receivers/web-channel.js
Expand Up @@ -7,7 +7,6 @@
* https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/WebChannel.jsm
*/


'use strict';

define([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/channels/senders/null.js
Expand Up @@ -5,7 +5,6 @@
/**
* A null sender. Sends messages nowhere.
*/

'use strict';

define([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/channels/senders/web-channel.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/channels/web.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/config-loader.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion 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 () {
Expand Down
1 change: 0 additions & 1 deletion 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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/environment.js
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/ephemeral-messages.js
Expand Up @@ -4,7 +4,6 @@

// an ephemeral messages model. Ephemeral messages are allowed
// a single `get` and no more.

'use strict';

define([
Expand Down
1 change: 0 additions & 1 deletion 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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/fxa-client.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/marketing-email-client.js
Expand Up @@ -5,7 +5,6 @@
/**
* A client to talk to the basket marketing email server
*/

'use strict';

define([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/marketing-email-errors.js
Expand Up @@ -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([
Expand Down
3 changes: 2 additions & 1 deletion 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!
Expand All @@ -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',
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/null-storage.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion 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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/oauth-errors.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/profile-client.js
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion 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([
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/relier-keys.js
Expand Up @@ -5,7 +5,6 @@
/**
* Derive relier-specific encryption keys from account master keys.
*/

'use strict';

define([
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/screen-info.js
Expand Up @@ -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([
Expand All @@ -12,6 +11,7 @@ define([

function ScreenInfo(win) {
/*jshint maxcomplexity:8 */
/*eslint complexity: [2, 8] */
var documentElement = win.document.documentElement || {};
var screen = win.screen || {};

Expand Down

0 comments on commit 1e02332

Please sign in to comment.