Skip to content

Commit e82968e

Browse files
committed
chore: apply lint fix
1 parent 1df33ed commit e82968e

11 files changed

+198
-177
lines changed

.eslintrc.js

+15-9
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@ module.exports = {
33
env: {
44
node: true
55
},
6-
extends: ["plugin:vue/essential", "@vue/prettier"],
6+
extends: ['plugin:vue/essential', '@vue/prettier'],
77
rules: {
8-
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9-
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
8+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
9+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
10+
'prettier/prettier': [
11+
'warn',
12+
{
13+
semi: false,
14+
singleQuote: true,
15+
printWidth: 120,
16+
arrowParens: 'always'
17+
}
18+
]
1019
},
1120
parserOptions: {
12-
parser: "babel-eslint"
21+
parser: 'babel-eslint'
1322
},
1423
overrides: [
1524
{
16-
files: [
17-
"**/__tests__/*.{j,t}s?(x)",
18-
"**/tests/unit/**/*.spec.{j,t}s?(x)"
19-
],
25+
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
2026
env: {
2127
jest: true
2228
}
2329
}
2430
]
25-
};
31+
}

babel.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ["@vue/cli-plugin-babel/preset"]
3-
};
2+
presets: ['@vue/cli-plugin-babel/preset']
3+
}

jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
preset: "@vue/cli-plugin-unit-jest"
3-
};
2+
preset: '@vue/cli-plugin-unit-jest'
3+
}

postcss.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module.exports = {
22
plugins: {
33
autoprefixer: {}
44
}
5-
};
5+
}

src/directive.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import masker from './masker'
22
import tokens from './tokens'
33

44
// https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events#The_old-fashioned_way
5-
function event (name) {
5+
function event(name) {
66
var evt = document.createEvent('Event')
77
evt.initEvent(name, true, true)
88
return evt
99
}
1010

11-
export default function (el, binding) {
11+
export default function(el, binding) {
1212
var config = binding.value || {}
1313
if (Array.isArray(config) || typeof config === 'string') {
1414
config = {
@@ -21,20 +21,20 @@ export default function (el, binding) {
2121
if (el.tagName.toLocaleUpperCase() !== 'INPUT') {
2222
var els = el.getElementsByTagName('input')
2323
if (els.length !== 1) {
24-
throw new Error("v-mask directive requires 1 input, found " + els.length)
24+
throw new Error('v-mask directive requires 1 input, found ' + els.length)
2525
} else {
2626
el = els[0]
2727
}
2828
}
2929

30-
el.oninput = function ({isTrusted, data}) {
30+
el.oninput = function({ isTrusted, data }) {
3131
if (!isTrusted) return // avoid infinite loop
3232

3333
// by default, keep cursor at same position as before the mask
3434
var position = el.selectionEnd
3535
let cursorAtEnd = data && position == el.value.length
3636
// save the character just inserted
37-
var digit = el.value[position-1]
37+
var digit = el.value[position - 1]
3838
el.value = masker(el.value, config.mask, config.masked, config.tokens)
3939

4040
if (el === document.activeElement) {
@@ -43,15 +43,15 @@ export default function (el, binding) {
4343
} else if (digit) {
4444
let newPosition = position
4545
// if the digit was changed, increment position until find the digit again
46-
while (newPosition <= el.value.length && el.value.charAt(newPosition-1) !== digit) {
46+
while (newPosition <= el.value.length && el.value.charAt(newPosition - 1) !== digit) {
4747
newPosition++
4848
}
4949
// if we didnt find the digit must be a bad digit, leave the cursor where it was
5050
position = newPosition <= el.value.length ? newPosition : position - 1
5151
}
5252

5353
el.setSelectionRange(position, position)
54-
setTimeout(function () {
54+
setTimeout(function() {
5555
el.setSelectionRange(position, position)
5656
}, 0)
5757
}

0 commit comments

Comments
 (0)