Skip to content

Commit aa6db60

Browse files
committed
refactor: eslint fixes
1 parent d6b5fd1 commit aa6db60

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

.eslintrc.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ module.exports = {
55
browser: true,
66
node: true
77
},
8-
extends: 'standard',
8+
extends: [
9+
'plugin:vue/recommended',
10+
'@vue/standard',
11+
],
912
plugins: [
1013
"cypress"
1114
],
12-
// add your custom rules here
13-
rules: {},
14-
globals: {}
15+
parserOptions: {
16+
parser: 'babel-eslint'
17+
},
18+
rules: {
19+
'no-console': 'off'
20+
}
1521
}

src/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axeCore from 'axe-core'
22
import debounce from 'lodash.debounce'
3-
import { checkAndReport, resetCache, resetLastNotification } from './utils'
43
import { OPTIONS_DEFAULT } from './constants'
4+
import { checkAndReport, resetCache, resetLastNotification } from './utils'
55

66
export default function install (Vue, options) {
77
// Browser only
@@ -21,6 +21,13 @@ export default function install (Vue, options) {
2121

2222
// Rechecking when updating specific component
2323
Vue.mixin({
24+
updated () {
25+
this.debounceAxe()
26+
},
27+
// Used for change of route
28+
beforeDestroy () {
29+
this.clearAxeConsole(true)
30+
},
2431
methods: {
2532
clearAxeConsole (forceClear = false) {
2633
resetCache()
@@ -37,13 +44,6 @@ export default function install (Vue, options) {
3744
checkAndReport(options, this.$el)
3845
})
3946
}, 1000, { maxWait: 5000 })
40-
},
41-
updated () {
42-
this.debounceAxe()
43-
},
44-
// Used for change of route
45-
beforeDestroy () {
46-
this.clearAxeConsole(true)
4747
}
4848
})
4949

src/utils.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import axeCore from 'axe-core'
2-
import {
3-
IMPACT,
4-
STYLE
5-
} from './constants'
2+
import { IMPACT, STYLE } from './constants'
63

74
let cache = {}
8-
let nodes = []
9-
let deferred = {}
5+
const nodes = []
6+
const deferred = {}
107
let lastNotification = ''
118

129
export function checkAndReport (options, node) {
1310
nodes.push(node)
14-
let deferred = createDeferred()
11+
const deferred = createDeferred()
1512

1613
axeCore.run(document, options.runOptions, (error, results) => {
1714
if (error) deferred.reject(error)
@@ -34,8 +31,8 @@ export function checkAndReport (options, node) {
3431
const standardResultHandler = function (errorInfo, results) {
3532
results.violations = results.violations.filter(result => {
3633
result.nodes = result.nodes.filter(node => {
37-
let key = node.target.toString() + result.id
38-
let retVal = (!cache[key])
34+
const key = node.target.toString() + result.id
35+
const retVal = (!cache[key])
3936
cache[key] = key
4037
return retVal
4138
})
@@ -45,7 +42,7 @@ const standardResultHandler = function (errorInfo, results) {
4542
if (results.violations.length) {
4643
console.group('%cNew aXe issues', STYLE.head)
4744
results.violations.forEach(result => {
48-
let styl = IMPACT.hasOwnProperty(result.impact) ? IMPACT[result.impact] : IMPACT.minor
45+
const styl = IMPACT[result.impact] || IMPACT.minor
4946
console.groupCollapsed('%c%s: %c%s %s', STYLE[styl], result.impact, STYLE.defaultReset, result.help, result.helpUrl)
5047
result.nodes.forEach(function (node) {
5148
failureSummary(node, 'any')

0 commit comments

Comments
 (0)