From 1464b4e2e8ef678985e389073eaa40a47a369693 Mon Sep 17 00:00:00 2001 From: Alex Gibson Date: Thu, 3 Mar 2016 10:59:26 +0000 Subject: [PATCH] Update ESLint config and define globals --- .eslintignore | 2 ++ .eslintrc.js | 4 ++++ media/js/base/dnt-helper.js | 2 ++ media/js/base/global-init.js | 3 +++ media/js/base/global.js | 2 ++ media/js/firefox/dev-firstrun.js | 2 ++ media/js/firefox/dev-whatsnew.js | 2 ++ media/js/firefox/developer.js | 2 ++ media/js/firefox/geolocation-demo.js | 2 ++ media/js/firefox/private-browsing.js | 2 ++ media/js/mozorg/contact-spaces.js | 2 ++ media/js/newsletter/form.js | 2 ++ media/js/plugincheck/check-plugins.js | 3 +++ media/js/plugincheck/lib/version-compare.js | 2 ++ media/js/plugincheck/tmpl/plugincheck.ui.tmpl.js | 3 +++ media/js/teach/smarton-landing.js | 2 ++ media/js/teach/smarton.js | 3 ++- 17 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..db074f2c1d --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +/media/js/styleguide/logo-prototype/vendor/ +/media/js/plugincheck/lib/mustache.js diff --git a/.eslintrc.js b/.eslintrc.js index 1ee929dafe..edbe8d3439 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,5 +23,9 @@ module.exports = { 2, "always" ] + }, + "globals": { + "Mozilla": true, + "site": true } }; diff --git a/media/js/base/dnt-helper.js b/media/js/base/dnt-helper.js index eb7522ea5b..ca30adeace 100644 --- a/media/js/base/dnt-helper.js +++ b/media/js/base/dnt-helper.js @@ -1,3 +1,5 @@ +/* exported _dntEnabled */ + /** * Returns true or false based on whether doNotTack is enabled. It also takes into account the * anomalies, such as !bugzilla 887703, which effect versions of Fx 31 and lower. It also handles diff --git a/media/js/base/global-init.js b/media/js/base/global-init.js index 2eeb7d502a..c86dd616d3 100644 --- a/media/js/base/global-init.js +++ b/media/js/base/global-init.js @@ -1,3 +1,6 @@ +/* global init_download_links, init_mobile_download_links, + update_download_text_for_old_fx, init_lang_switcher */ + // init global.js functions $(document).ready(function() { init_download_links(); diff --git a/media/js/base/global.js b/media/js/base/global.js index d86fb96c0e..f3ca1e153f 100644 --- a/media/js/base/global.js +++ b/media/js/base/global.js @@ -2,6 +2,8 @@ * 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/. */ +/* exported trigger_ie_download, init_download_links, update_download_text_for_old_fx, + init_mobile_download_links, init_lang_switcher */ // download buttons diff --git a/media/js/firefox/dev-firstrun.js b/media/js/firefox/dev-firstrun.js index c9c25e6ffe..3ae41bd748 100644 --- a/media/js/firefox/dev-firstrun.js +++ b/media/js/firefox/dev-firstrun.js @@ -2,6 +2,8 @@ * 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 YT */ + // YouTube API hook has to be in global scope function onYouTubeIframeAPIReady() { 'use strict'; diff --git a/media/js/firefox/dev-whatsnew.js b/media/js/firefox/dev-whatsnew.js index 1ddb6a0465..b02001908e 100644 --- a/media/js/firefox/dev-whatsnew.js +++ b/media/js/firefox/dev-whatsnew.js @@ -2,6 +2,8 @@ * 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 YT */ + // YouTube API hook has to be in global scope // Videos are not yet ready for the whatsnew features (Performance Tools diff --git a/media/js/firefox/developer.js b/media/js/firefox/developer.js index bb49e6f3f1..67cf452f92 100644 --- a/media/js/firefox/developer.js +++ b/media/js/firefox/developer.js @@ -2,6 +2,8 @@ * 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 YT */ + // YouTube API hook has to be in global scope function onYouTubeIframeAPIReady() { Mozilla.firstRunOnYouTubeIframeAPIReady(); diff --git a/media/js/firefox/geolocation-demo.js b/media/js/firefox/geolocation-demo.js index b9fba83146..150ab1d1ed 100644 --- a/media/js/firefox/geolocation-demo.js +++ b/media/js/firefox/geolocation-demo.js @@ -2,6 +2,8 @@ * 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 L */ + $(document).ready(function() { var map = null; var circle = null; diff --git a/media/js/firefox/private-browsing.js b/media/js/firefox/private-browsing.js index 8a1b0c16c6..85dcaff060 100644 --- a/media/js/firefox/private-browsing.js +++ b/media/js/firefox/private-browsing.js @@ -2,6 +2,8 @@ * 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 Waypoint */ + ;(function($) { 'use strict'; diff --git a/media/js/mozorg/contact-spaces.js b/media/js/mozorg/contact-spaces.js index 098d621c1b..e44e66e581 100644 --- a/media/js/mozorg/contact-spaces.js +++ b/media/js/mozorg/contact-spaces.js @@ -2,6 +2,8 @@ * 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 L */ + (function($) { 'use strict'; diff --git a/media/js/newsletter/form.js b/media/js/newsletter/form.js index 3d8c9ca61f..e575aa286b 100644 --- a/media/js/newsletter/form.js +++ b/media/js/newsletter/form.js @@ -2,6 +2,8 @@ * 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 Spinner */ + $(function () { 'use strict'; diff --git a/media/js/plugincheck/check-plugins.js b/media/js/plugincheck/check-plugins.js index 4cee22de1c..8be4707fb8 100644 --- a/media/js/plugincheck/check-plugins.js +++ b/media/js/plugincheck/check-plugins.js @@ -1,3 +1,6 @@ +/* global PluginCheck, Mustache, vulnerablePluginsTmpl, outdatedPluginsTmpl, + unknownPluginsTmpl, upToDatePluginsTmpl */ + $(function() { 'use strict'; diff --git a/media/js/plugincheck/lib/version-compare.js b/media/js/plugincheck/lib/version-compare.js index 25a1af007e..daad3aa7b3 100644 --- a/media/js/plugincheck/lib/version-compare.js +++ b/media/js/plugincheck/lib/version-compare.js @@ -1,3 +1,5 @@ +/* exported versionCompare */ + /** * Compares two software version numbers (e.g. "1.7.1" or "1.2b"). * diff --git a/media/js/plugincheck/tmpl/plugincheck.ui.tmpl.js b/media/js/plugincheck/tmpl/plugincheck.ui.tmpl.js index 62737b8563..d04582dad6 100644 --- a/media/js/plugincheck/tmpl/plugincheck.ui.tmpl.js +++ b/media/js/plugincheck/tmpl/plugincheck.ui.tmpl.js @@ -1,3 +1,6 @@ +/* exported vulnerablePluginsTmpl, outdatedPluginsTmpl, unknownPluginsTmpl, + upToDatePluginsTmpl */ + var vulnerablePluginsTmpl = '{{#vulnerablePlugins}} ' + '' + '{{plugin_name}}' + diff --git a/media/js/teach/smarton-landing.js b/media/js/teach/smarton-landing.js index 96e81e34b1..cf9033514a 100644 --- a/media/js/teach/smarton-landing.js +++ b/media/js/teach/smarton-landing.js @@ -2,6 +2,8 @@ * 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 mina, Snap */ + ;(function($) { 'use strict'; diff --git a/media/js/teach/smarton.js b/media/js/teach/smarton.js index 43dbe2f541..1f6997bc64 100644 --- a/media/js/teach/smarton.js +++ b/media/js/teach/smarton.js @@ -2,6 +2,8 @@ * 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 Waypoint, Circles */ + ;(function($) { 'use strict'; @@ -237,4 +239,3 @@ }); })(window.jQuery); -