Add eslint-plugin-compat.

We can check for browser compatibility on lint time now.
This commit is contained in:
XhmikosR 2017-09-17 08:42:53 +03:00
parent f17443748d
commit e8d9a034d0
4 changed files with 41 additions and 2 deletions

View File

@ -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)
}

View File

@ -7,6 +7,7 @@
"jquery": true
},
"extends": "eslint:recommended",
"plugins": ["compat"],
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
@ -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

36
package-lock.json generated
View File

@ -1071,6 +1071,12 @@
"map-obj": "1.0.1"
}
},
"caniuse-db": {
"version": "1.0.30000671",
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000671.tgz",
"integrity": "sha1-nwcbvHuWmUY4zLr0eCnVihV3qO0=",
"dev": true
},
"caniuse-lite": {
"version": "1.0.30000732",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000732.tgz",
@ -1771,6 +1777,30 @@
}
}
},
"eslint-plugin-compat": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-1.0.4.tgz",
"integrity": "sha512-16yjDdjrivRQT7/Kov+3O6DMvfg8WYC1JKPAsvf/UNtdLBeMXVYATohAM4nOak1ynGP69mKUlOjw7nroUqY9Sg==",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"browserslist": "2.1.4",
"caniuse-db": "1.0.30000671",
"requireindex": "1.1.0"
},
"dependencies": {
"browserslist": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.1.4.tgz",
"integrity": "sha1-zFJq9KExK30uBWU+VtDIq3DA4FM=",
"dev": true,
"requires": {
"caniuse-lite": "1.0.30000730",
"electron-to-chromium": "1.3.21"
}
}
}
},
"eslint-scope": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz",
@ -5501,6 +5531,12 @@
"resolve-from": "1.0.1"
}
},
"requireindex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz",
"integrity": "sha1-5UBLgVV+91225JxacgBIk/4D4WI=",
"dev": true
},
"resolve": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz",

View File

@ -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",