diff --git a/browser/components/loop/.eslintrc b/browser/components/loop/.eslintrc index 4293b8428864..48311878f568 100644 --- a/browser/components/loop/.eslintrc +++ b/browser/components/loop/.eslintrc @@ -36,6 +36,7 @@ // Eslint built-in rules are documented at "camelcase": 0, // TODO: Remove (use default) + "computed-property-spacing": [2, "never"], "consistent-return": 0, // TODO: Remove (use default) dot-location: 0, // [2, property], "eqeqeq": 0, // TBD. Might need to be separate for content & chrome @@ -52,11 +53,14 @@ "no-redeclare": 0, // TODO: Remove (use default) "no-return-assign": 0, // TODO: Remove (use default) "no-underscore-dangle": 0, // Leave as 0. Commonly used for private variables. + "no-unexpected-multiline": 2, "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) + "object-curly-spacing": 0, // [2, "always"], "quotes": [2, "double", "avoid-escape"], + "spaced-comment": [2, "always"], "strict": 0, // [2, "function"], // eslint-plugin-react rules. These are documented at // diff --git a/browser/components/loop/content/js/roomViews.js b/browser/components/loop/content/js/roomViews.js index 58533e92a1d7..6920cd3e3775 100644 --- a/browser/components/loop/content/js/roomViews.js +++ b/browser/components/loop/content/js/roomViews.js @@ -595,7 +595,8 @@ loop.roomViews = (function(mozL10n) { // The poster URLs are for UI-showcase testing and development. localPosterUrl: React.PropTypes.string, mozLoop: React.PropTypes.object.isRequired, - remotePosterUrl: React.PropTypes.string + remotePosterUrl: React.PropTypes.string, + roomStore: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired }, componentWillUpdate: function(nextProps, nextState) { diff --git a/browser/components/loop/content/js/roomViews.jsx b/browser/components/loop/content/js/roomViews.jsx index 075c28b2d36c..730d45031d16 100644 --- a/browser/components/loop/content/js/roomViews.jsx +++ b/browser/components/loop/content/js/roomViews.jsx @@ -595,7 +595,8 @@ loop.roomViews = (function(mozL10n) { // The poster URLs are for UI-showcase testing and development. localPosterUrl: React.PropTypes.string, mozLoop: React.PropTypes.object.isRequired, - remotePosterUrl: React.PropTypes.string + remotePosterUrl: React.PropTypes.string, + roomStore: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired }, componentWillUpdate: function(nextProps, nextState) { diff --git a/browser/components/loop/content/shared/js/textChatView.js b/browser/components/loop/content/shared/js/textChatView.js index b6d627f196e3..6ff7105e84f4 100644 --- a/browser/components/loop/content/shared/js/textChatView.js +++ b/browser/components/loop/content/shared/js/textChatView.js @@ -97,7 +97,7 @@ loop.shared.views.chat = (function(mozL10n) { propTypes: { dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired, - messageList: React.PropTypes.array.isRequired + messageList: React.PropTypes.arrayOf(React.PropTypes.object).isRequired }, getInitialState: function() { diff --git a/browser/components/loop/content/shared/js/textChatView.jsx b/browser/components/loop/content/shared/js/textChatView.jsx index d8f4e389ea0c..5707d99c6fc1 100644 --- a/browser/components/loop/content/shared/js/textChatView.jsx +++ b/browser/components/loop/content/shared/js/textChatView.jsx @@ -97,7 +97,7 @@ loop.shared.views.chat = (function(mozL10n) { propTypes: { dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired, - messageList: React.PropTypes.array.isRequired + messageList: React.PropTypes.arrayOf(React.PropTypes.object).isRequired }, getInitialState: function() { diff --git a/browser/components/loop/content/shared/js/validate.js b/browser/components/loop/content/shared/js/validate.js index 8aee85e41ce2..cb7b5c9fbc12 100644 --- a/browser/components/loop/content/shared/js/validate.js +++ b/browser/components/loop/content/shared/js/validate.js @@ -112,7 +112,6 @@ loop.validate = (function() { */ _dependencyMatchTypes: function(value, types) { return types.some(function(Type) { - /*jshint eqeqeq:false*/ try { return typeof Type === "undefined" || // skip checking Type === null && value === null || // null type diff --git a/browser/components/loop/modules/MozLoopService.jsm b/browser/components/loop/modules/MozLoopService.jsm index bc9da35526eb..afba47296c4a 100644 --- a/browser/components/loop/modules/MozLoopService.jsm +++ b/browser/components/loop/modules/MozLoopService.jsm @@ -15,7 +15,7 @@ const LOOP_SESSION_TYPE = { FXA: 2 }; -/*** +/** * Values that we segment 2-way media connection length telemetry probes * into. * @@ -614,7 +614,8 @@ let MozLoopServiceInternal = { return this.hawkRequestInternal(sessionType, path, method, payloadObj, false); }, () => { - return handle401Error(error); //Process the original error that triggered the retry. + // Process the original error that triggered the retry. + return handle401Error(error); } ); } @@ -916,10 +917,10 @@ let MozLoopServiceInternal = { // Not ideal but insert our data amidst existing data like this: // - 000 (id=00 url=http) // + 000 (session=000 call=000 id=00 url=http) - var pair = pc.id.split("("); //) + var pair = pc.id.split("("); if (pair.length == 2) { pc.id = pair[0] + "(session=" + context.sessionId + - (context.callId ? " call=" + context.callId : "") + " " + pair[1]; //) + (context.callId ? " call=" + context.callId : "") + " " + pair[1]; } } diff --git a/browser/components/loop/standalone/content/js/webapp.js b/browser/components/loop/standalone/content/js/webapp.js index 979e85dd9000..8ff4b538ad05 100644 --- a/browser/components/loop/standalone/content/js/webapp.js +++ b/browser/components/loop/standalone/content/js/webapp.js @@ -223,7 +223,7 @@ loop.webapp = (function($, _, OT, mozL10n) { var urlCreationDateClasses = cx({ "light-color-font": true, "call-url-date": true, /* Used as a handler in the tests */ - /*hidden until date is available*/ + // Hidden until date is available. "hide": !this.props.urlCreationDateString.length }); diff --git a/browser/components/loop/standalone/content/js/webapp.jsx b/browser/components/loop/standalone/content/js/webapp.jsx index ccaba12e5d63..fd173a6bcb0d 100644 --- a/browser/components/loop/standalone/content/js/webapp.jsx +++ b/browser/components/loop/standalone/content/js/webapp.jsx @@ -223,7 +223,7 @@ loop.webapp = (function($, _, OT, mozL10n) { var urlCreationDateClasses = cx({ "light-color-font": true, "call-url-date": true, /* Used as a handler in the tests */ - /*hidden until date is available*/ + // Hidden until date is available. "hide": !this.props.urlCreationDateString.length }); diff --git a/browser/components/loop/standalone/package.json b/browser/components/loop/standalone/package.json index ac6530143a92..382cd14c574b 100644 --- a/browser/components/loop/standalone/package.json +++ b/browser/components/loop/standalone/package.json @@ -12,8 +12,8 @@ }, "dependencies": {}, "devDependencies": { - "eslint": "0.21.x", - "eslint-plugin-react": "2.3.x", + "eslint": "0.24.x", + "eslint-plugin-react": "2.6.x", "express": "4.x" }, "scripts": { diff --git a/browser/components/loop/test/desktop-local/conversationViews_test.js b/browser/components/loop/test/desktop-local/conversationViews_test.js index 01770ba21c3c..d46652f086e7 100644 --- a/browser/components/loop/test/desktop-local/conversationViews_test.js +++ b/browser/components/loop/test/desktop-local/conversationViews_test.js @@ -18,19 +18,6 @@ describe("loop.conversationViews", function () { var REST_ERRNOS = loop.shared.utils.REST_ERRNOS; var WEBSOCKET_REASONS = loop.shared.utils.WEBSOCKET_REASONS; - // XXX refactor to Just Work with "sandbox.stubComponent" or else - // just pass in the sandbox and put somewhere generally usable - - function stubComponent(obj, component, mockTagName){ - var reactClass = React.createClass({ - render: function() { - var tagName = mockTagName || "div"; - return React.DOM[tagName](null, this.props.children); - } - }); - return sandbox.stub(obj, component, reactClass); - } - beforeEach(function() { sandbox = sinon.sandbox.create(); sandbox.useFakeTimers(); diff --git a/browser/components/loop/test/xpcshell/test_looppush_initialize.js b/browser/components/loop/test/xpcshell/test_looppush_initialize.js index 48a67451531f..e52f516a04f0 100644 --- a/browser/components/loop/test/xpcshell/test_looppush_initialize.js +++ b/browser/components/loop/test/xpcshell/test_looppush_initialize.js @@ -93,7 +93,8 @@ add_test(function test_reconnect_websocket() { // The uaID is cleared to force re-regsitration of all notification channels. add_test(function test_reopen_websocket() { MozLoopPushHandler.uaID = undefined; - MozLoopPushHandler.registeredChannels = {}; //Do this to force a new registration callback. + // Do this to force a new registration callback. + MozLoopPushHandler.registeredChannels = {}; mockWebSocket.serverClose(); // Previously registered onRegistration callbacks will fire and be checked (see above). }); diff --git a/browser/components/loop/ui/react-frame-component.js b/browser/components/loop/ui/react-frame-component.js index a4fe1abe6868..ce31b896ae72 100644 --- a/browser/components/loop/ui/react-frame-component.js +++ b/browser/components/loop/ui/react-frame-component.js @@ -25,6 +25,10 @@ window.queuedFrames = []; */ window.Frame = React.createClass({ propTypes: { + children: React.PropTypes.oneOfType([ + React.PropTypes.element, + React.PropTypes.arrayOf(React.PropTypes.element) + ]).isRequired, className: React.PropTypes.string, /* By default,