Bug 1421968 - Enable ESLint rule mozilla/use-services by default, but whitelist it for various directories still to be fixed. r?Mossop
MozReview-Commit-ID: KOZWr7FiDQZ
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -19,10 +19,32 @@ module.exports = {
"overrides": [{
// eslint-plugin-html handles eol-last slightly different - it applies to
// each set of script tags, so we turn it off here.
"files": "**/*.*html",
"rules": {
"eol-last": "off",
}
+ }, {
+ // XXX Bug 1421969. These files/directories are still being fixed,
+ // so turn off mozilla/use-services for them for now.
+ "files": [
+ "accessible/**",
+ // Browser: Bug 1421379
+ "browser/extensions/shield-recipe-client/test/browser/head.js",
+ "browser/modules/offlineAppCache.jsm",
+ "chrome/**",
+ "devtools/**",
+ "dom/indexedDB/**",
+ "dom/media/**",
+ "extensions/pref/**",
+ "mobile/android/**",
+ "security/**",
+ "testing/**",
+ "tools/profiler/**",
+ "xpcom/**"
+ ],
+ "rules": {
+ "mozilla/use-services": "off",
+ }
}]
};
--- a/browser/components/.eslintrc.js
+++ b/browser/components/.eslintrc.js
@@ -1,11 +1,9 @@
"use strict";
module.exports = {
rules: {
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", 61],
-
- "mozilla/use-services": "error",
}
};
--- a/services/.eslintrc.js
+++ b/services/.eslintrc.js
@@ -1,12 +1,10 @@
"use strict";
module.exports = {
plugins: [
"mozilla"
],
"rules": {
"no-throw-literal": 2,
-
- "mozilla/use-services": "error",
},
}
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -2,21 +2,10 @@
module.exports = {
rules: {
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", 41],
"mozilla/no-task": "error",
-
- "mozilla/use-services": "error",
- },
-
- "overrides": [{
- // Turn off use-services for xml files. XBL bindings are going away, and
- // working out the valid globals for those is difficult.
- "files": "**/*.xml",
- "rules": {
- "mozilla/use-services": "off",
- }
- }]
+ }
};
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -51,16 +51,25 @@ module.exports = {
"openDialog": false,
"sizeToContent": false,
// Specific to Firefox
// eslint-disable-next-line max-len
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval
"uneval": false
},
+ "overrides": [{
+ // Turn off use-services for xml files. XBL bindings are going away, and
+ // working out the valid globals for those is difficult.
+ "files": "**/*.xml",
+ "rules": {
+ "mozilla/use-services": "off"
+ }
+ }],
+
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
"ecmaVersion": 8
},
// When adding items to this file please check for effects on sub-directories.
@@ -143,16 +152,17 @@ module.exports = {
"mozilla/avoid-removeChild": "error",
"mozilla/import-browser-window-globals": "error",
"mozilla/import-globals": "error",
"mozilla/no-import-into-var-and-global": "error",
"mozilla/no-useless-parameters": "error",
"mozilla/no-useless-removeEventListener": "error",
"mozilla/use-default-preference-values": "error",
"mozilla/use-ownerGlobal": "error",
+ "mozilla/use-services": "error",
// Always require parenthesis for new calls
// "new-parens": "error",
// Use [] instead of Array()
"no-array-constructor": "error",
"no-caller": "error",
--- a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
@@ -1,11 +1,11 @@
{
"name": "eslint-plugin-mozilla",
- "version": "0.4.9",
+ "version": "0.4.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"acorn": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
"integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==",
"dev": true
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
{
"name": "eslint-plugin-mozilla",
- "version": "0.4.9",
+ "version": "0.4.10",
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin",
"mozilla",
"firefox"
],