Bug 1165266 - Upgrade Loop's use of eslint to version 0.21.x and eslint-react-plugin to 2.3.x and enable no-undef rule. r=dmose

This commit is contained in:
Mark Banner 2015-05-22 08:53:09 +01:00
Родитель dbec76581a
Коммит af6a90041d
90 изменённых файлов: 232 добавлений и 331 удалений

Просмотреть файл

@ -19,9 +19,11 @@
"chai": false,
"console": false,
"jQuery": false,
"loop": false,
"loop": true,
"MozActivity": false,
"mozRTCSessionDescription": false,
"OT": false,
"performance": false,
"Promise": false,
"React": false,
"sinon": false
@ -35,9 +37,11 @@
// Eslint built-in rules are documented at <http://eslint.org/docs/rules/>
"camelcase": 0, // TODO: Remove (use default)
"consistent-return": 0, // TODO: Remove (use default)
dot-location: 0, // [2, property],
"eqeqeq": 0, // TBD. Might need to be separate for content & chrome
"global-strict": 0, // Leave as zero (this will be unsupported in eslint 1.0.0)
"key-spacing": 0, // TODO: Remove (use default)
"linebreak-style": [2, "unix"],
"new-cap": 0, // TODO: Remove (use default)
"no-catch-shadow": 0, // TODO: Remove (use default)
"no-console": 0, // Leave as 0. We use console logging in content code.
@ -50,8 +54,8 @@
"no-return-assign": 0, // TODO: Remove (use default)
"no-shadow": 0, // TODO: Remove (use default)
"no-spaced-func": 0, // TODO: Remove (use default)
"no-undef": 0, // TODO: Remove (use default)
"no-underscore-dangle": 0, // Leave as 0. Commonly used for private variables.
"no-unneeded-ternary": 2,
"no-unused-expressions": 0, // TODO: Remove (use default)
"no-unused-vars": 0, // TODO: Remove (use default)
"no-use-before-define": 0, // TODO: Remove (use default)

Просмотреть файл

@ -0,0 +1,64 @@
// This file defines additional items and rules specific for gecko files.
// This is applied on top of the basic .eslintrc for gecko specific directories
// e.g. the modules directory.
{
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"destructuring": true,
"generators": true,
"restParams": true,
"spread": true,
"objectLiteralShorthandMethods": true,
},
"globals": {
// Gecko + Loop Globals.
"CardDavImporter": true,
"Chat": false,
"ChromeWorker": false,
"CommonUtils": false,
"Components": false,
"convertToRTCStatsReport": false,
"CustomizableUI": false,
"deriveHawkCredentials": false,
"eventEmitter": false,
"FxAccountsOAuthClient": false,
"FxAccountsProfileClient": false,
"gBrowser": false,
"gDNSService": false,
"gLoopBundle": false,
"GoogleImporter": true,
"gWM": false,
"HawkClient": false,
"injectLoopAPI": true,
"Iterator": false,
"Log": false,
"log": true,
"LOOP_SESSION_TYPE": true,
"LoopCalls": true,
"LoopContacts": true,
"loopCrypto": false,
"LoopRooms": true,
"LoopRoomsCache": true,
"LoopStorage": true,
"MozLoopPushHandler": true,
"MozLoopService": true,
"OS": false,
"roomsPushNotification": true,
"Services": false,
"Social": false,
"SocialShare": false,
"Task": false,
"UITour": false,
"XPCOMUtils": false,
"uuidgen": true,
// Test Related
"Assert": false,
},
"rules": {
"generator-star-spacing": [2, "after"],
// We should fix the errors and enable this (set to 2)
"no-var": 0,
"strict": [2, "global"]
}
}

Просмотреть файл

@ -2,9 +2,6 @@
* 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/. */
/* jshint esnext:true */
/* global loop:true, hawk, deriveHawkCredentials */
var loop = loop || {};
loop.Client = (function($) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/*jshint newcap:false*/
/*global loop:true, React */
var loop = loop || {};
loop.contacts = (function(_, mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/*jshint newcap:false*/
/*global loop:true, React */
var loop = loop || {};
loop.contacts = (function(_, mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false, esnext:true */
/* global loop:true, React */
var loop = loop || {};
loop.conversation = (function(mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false, esnext:true */
/* global loop:true, React */
var loop = loop || {};
loop.conversation = (function(mozL10n) {
"use strict";

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -1,11 +1,7 @@
/** @jsx React.DOM */
/* 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 loop:true, React */
var loop = loop || {};
loop.conversationViews = (function(mozL10n) {

Просмотреть файл

@ -1,11 +1,7 @@
/** @jsx React.DOM */
/* 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 loop:true, React */
var loop = loop || {};
loop.conversationViews = (function(mozL10n) {

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/*jshint newcap:false*/
/*global loop:true, React */
var loop = loop || {};
loop.panel = (function(_, mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/*jshint newcap:false*/
/*global loop:true, React */
var loop = loop || {};
loop.panel = (function(_, mozL10n) {
"use strict";

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
var loop = loop || {};
loop.roomViews = (function(mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
var loop = loop || {};
loop.roomViews = (function(mozL10n) {
"use strict";

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.actions = (function() {

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -2,7 +2,7 @@
* 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 loop:true */
/* global Components */
var loop = loop || {};
var inChrome = typeof Components != "undefined" && "utils" in Components;

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
/**
* The dispatcher for actions. This dispatches actions to stores registered
* for those actions.

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.FeedbackAPIClient = (function($, _) {
"use strict";

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -1,11 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.views = loop.shared.views || {};

Просмотреть файл

@ -1,11 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.views = loop.shared.views || {};

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.mixins = (function() {

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.models = (function(l10n) {

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.OTSdkDriver = (function() {

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -2,7 +2,7 @@
* 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 loop:true */
/* global Components */
var loop = loop || {};
loop.shared = loop.shared || {};

Просмотреть файл

@ -2,8 +2,6 @@
* 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/. */
/* jshint unused:false */
var loop = loop || {};
loop.validate = (function() {
"use strict";

Просмотреть файл

@ -1,11 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.views = (function(_, l10n) {

Просмотреть файл

@ -1,11 +1,7 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.views = (function(_, l10n) {

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.CallConnectionWebSocket = (function() {
"use strict";

Просмотреть файл

@ -1,17 +1,3 @@
{
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"destructuring": true,
"generators": true,
"restParams": true,
"spread": true,
"objectLiteralShorthandMethods": true,
},
"rules": {
"generator-star-spacing": [2, "after"],
// We should fix the errors and enable this (set to 2)
"no-var": 0,
"strict": [2, "global"]
}
"extends": "../.eslintrc-gecko"
}

Просмотреть файл

@ -190,7 +190,6 @@ let MozLoopServiceInternal = {
// Default to 5 seconds
return 5000;
}
return initialDelay;
},
/**

Просмотреть файл

@ -1,4 +1,6 @@
/** @jsx React.DOM */
/* 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/. */
var loop = loop || {};
loop.fxOSMarketplaceViews = (function() {

Просмотреть файл

@ -1,4 +1,6 @@
/** @jsx React.DOM */
/* 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/. */
var loop = loop || {};
loop.fxOSMarketplaceViews = (function() {

Просмотреть файл

@ -2,7 +2,6 @@
* 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/. */
var loop = loop || {};
/**

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.store = loop.store || {};

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
var loop = loop || {};
loop.StandaloneClient = (function($) {
"use strict";

Просмотреть файл

@ -2,8 +2,6 @@
* 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 loop:true */
/**
* The StandaloneMozLoop implementation reflects that of the mozLoop API for Loop
* in the desktop code. Not all functions are implemented.

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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 loop:true, React */
/* jshint newcap:false, maxlen:false */
var loop = loop || {};
loop.standaloneRoomViews = (function(mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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 loop:true, React */
/* jshint newcap:false, maxlen:false */
var loop = loop || {};
loop.standaloneRoomViews = (function(mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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 loop:true, React, MozActivity */
/* jshint newcap:false, maxlen:false */
var loop = loop || {};
loop.webapp = (function($, _, OT, mozL10n) {
"use strict";

Просмотреть файл

@ -1,12 +1,7 @@
/** @jsx React.DOM */
/* 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 loop:true, React, MozActivity */
/* jshint newcap:false, maxlen:false */
var loop = loop || {};
loop.webapp = (function($, _, OT, mozL10n) {
"use strict";

Просмотреть файл

@ -12,8 +12,8 @@
},
"dependencies": {},
"devDependencies": {
"eslint": "0.20.x",
"eslint-plugin-react": "2.2.x",
"eslint": "0.21.x",
"eslint-plugin-react": "2.3.x",
"express": "4.x"
},
"scripts": {

Просмотреть файл

@ -2,13 +2,10 @@
* 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 loop, sinon, it, beforeEach, afterEach, describe */
var expect = chai.expect;
describe("loop.Client", function() {
"use strict";
var expect = chai.expect;
var sandbox,
callback,
client,

Просмотреть файл

@ -2,15 +2,12 @@
* 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/. */
/*jshint newcap:false*/
/*global loop, sinon */
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
describe("loop.contacts", function() {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var fakeAddContactButtonText = "Fake Add Contact";
var fakeEditContactButtonText = "Fake Edit Contact";
var fakeDoneButtonText = "Fake Done";

Просмотреть файл

@ -1,10 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var expect = chai.expect;
describe("loop.store.ConversationAppStore", function () {
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var sandbox, dispatcher;

Просмотреть файл

@ -1,11 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var expect = chai.expect;
describe("loop.conversationViews", function () {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
var sharedView = loop.shared.views;
var sandbox, view, dispatcher, contact, fakeAudioXHR;

Просмотреть файл

@ -2,13 +2,11 @@
* 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 loop, sinon, React, TestUtils */
var expect = chai.expect;
describe("loop.conversation", function() {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var sharedModels = loop.shared.models,
fakeWindow,
sandbox;

Просмотреть файл

@ -82,7 +82,7 @@
describe("Uncaught Error Check", function() {
it("should load the tests without errors", function() {
expect(uncaughtError && uncaughtError.message).to.be.undefined;
chai.expect(uncaughtError && uncaughtError.message).to.be.undefined;
});
});

Просмотреть файл

@ -2,17 +2,14 @@
* 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/. */
/*jshint newcap:false*/
/*global loop, sinon */
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
describe("loop.panel", function() {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
var sandbox, notifications;
var fakeXHR, fakeWindow, fakeMozLoop;
var requests = [];
@ -925,8 +922,7 @@ describe("loop.panel", function() {
TestUtils.findRenderedDOMComponentWithClass(view, "terms-service");
});
it("should not render when the value of loop.seenToS is set to 'seen'",
function(done) {
it("should not render when the value of loop.seenToS is set to 'seen'", function() {
navigator.mozLoop.getLoopPref = function(key) {
return {
"gettingStarted.seen": true,
@ -934,11 +930,12 @@ describe("loop.panel", function() {
}[key];
};
try {
var view = TestUtils.renderIntoDocument(
React.createElement(loop.panel.ToSView));
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(view, "terms-service");
} catch (err) {
done();
}
}).to.Throw(/not find/);
});
it("should render when the value of loop.gettingStarted.seen is false",

Просмотреть файл

@ -1,10 +1,13 @@
var expect = chai.expect;
/* jshint newcap:false */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.roomViews", function () {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
var ROOM_STATES = loop.store.ROOM_STATES;
var SCREEN_SHARE_STATES = loop.shared.utils.SCREEN_SHARE_STATES;

Просмотреть файл

@ -1,17 +1,35 @@
{
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"destructuring": true,
"generators": true,
"restParams": true,
"spread": true,
"objectLiteralShorthandMethods": true,
},
"rules": {
"generator-star-spacing": [2, "after"],
// We should fix the errors and enable this (set to 2)
"no-var": 0,
"strict": [2, "global"]
"extends": "../../.eslintrc-gecko",
"globals": {
// General test items.
"add_task": false,
"Cc": true,
"Ci": true,
"Cr": true,
"Cu": true,
"is": false,
"info": false,
"ok": false,
"registerCleanupFunction": false,
// head.js items
"HAWK_TOKEN_LENGTH": true,
"checkLoggedOutState": false,
"checkFxAOAuthTokenData": false,
"loadLoopPanel": false,
"getLoopString": false,
"gMozLoopAPI": true,
"mockDb": true,
"mockPushHandler": true,
"promiseDeletedOAuthParams": false,
"promiseOAuthGetRegistration": false,
"promiseOAuthParamsSetup": false,
"promiseObserverNotified": false,
"promiseTabLoadEvent": false,
"promiseWaitForCondition": false,
"resetFxA": true,
// Loop specific items
"MozLoopServiceInternal": true,
"LoopRoomsInternal": true,
"LoopUI": false,
}
}

Просмотреть файл

@ -351,7 +351,7 @@ const mockDb = {
callback(null);
},
promise: function(method, ...params) {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
this[method](...params, (err, res) => err ? reject(err) : resolve(res));
});
}

Просмотреть файл

@ -1,11 +1,11 @@
/* global chai, loop */
var expect = chai.expect;
var sharedActions = loop.shared.actions;
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.ActiveRoomStore", function () {
"use strict";
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var REST_ERRNOS = loop.shared.utils.REST_ERRNOS;
var ROOM_STATES = loop.store.ROOM_STATES;
var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS;

Просмотреть файл

@ -1,11 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var expect = chai.expect;
describe("loop.store.ConversationStore", function () {
"use strict";
var expect = chai.expect;
var CALL_STATES = loop.store.CALL_STATES;
var WS_STATES = loop.store.WS_STATES;
var CALL_TYPES = loop.shared.utils.CALL_TYPES;

Просмотреть файл

@ -2,13 +2,10 @@
* 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 loop, sinon */
var expect = chai.expect;
describe("loop.crypto", function() {
"use strict";
var expect = chai.expect;
var sandbox, oldCrypto;
beforeEach(function() {

Просмотреть файл

@ -1,11 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var expect = chai.expect;
describe("loop.Dispatcher", function () {
"use strict";
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var dispatcher, sandbox;

Просмотреть файл

@ -2,13 +2,10 @@
* 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 loop, sinon, it, beforeEach, afterEach, describe */
var expect = chai.expect;
describe("loop.FeedbackAPIClient", function() {
"use strict";
var expect = chai.expect;
var sandbox,
fakeXHR,
requests = [];

Просмотреть файл

@ -1,11 +1,11 @@
/* global chai, loop */
var expect = chai.expect;
var sharedActions = loop.shared.actions;
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.FeedbackStore", function () {
"use strict";
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var FEEDBACK_STATES = loop.store.FEEDBACK_STATES;
var sandbox, dispatcher, store, feedbackClient;

Просмотреть файл

@ -2,20 +2,16 @@
* 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 loop, sinon, React */
/* jshint newcap:false */
var expect = chai.expect;
var l10n = navigator.mozL10n || document.mozL10n;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedViews = loop.shared.views;
var FEEDBACK_STATES = loop.store.FEEDBACK_STATES;
describe("loop.shared.views.FeedbackView", function() {
"use strict";
var expect = chai.expect;
var l10n = navigator.mozL10n || document.mozL10n;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedViews = loop.shared.views;
var FEEDBACK_STATES = loop.store.FEEDBACK_STATES;
var sandbox, comp, dispatcher, fakeFeedbackClient, feedbackStore;
beforeEach(function() {

Просмотреть файл

@ -1,13 +1,12 @@
/* global chai, loop */
var expect = chai.expect;
var sharedActions = loop.shared.actions;
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.FxOSActiveRoomStore", function () {
"use strict";
var ROOM_STATES = loop.store.ROOM_STATES;
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var sandbox;
var dispatcher;
var fakeMozLoop;

Просмотреть файл

@ -79,7 +79,7 @@
<script>
describe("Uncaught Error Check", function() {
it("should load the tests without errors", function() {
expect(uncaughtError && uncaughtError.message).to.be.undefined;
chai.expect(uncaughtError && uncaughtError.message).to.be.undefined;
});
});

Просмотреть файл

@ -2,16 +2,13 @@
* 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 loop, sinon */
/* jshint newcap:false */
var expect = chai.expect;
describe("loop.shared.mixins", function() {
"use strict";
var expect = chai.expect;
var sandbox;
var sharedMixins = loop.shared.mixins;
var TestUtils = React.addons.TestUtils;
var ROOM_STATES = loop.store.ROOM_STATES;
beforeEach(function() {

Просмотреть файл

@ -2,13 +2,11 @@
* 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 loop, sinon */
var expect = chai.expect;
describe("loop.shared.models", function() {
"use strict";
var expect = chai.expect;
var l10n = navigator.mozL10n || document.mozL10n;
var sharedModels = loop.shared.models, sandbox, fakeXHR,
requests = [], fakeSDK, fakeMozLoop, fakeSession, fakeSessionData;

Просмотреть файл

@ -1,11 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var expect = chai.expect;
describe("loop.OTSdkDriver", function () {
"use strict";
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS;
var STREAM_PROPERTIES = loop.shared.utils.STREAM_PROPERTIES;

Просмотреть файл

@ -2,14 +2,14 @@
* 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/. */
var expect = chai.expect;
describe("loop.store", function () {
"use strict";
var expect = chai.expect;
var dispatcher;
var sandbox;
var sharedActions = loop.shared.actions;
var TestUtils = React.addons.TestUtils;
beforeEach(function() {
sandbox = sinon.sandbox.create();

Просмотреть файл

@ -2,14 +2,10 @@
* 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 loop, sinon */
/* jshint newcap:false */
var expect = chai.expect;
describe("loop.shared.utils", function() {
"use strict";
var expect = chai.expect;
var sandbox;
var sharedUtils = loop.shared.utils;

Просмотреть файл

@ -1,13 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*global chai, validate */
var expect = chai.expect;
describe("Validator", function() {
"use strict";
var expect = chai.expect;
// test helpers
function create(dependencies, values) {
var validator = new loop.validate.Validator(dependencies);

Просмотреть файл

@ -2,16 +2,13 @@
* 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 loop, sinon, React */
/* jshint newcap:false */
var expect = chai.expect;
var l10n = navigator.mozL10n || document.mozL10n;
var TestUtils = React.addons.TestUtils;
describe("loop.shared.views", function() {
"use strict";
var expect = chai.expect;
var l10n = navigator.mozL10n || document.mozL10n;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedModels = loop.shared.models;
var sharedViews = loop.shared.views;
var SCREEN_SHARE_STATES = loop.shared.utils.SCREEN_SHARE_STATES;

Просмотреть файл

@ -2,14 +2,10 @@
* 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 loop, sinon, it, beforeEach, afterEach, describe */
var expect = chai.expect;
describe("loop.CallConnectionWebSocket", function() {
"use strict";
var expect = chai.expect;
var WEBSOCKET_REASONS = loop.shared.utils.WEBSOCKET_REASONS;
var sandbox,

Просмотреть файл

@ -73,7 +73,7 @@
<script>
describe("Uncaught Error Check", function() {
it("should load the tests without errors", function() {
expect(uncaughtError && uncaughtError.message).to.be.undefined;
chai.expect(uncaughtError && uncaughtError.message).to.be.undefined;
});
});

Просмотреть файл

@ -2,18 +2,15 @@
* 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 loop, sinon, it, beforeEach, afterEach, describe*/
var expect = chai.expect;
describe("loop.standaloneMedia._MultiplexGum", function() {
"use strict";
var expect = chai.expect;
var defaultGum =
navigator.getUserMedia ||
navigator.mozGetUserMedia ||
navigator.webkitGetUserMedia ||
(window.TBPlugin && TBPlugin.getUserMedia);
(window.TBPlugin && window.TBPlugin.getUserMedia);
var sandbox;
var multiplexGum;

Просмотреть файл

@ -1,9 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var expect = chai.expect;
describe("loop.store.StandaloneAppStore", function () {
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
var sandbox, dispatcher;

Просмотреть файл

@ -2,11 +2,10 @@
* 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/. */
var expect = chai.expect;
describe("loop.store.StandaloneMetricsStore", function() {
"use strict";
var expect = chai.expect;
var sandbox, dispatcher, store, fakeActiveRoomStore;
var sharedActions = loop.shared.actions;

Просмотреть файл

@ -2,11 +2,10 @@
* 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/. */
var expect = chai.expect;
describe("loop.StandaloneMozLoop", function() {
"use strict";
var expect = chai.expect;
var sandbox, fakeXHR, requests, callback, mozLoop;
var fakeToken, fakeBaseServerUrl, fakeServerErrorDescription;

Просмотреть файл

@ -2,13 +2,12 @@
* 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 loop, sinon */
var expect = chai.expect;
describe("loop.standaloneRoomViews", function() {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var ROOM_STATES = loop.store.ROOM_STATES;
var FEEDBACK_STATES = loop.store.FEEDBACK_STATES;
var ROOM_INFO_FAILURES = loop.shared.utils.ROOM_INFO_FAILURES;

Просмотреть файл

@ -2,13 +2,10 @@
* 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 loop, sinon, it, beforeEach, afterEach, describe, hawk */
var expect = chai.expect;
describe("loop.StandaloneClient", function() {
"use strict";
var expect = chai.expect;
var sandbox,
fakeXHR,
requests = [],

Просмотреть файл

@ -2,14 +2,11 @@
* 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 loop, sinon */
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
describe("loop.webapp", function() {
"use strict";
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
var sharedActions = loop.shared.actions;
var sharedModels = loop.shared.models,
sharedViews = loop.shared.views,

Просмотреть файл

@ -1,17 +1,36 @@
{
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"destructuring": true,
"generators": true,
"restParams": true,
"spread": true,
"objectLiteralShorthandMethods": true,
},
"rules": {
"generator-star-spacing": [2, "after"],
// We should fix the errors and enable this (set to 2)
"no-var": 0,
"strict": [2, "global"]
"extends": "../../.eslintrc-gecko",
"globals": {
// General xpcshell-test functions
"HttpServer": false,
"add_task": false,
"add_test": false,
"Ci": true,
"Cu": true,
"do_check_true": false,
"do_check_false": false,
"do_check_eq": false,
"do_get_profile": false,
"do_print": false,
"do_register_cleanup": false,
"do_throw": false,
"do_timeout": false,
"run_next_test": false,
// head.js items.
"MockWebSocketChannel": false,
"extend": true,
"getLoopString": false,
"kServerPushUrl": true,
"kEndPointUrl": true,
"loopCrypto": true,
"loopServer": true,
"mockPushHandler": true,
"setupFakeFxAUserProfile": false,
"setupFakeLoopServer": false,
"timerHandlers",
"waitForCondition": true,
// Loop specific items
"MozLoopServiceInternal": true,
"LoopRoomsInternal": true,
}
}

Просмотреть файл

@ -126,7 +126,9 @@ add_task(function* setup_server() {
});
function returnRoomDetails(res, roomName) {
roomDetail.roomName = roomName;
var roomDetail = {
roomName: roomName
};
res.setStatusLine(null, 200, "OK");
res.write(JSON.stringify(roomDetail));
res.processAsync();

Просмотреть файл

@ -53,14 +53,6 @@ add_task(function* setup_server() {
res.finish();
});
function returnRoomDetails(res, roomName) {
roomDetail.roomName = roomName;
res.setStatusLine(null, 200, "OK");
res.write(JSON.stringify(roomDetail));
res.processAsync();
res.finish();
}
function getJSONData(body) {
return JSON.parse(CommonUtils.readBytesFromInputStream(body));
}

Просмотреть файл

@ -1,6 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* global Services, Assert */
"use strict";

Просмотреть файл

@ -1,6 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*global XPCOMUtils, Services, Assert */
"use strict";
@ -65,7 +64,7 @@ function test_setLoopPref_non_coercible_type()
{
MozLoopService.setLoopPref(fakeCharPrefName, true);
ok(true, "Setting non-coercible type should not fail");
Assert.ok(true, "Setting non-coercible type should not fail");
}

Просмотреть файл

@ -1,11 +1,8 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
/* global uncaughtError:true */
(function() {
"use strict";

Просмотреть файл

@ -1,11 +1,8 @@
/** @jsx React.DOM */
/* 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/. */
/* jshint newcap:false */
/* global loop:true, React */
/* global uncaughtError:true */
(function() {
"use strict";