Skip to content

Commit 44420b7

Browse files
HcySunYangyyx990803
authored andcommitted
chore: correct the eslint script statement in package.json and correct the format. (#7308)
1 parent 60fb814 commit 44420b7

File tree

2 files changed

+49
-49
lines changed

2 files changed

+49
-49
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"test:ssr": "npm run build:ssr && jasmine JASMINE_CONFIG_PATH=test/ssr/jasmine.json",
3434
"test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2",
3535
"test:types": "tsc -p ./types/test/tsconfig.json",
36-
"lint": "eslint src build test",
36+
"lint": "eslint src scripts test",
3737
"flow": "flow check",
3838
"sauce": "karma start test/unit/karma.sauce.config.js",
3939
"bench:ssr": "npm run build:ssr && node benchmarks/ssr/renderToString.js && node benchmarks/ssr/renderToStream.js",

test/unit/modules/compiler/compiler-options.spec.js

+48-48
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,58 @@ describe('compile options', () => {
99
<input type="text" v-model="msg" required max="8" v-validate:field1.group1.group2>
1010
</div>
1111
`, {
12-
directives: {
13-
validate (el, dir) {
14-
if (dir.name === 'validate' && dir.arg) {
15-
el.validate = {
16-
field: dir.arg,
17-
groups: dir.modifiers ? Object.keys(dir.modifiers) : []
18-
}
12+
directives: {
13+
validate (el, dir) {
14+
if (dir.name === 'validate' && dir.arg) {
15+
el.validate = {
16+
field: dir.arg,
17+
groups: dir.modifiers ? Object.keys(dir.modifiers) : []
1918
}
2019
}
21-
},
22-
modules: [{
23-
transformNode (el) {
24-
el.validators = el.validators || []
25-
const validators = ['required', 'min', 'max', 'pattern', 'maxlength', 'minlength']
26-
validators.forEach(name => {
27-
const rule = getAndRemoveAttr(el, name)
28-
if (rule !== undefined) {
29-
el.validators.push({ name, rule })
30-
}
31-
})
32-
},
33-
genData (el) {
34-
let data = ''
35-
if (el.validate) {
36-
data += `validate:${JSON.stringify(el.validate)},`
37-
}
38-
if (el.validators) {
39-
data += `validators:${JSON.stringify(el.validators)},`
40-
}
41-
return data
42-
},
43-
transformCode (el, code) {
44-
// check
45-
if (!el.validate || !el.validators) {
46-
return code
20+
}
21+
},
22+
modules: [{
23+
transformNode (el) {
24+
el.validators = el.validators || []
25+
const validators = ['required', 'min', 'max', 'pattern', 'maxlength', 'minlength']
26+
validators.forEach(name => {
27+
const rule = getAndRemoveAttr(el, name)
28+
if (rule !== undefined) {
29+
el.validators.push({ name, rule })
4730
}
48-
// setup validation result props
49-
const result = { dirty: false } // define something other prop
50-
el.validators.forEach(validator => {
51-
result[validator.name] = null
52-
})
53-
// generate code
54-
return `_c('validate',{props:{
55-
field:${JSON.stringify(el.validate.field)},
56-
groups:${JSON.stringify(el.validate.groups)},
57-
validators:${JSON.stringify(el.validators)},
58-
result:${JSON.stringify(result)},
59-
child:${code}}
60-
})`
31+
})
32+
},
33+
genData (el) {
34+
let data = ''
35+
if (el.validate) {
36+
data += `validate:${JSON.stringify(el.validate)},`
6137
}
62-
}]
63-
})
38+
if (el.validators) {
39+
data += `validators:${JSON.stringify(el.validators)},`
40+
}
41+
return data
42+
},
43+
transformCode (el, code) {
44+
// check
45+
if (!el.validate || !el.validators) {
46+
return code
47+
}
48+
// setup validation result props
49+
const result = { dirty: false } // define something other prop
50+
el.validators.forEach(validator => {
51+
result[validator.name] = null
52+
})
53+
// generate code
54+
return `_c('validate',{props:{
55+
field:${JSON.stringify(el.validate.field)},
56+
groups:${JSON.stringify(el.validate.groups)},
57+
validators:${JSON.stringify(el.validators)},
58+
result:${JSON.stringify(result)},
59+
child:${code}}
60+
})`
61+
}
62+
}]
63+
})
6464
expect(render).not.toBeUndefined()
6565
expect(staticRenderFns).toEqual([])
6666
expect(errors).toEqual([])

0 commit comments

Comments
 (0)