Bug 1170804 - Get .jsm to work under eslint. r=margaret
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 24 Jun 2015 23:11:11 -0700
changeset 268446 de00e0badee1ad02ae895ceabfe1c7e3d2a7b543
parent 268445 7c445f47c4d6a78ff57c5b3d32702e6cd0ab6156
child 268447 a348a4336c715498e4e9568a8e532741d5811039
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1170804
milestone41.0a1
Bug 1170804 - Get .jsm to work under eslint. r=margaret You can now run by `cd mobile/android && eslint . --ext "[.js,.jsm]"`.
mobile/android/.eslintignore
mobile/android/.eslintrc
mobile/android/modules/DelayedInit.jsm
mobile/android/modules/Notifications.jsm
mobile/android/modules/Sanitizer.jsm
--- a/mobile/android/.eslintignore
+++ b/mobile/android/.eslintignore
@@ -2,8 +2,11 @@ chrome/content
 tests/
 
 # Uses `#filter substitution`
 app/mobile.js
 
 # Not much JS to lint and non-standard at that
 installer/
 locales/
+
+# Pretty sure we're disabling this one anyway
+modules/ContactService.jsm
--- a/mobile/android/.eslintrc
+++ b/mobile/android/.eslintrc
@@ -6,63 +6,73 @@ globals:
     Components: false
 
     # TODO: Create custom rule for `Cu.import`
     AddonManager: false
     AppConstants: false
     Downloads: false
     File: false
     FileUtils: false
-    HelperApps: false
-    JNI: false
+    HelperApps: true # TODO: Can be more specific here.
+    JNI: true # TODO: Can be more specific here.
+    LightweightThemeManager: false
     Messaging: false
+    Notifications: false
     OS: false
+    ParentalControls: false
     PrivateBrowsingUtils: false
     Prompt: false
     Services: false
+    SharedPreferences: false
+    strings: false
     Task: false
     TelemetryStopwatch: false
+    UITelemetry: false
     UserAgentOverrides: 0
     WebappManager: false
     XPCOMUtils: false
+    ctypes: false
     dump: false
     exports: false
     importScripts: false
+    module: false
     require: false
+    uuidgen: false
 
     Iterator: false # TODO: Remove - deprecated!
 
 rules:
     global-strict: 0 # Overridden by "strict"
     no-underscore-dangle: 0 # We allow trailing underscores in names.
 
     # We disable everything to get all files to pass w/o updating them.
     # We'll re-enable one by one.
     camelcase: 0
     comma-dangle: 0
+    comma-spacing: 0
     consistent-return: 0
     curly: 0
     dot-notation: 0
     eqeqeq: 0
     key-spacing: 0
     new-cap: 0
+    no-caller: 0
     no-constant-condition: 0
+    no-empty: 0
+    no-extra-bind: 0
     no-extra-semi: 0
-    no-caller: 0
-    no-return-assign: 0
-    no-extra-bind: 0
-    no-empty: 0
+    no-loop-func: 0
     no-multi-spaces: 0
-    no-loop-func: 0
     no-new-object: 0
     no-octal: 0
+    no-return-assign: 0
     no-shadow: 0
     no-trailing-spaces: 0
+    no-unused-vars: 0
     no-use-before-define: 0
-    no-unused-vars: 0
     quotes: 0 # [2, "double"]
     semi: 0
     space-infix-ops: 0
     space-unary-ops: 0 # 2: https://github.com/eslint/eslint/issues/2764
     strict: 0
 
   #"ecmaFeatures": {
   #  "forOf": true,
--- a/mobile/android/modules/DelayedInit.jsm
+++ b/mobile/android/modules/DelayedInit.jsm
@@ -1,13 +1,15 @@
 /* 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"
 
+/*globals MessageLoop */
+
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 this.EXPORTED_SYMBOLS = ["DelayedInit"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "MessageLoop",
                                    "@mozilla.org/message-loop;1",
--- a/mobile/android/modules/Notifications.jsm
+++ b/mobile/android/modules/Notifications.jsm
@@ -14,17 +14,17 @@ function log(msg) {
   // Services.console.logStringMessage(msg);
 }
 
 let _notificationsMap = {};
 let _handlersMap = {};
 
 function Notification(aId, aOptions) {
   this._id = aId;
-  this._when = (new Date).getTime();
+  this._when = (new Date()).getTime();
   this.fillWithOptions(aOptions);
 }
 
 Notification.prototype = {
   fillWithOptions: function(aOptions) {
     if ("icon" in aOptions && aOptions.icon != null)
       this._icon = aOptions.icon;
     else
--- a/mobile/android/modules/Sanitizer.jsm
+++ b/mobile/android/modules/Sanitizer.jsm
@@ -1,13 +1,15 @@
 // -*- indent-tabs-mode: nil; js-indent-level: 4 -*-
 /* 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 LoadContextInfo, FormHistory, Accounts */
+
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/LoadContextInfo.jsm");
 Cu.import("resource://gre/modules/FormHistory.jsm");