Skip to content

Commit

Permalink
Add eslint-plugin-compat.
Browse files Browse the repository at this point in the history
We can check for browser compatibility on lint time now.
  • Loading branch information
XhmikosR committed Sep 26, 2017
1 parent f174437 commit e8d9a03
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/js/src/pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/sw.js').then(function (registration) {
navigator.serviceWorker.register('/sw.js').then(function (registration) { // eslint-disable-line compat/compat
console.log('ServiceWorker registration successful with scope: ', registration.scope)
registration.onupdatefound = function () {
var installingWorker = registration.installing
installingWorker.onstatechange = function () {
switch (installingWorker.state) {
case 'installed':
if (navigator.serviceWorker.controller) {
if (navigator.serviceWorker.controller) { // eslint-disable-line compat/compat
console.log('new update available')
location.reload(true)
}
Expand Down
2 changes: 2 additions & 0 deletions js/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"jquery": true
},
"extends": "eslint:recommended",
"plugins": ["compat"],
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
Expand All @@ -17,6 +18,7 @@
"no-extra-parens": "error",
"no-prototype-builtins": "error",
"no-template-curly-in-string": "error",
"compat/compat": "error",
"valid-jsdoc": "error",

// Best Practices
Expand Down
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"clean-css-cli": "^4.1.6",
"cross-env": "^5.0.5",
"eslint": "^4.2.0",
"eslint-plugin-compat": "^1.0.4",
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-saucelabs": "^9.0.0",
Expand Down

0 comments on commit e8d9a03

Please sign in to comment.