Skip to content

Commit

Permalink
Use eslint-plugin-mozilla and the webextensions environment to avoid …
Browse files Browse the repository at this point in the history
…defining globals in each file.
  • Loading branch information
Standard8 committed May 17, 2017
1 parent e9cbfbc commit 2e9ae50
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 26 deletions.
9 changes: 9 additions & 0 deletions extensions/chromium/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
../../.eslintrc
],

"env": {
"webextensions": true
},

"plugins": [
"mozilla"
],

"parserOptions": {
"sourceType": "script"
},

"rules": {
"mozilla/import-globals": "error",
"object-shorthand": "off",
},
}
1 change: 0 additions & 1 deletion extensions/chromium/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/extension-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/feature-detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/options/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/pageAction/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion extensions/chromium/pdfHandler-vcros.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 2 additions & 1 deletion extensions/chromium/pdfHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
3 changes: 1 addition & 2 deletions extensions/chromium/preserve-referer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
/**
Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/suppress-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 0 additions & 1 deletion extensions/chromium/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
11 changes: 11 additions & 0 deletions extensions/firefox/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@
"sourceType": "script"
},

"plugins": [
"mozilla"
],

"globals": {
"Components": false,
"dump": false
},

"rules": {
"mozilla/import-globals": "error",

// Best Practices
"consistent-return": "error",

Expand Down
4 changes: 2 additions & 2 deletions extensions/firefox/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 1 addition & 2 deletions extensions/firefox/chrome/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 0 additions & 2 deletions extensions/firefox/content/PdfJs.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
1 change: 0 additions & 1 deletion extensions/firefox/content/PdfJsNetwork.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Components, Services */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion extensions/firefox/content/PdfJsTelemetry.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* limitations under the License.
*/
/* eslint max-len: ["error", 100] */
/* globals Components, Services */

"use strict";

Expand Down
2 changes: 0 additions & 2 deletions extensions/firefox/content/PdfStreamConverter.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
1 change: 0 additions & 1 deletion extensions/firefox/content/PdfjsChromeUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Components, Services, XPCOMUtils */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion extensions/firefox/content/PdfjsContentUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Components, Services, XPCOMUtils */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion extensions/firefox/content/pdfjschildbootstrap-enabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Components, PdfJs, Services */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion extensions/firefox/content/pdfjschildbootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Components, PdfjsContentUtils */

"use strict";

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2e9ae50

Please sign in to comment.