diff --git a/extensions/chromium/.eslintrc b/extensions/chromium/.eslintrc index bbeb5c495..ae23570f8 100644 --- a/extensions/chromium/.eslintrc +++ b/extensions/chromium/.eslintrc @@ -3,11 +3,20 @@ ../../.eslintrc ], + "env": { + "webextensions": true + }, + + "plugins": [ + "mozilla" + ], + "parserOptions": { "sourceType": "script" }, "rules": { + "mozilla/import-globals": "error", "object-shorthand": "off", }, } diff --git a/extensions/chromium/contentscript.js b/extensions/chromium/contentscript.js index 21ba2ae97..ed683c4d5 100644 --- a/extensions/chromium/contentscript.js +++ b/extensions/chromium/contentscript.js @@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome, CSS */ 'use strict'; diff --git a/extensions/chromium/extension-router.js b/extensions/chromium/extension-router.js index e4ff6f426..3ed3e8cd1 100644 --- a/extensions/chromium/extension-router.js +++ b/extensions/chromium/extension-router.js @@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome */ 'use strict'; diff --git a/extensions/chromium/feature-detect.js b/extensions/chromium/feature-detect.js index 65b244678..cef49bd2d 100644 --- a/extensions/chromium/feature-detect.js +++ b/extensions/chromium/feature-detect.js @@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome */ 'use strict'; diff --git a/extensions/chromium/options/migration.js b/extensions/chromium/options/migration.js index 32577fbda..7073fc5bc 100644 --- a/extensions/chromium/options/migration.js +++ b/extensions/chromium/options/migration.js @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ /* eslint strict: ["error", "function"] */ -/* globals chrome */ (function() { 'use strict'; diff --git a/extensions/chromium/options/options.js b/extensions/chromium/options/options.js index 62b6ded9c..c6f57b898 100644 --- a/extensions/chromium/options/options.js +++ b/extensions/chromium/options/options.js @@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome */ 'use strict'; var storageAreaName = chrome.storage.sync ? 'sync' : 'local'; diff --git a/extensions/chromium/pageAction/background.js b/extensions/chromium/pageAction/background.js index 5a504ade8..23c83338c 100644 --- a/extensions/chromium/pageAction/background.js +++ b/extensions/chromium/pageAction/background.js @@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome */ 'use strict'; diff --git a/extensions/chromium/pdfHandler-vcros.js b/extensions/chromium/pdfHandler-vcros.js index 4ed546302..c302ea1fb 100644 --- a/extensions/chromium/pdfHandler-vcros.js +++ b/extensions/chromium/pdfHandler-vcros.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ /* eslint strict: ["error", "function"] */ -/* globals chrome, getViewerURL */ +/* import-globals-from pdfHandler.js */ (function() { 'use strict'; diff --git a/extensions/chromium/pdfHandler.js b/extensions/chromium/pdfHandler.js index 950b2e38c..7b671f696 100644 --- a/extensions/chromium/pdfHandler.js +++ b/extensions/chromium/pdfHandler.js @@ -13,7 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome, Features, saveReferer */ +/* import-globals-from feature-detect.js */ +/* import-globals-from preserve-referer.js */ 'use strict'; diff --git a/extensions/chromium/preserve-referer.js b/extensions/chromium/preserve-referer.js index 5f5741c67..3f1ba53a6 100644 --- a/extensions/chromium/preserve-referer.js +++ b/extensions/chromium/preserve-referer.js @@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome, getHeaderFromHeaders */ -/* exported saveReferer */ +/* import-globals-from pdfHandler.js */ 'use strict'; /** diff --git a/extensions/chromium/suppress-update.js b/extensions/chromium/suppress-update.js index b150112f9..f75d4ec71 100644 --- a/extensions/chromium/suppress-update.js +++ b/extensions/chromium/suppress-update.js @@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* globals chrome */ 'use strict'; diff --git a/extensions/chromium/telemetry.js b/extensions/chromium/telemetry.js index fa03b912b..41ece6e1f 100644 --- a/extensions/chromium/telemetry.js +++ b/extensions/chromium/telemetry.js @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ /* eslint strict: ["error", "function"] */ -/* globals chrome, crypto, Headers, Request */ (function() { 'use strict'; diff --git a/extensions/firefox/.eslintrc b/extensions/firefox/.eslintrc index 9f7c5e5f1..e6ace0bb3 100644 --- a/extensions/firefox/.eslintrc +++ b/extensions/firefox/.eslintrc @@ -8,7 +8,18 @@ "sourceType": "script" }, + "plugins": [ + "mozilla" + ], + + "globals": { + "Components": false, + "dump": false + }, + "rules": { + "mozilla/import-globals": "error", + // Best Practices "consistent-return": "error", diff --git a/extensions/firefox/bootstrap.js b/extensions/firefox/bootstrap.js index 1b9881ad2..f5bb8abd1 100644 --- a/extensions/firefox/bootstrap.js +++ b/extensions/firefox/bootstrap.js @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services, dump, XPCOMUtils, PdfStreamConverter, - APP_SHUTDOWN, PdfjsChromeUtils, PdfjsContentUtils */ +/* globals PdfStreamConverter, APP_SHUTDOWN, PdfjsChromeUtils, + PdfjsContentUtils */ "use strict"; diff --git a/extensions/firefox/chrome/content.js b/extensions/firefox/chrome/content.js index 54db0b4d0..8375280f1 100644 --- a/extensions/firefox/chrome/content.js +++ b/extensions/firefox/chrome/content.js @@ -12,8 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services, XPCOMUtils, PdfjsContentUtils, - PdfjsContentUtils, PdfStreamConverter, addMessageListener */ +/* eslint-env mozilla/frame-script */ "use strict"; diff --git a/extensions/firefox/content/PdfJs.jsm b/extensions/firefox/content/PdfJs.jsm index e378e8da9..b307db4e0 100644 --- a/extensions/firefox/content/PdfJs.jsm +++ b/extensions/firefox/content/PdfJs.jsm @@ -12,8 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils, - PdfjsContentUtils, PdfStreamConverter */ "use strict"; diff --git a/extensions/firefox/content/PdfJsNetwork.jsm b/extensions/firefox/content/PdfJsNetwork.jsm index 058365448..4c939a8ea 100644 --- a/extensions/firefox/content/PdfJsNetwork.jsm +++ b/extensions/firefox/content/PdfJsNetwork.jsm @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services */ "use strict"; diff --git a/extensions/firefox/content/PdfJsTelemetry.jsm b/extensions/firefox/content/PdfJsTelemetry.jsm index b57fe9801..608cb0343 100644 --- a/extensions/firefox/content/PdfJsTelemetry.jsm +++ b/extensions/firefox/content/PdfJsTelemetry.jsm @@ -13,7 +13,6 @@ * limitations under the License. */ /* eslint max-len: ["error", 100] */ -/* globals Components, Services */ "use strict"; diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm index 3a80620e8..d75e94f5a 100644 --- a/extensions/firefox/content/PdfStreamConverter.jsm +++ b/extensions/firefox/content/PdfStreamConverter.jsm @@ -12,8 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils, - dump, NetworkManager, PdfJsTelemetry, PdfjsContentUtils */ "use strict"; diff --git a/extensions/firefox/content/PdfjsChromeUtils.jsm b/extensions/firefox/content/PdfjsChromeUtils.jsm index d4cdc2046..8074dd0a5 100644 --- a/extensions/firefox/content/PdfjsChromeUtils.jsm +++ b/extensions/firefox/content/PdfjsChromeUtils.jsm @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services, XPCOMUtils */ "use strict"; diff --git a/extensions/firefox/content/PdfjsContentUtils.jsm b/extensions/firefox/content/PdfjsContentUtils.jsm index 5e86a4e64..4444e16a6 100644 --- a/extensions/firefox/content/PdfjsContentUtils.jsm +++ b/extensions/firefox/content/PdfjsContentUtils.jsm @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, Services, XPCOMUtils */ "use strict"; diff --git a/extensions/firefox/content/pdfjschildbootstrap-enabled.js b/extensions/firefox/content/pdfjschildbootstrap-enabled.js index 93a748921..dda7a7c11 100644 --- a/extensions/firefox/content/pdfjschildbootstrap-enabled.js +++ b/extensions/firefox/content/pdfjschildbootstrap-enabled.js @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, PdfJs, Services */ "use strict"; diff --git a/extensions/firefox/content/pdfjschildbootstrap.js b/extensions/firefox/content/pdfjschildbootstrap.js index d70c15ed5..1d30acdd1 100644 --- a/extensions/firefox/content/pdfjschildbootstrap.js +++ b/extensions/firefox/content/pdfjschildbootstrap.js @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals Components, PdfjsContentUtils */ "use strict"; diff --git a/package.json b/package.json index e3ee2c866..d8e7744e2 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "babel-preset-es2015": "^6.24.1", "escodegen": "^1.8.0", "eslint": "^3.11.1", + "eslint-plugin-mozilla": "^0.2.47", "gulp": "^3.9.1", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4",