eslint-plugin-crisp 1.5.13 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build.yml +6 -0
- package/README.md +2 -1
- package/index.js +2 -0
- package/package.json +9 -1
- package/recommended-vue.js +1 -0
- package/rules/align-comments.js +6 -3
- package/rules/constructor-variables.js +17 -2
- package/rules/header-check.js +8 -2
- package/rules/header-comments-check.js +10 -13
- package/rules/import-group-comment.js +13 -4
- package/rules/jsdoc-enforce-access.js +16 -10
- package/rules/no-extra-line-within-function.js +8 -5
- package/rules/no-short-parameters.js +1 -1
- package/rules/no-snake-case.js +0 -24
- package/rules/no-space-in-optional-arguments.js +5 -2
- package/rules/one-space-after-operator.js +59 -14
- package/rules/vue-header-check.js +4 -3
- package/rules/vue-no-regex-data.js +1 -2
- package/rules/vue-pinia-action-single-parameter.js +158 -0
- package/rules/vue-props-declaration-line-break.js +8 -3
- package/rules/vue-watch-handler.js +34 -1
- package/tests/fixtures/vue-header-check/missing-script-style/TestComponent.vue +19 -0
- package/tests/fixtures/vue-header-check/missing-template/TestComponent.vue +3 -0
- package/tests/fixtures/vue-header-check/valid/TestComponent.vue +27 -0
- package/tests/rule-tester.js +78 -0
- package/tests/rules/align-comments.test.js +25 -0
- package/tests/rules/align-consecutive-class-assignements.test.js +24 -0
- package/tests/rules/align-one-var.test.js +31 -0
- package/tests/rules/align-requires.test.js +27 -0
- package/tests/rules/arrow-block-newline.test.js +23 -0
- package/tests/rules/consecutive-line-comments.test.js +27 -0
- package/tests/rules/const.test.js +52 -0
- package/tests/rules/constructor-variables.test.js +52 -0
- package/tests/rules/enforce-optional.test.js +24 -0
- package/tests/rules/header-check.test.js +69 -0
- package/tests/rules/header-comments-check.test.js +89 -0
- package/tests/rules/import-group-comment.test.js +88 -0
- package/tests/rules/import-group-order.test.js +58 -0
- package/tests/rules/jsdoc-align-params.test.js +32 -0
- package/tests/rules/jsdoc-check-indentation.test.js +45 -0
- package/tests/rules/jsdoc-check-optional-params.test.js +40 -0
- package/tests/rules/jsdoc-description-length.test.js +60 -0
- package/tests/rules/jsdoc-description-multiline.test.js +34 -0
- package/tests/rules/jsdoc-enforce-access.test.js +66 -0
- package/tests/rules/jsdoc-enforce-classdesc.test.js +39 -0
- package/tests/rules/jsdoc-no-param-return.test.js +47 -0
- package/tests/rules/jsdoc-require-description-uppercase.test.js +52 -0
- package/tests/rules/methods-naming.test.js +70 -0
- package/tests/rules/methods-ordering.test.js +75 -0
- package/tests/rules/multiline-comment-end-backslash.test.js +52 -0
- package/tests/rules/newline-after-switch-case.test.js +75 -0
- package/tests/rules/no-async.test.js +57 -0
- package/tests/rules/no-extra-line-within-function.test.js +87 -0
- package/tests/rules/no-inline-function-in-ternary.test.js +59 -0
- package/tests/rules/no-short-parameters.test.js +62 -0
- package/tests/rules/no-snake-case.test.js +81 -0
- package/tests/rules/no-space-in-optional-arguments.test.js +40 -0
- package/tests/rules/no-useless-template-literals.test.js +36 -0
- package/tests/rules/no-var-in-blocks.test.js +40 -0
- package/tests/rules/one-space-after-operator.test.js +69 -0
- package/tests/rules/regex-in-constructor.test.js +40 -0
- package/tests/rules/ternary-parenthesis.test.js +34 -0
- package/tests/rules/two-lines-between-class-members.test.js +62 -0
- package/tests/rules/variable-names.test.js +60 -0
- package/tests/rules/vue-attribute-comma.test.js +43 -0
- package/tests/rules/vue-attribute-linebreak.test.js +54 -0
- package/tests/rules/vue-class-attribute-last.test.js +59 -0
- package/tests/rules/vue-class-shorthand-max-len.test.js +67 -0
- package/tests/rules/vue-computed-order.test.js +27 -0
- package/tests/rules/vue-data-comment.test.js +61 -0
- package/tests/rules/vue-define-component.test.js +45 -0
- package/tests/rules/vue-emits-order.test.js +27 -0
- package/tests/rules/vue-header-check.test.js +49 -0
- package/tests/rules/vue-html-indent.test.js +77 -0
- package/tests/rules/vue-html-quotes.test.js +71 -0
- package/tests/rules/vue-methods-separator.test.js +55 -0
- package/tests/rules/vue-name-prop.test.js +59 -0
- package/tests/rules/vue-no-component-class-shorthand.test.js +49 -0
- package/tests/rules/vue-no-mixed-class.test.js +56 -0
- package/tests/rules/vue-no-name-option.test.js +44 -0
- package/tests/rules/vue-no-regex-data.test.js +39 -0
- package/tests/rules/vue-pinia-action-single-parameter.test.js +234 -0
- package/tests/rules/vue-props-declaration-line-break.test.js +68 -0
- package/tests/rules/vue-props-declaration-multiline.test.js +40 -0
- package/tests/rules/vue-props-declaration-order.test.js +27 -0
- package/tests/rules/vue-ref-case.test.js +40 -0
- package/tests/rules/vue-watch-handler.test.js +89 -0
- package/tests/rules-coverage.test.js +19 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import rule from "../../rules/vue-pinia-action-single-parameter.js";
|
|
2
|
+
import createRuleTester from "../rule-tester.js";
|
|
3
|
+
|
|
4
|
+
const ruleTester = createRuleTester({
|
|
5
|
+
languageOptions: {
|
|
6
|
+
ecmaVersion: 2020,
|
|
7
|
+
sourceType: "module"
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
ruleTester.run("vue-pinia-action-single-parameter", rule, {
|
|
12
|
+
valid: [
|
|
13
|
+
{
|
|
14
|
+
code: `
|
|
15
|
+
import { defineStore } from "pinia";
|
|
16
|
+
|
|
17
|
+
const useStore = defineStore("example", {
|
|
18
|
+
actions: {
|
|
19
|
+
reset() {},
|
|
20
|
+
setValue(value) {},
|
|
21
|
+
updateValue({ id, value }) {},
|
|
22
|
+
updatePair([id, value]) {},
|
|
23
|
+
setOptionalValue(value = null) {}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
`
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
code: `
|
|
30
|
+
import { defineStore } from "pinia";
|
|
31
|
+
|
|
32
|
+
defineStore("example", {
|
|
33
|
+
actions: {
|
|
34
|
+
reset: function() {},
|
|
35
|
+
setValue: function(value) {},
|
|
36
|
+
updateValue: ({ id, value }) => {},
|
|
37
|
+
updatePair: ([id, value]) => {},
|
|
38
|
+
setOptionalValue: (value = null) => {}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
`
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
code: `
|
|
45
|
+
import { defineStore as definePiniaStore } from "pinia";
|
|
46
|
+
|
|
47
|
+
definePiniaStore("example", {
|
|
48
|
+
"actions": {
|
|
49
|
+
reset() {},
|
|
50
|
+
setValue(value) {}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
`
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
code: `
|
|
57
|
+
import { defineStore } from "pinia";
|
|
58
|
+
|
|
59
|
+
function outside(first, second) {}
|
|
60
|
+
|
|
61
|
+
defineStore("example", {
|
|
62
|
+
state: (first, second) => ({}),
|
|
63
|
+
getters: {
|
|
64
|
+
combined(first, second) {}
|
|
65
|
+
},
|
|
66
|
+
actions: {
|
|
67
|
+
run(payload) {
|
|
68
|
+
return function nested(first, second) {};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
`
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
code: `
|
|
76
|
+
import { defineStore } from "pinia";
|
|
77
|
+
|
|
78
|
+
const unrelated = {
|
|
79
|
+
actions: {
|
|
80
|
+
update(first, second) {},
|
|
81
|
+
forward(...args) {}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
`
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
code: `
|
|
88
|
+
import { defineStore } from "pinia";
|
|
89
|
+
|
|
90
|
+
const useStore = defineStore("example", (first, second) => {
|
|
91
|
+
function nested(third, fourth) {}
|
|
92
|
+
|
|
93
|
+
return {};
|
|
94
|
+
});
|
|
95
|
+
`
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
code: `
|
|
99
|
+
import { defineStore } from "another-package";
|
|
100
|
+
|
|
101
|
+
defineStore("example", {
|
|
102
|
+
actions: {
|
|
103
|
+
update(first, second) {}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
`
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
code: `
|
|
110
|
+
import pinia, { defineStore as importedDefineStore } from "pinia";
|
|
111
|
+
|
|
112
|
+
function wrapper(importedDefineStore) {
|
|
113
|
+
importedDefineStore("example", {
|
|
114
|
+
actions: {
|
|
115
|
+
update(first, second) {}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
pinia.defineStore("example", {
|
|
121
|
+
actions: {
|
|
122
|
+
update(first, second) {}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
`
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
code: `
|
|
129
|
+
import { defineStore } from "pinia";
|
|
130
|
+
|
|
131
|
+
const actions = {
|
|
132
|
+
update(first, second) {}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
defineStore("example", { actions });
|
|
136
|
+
`
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
|
|
140
|
+
invalid: [
|
|
141
|
+
{
|
|
142
|
+
code: `
|
|
143
|
+
import { defineStore } from "pinia";
|
|
144
|
+
|
|
145
|
+
defineStore("example", {
|
|
146
|
+
actions: {
|
|
147
|
+
updateValue(id, value) {}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
`,
|
|
151
|
+
errors: [
|
|
152
|
+
{
|
|
153
|
+
messageId: "singlePayloadArgument"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
code: `
|
|
159
|
+
import { defineStore } from "pinia";
|
|
160
|
+
|
|
161
|
+
defineStore("example", {
|
|
162
|
+
actions: {
|
|
163
|
+
updateOther: function(id, value) {}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
`,
|
|
167
|
+
errors: [
|
|
168
|
+
{
|
|
169
|
+
messageId: "singlePayloadArgument"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
code: `
|
|
175
|
+
import { defineStore } from "pinia";
|
|
176
|
+
|
|
177
|
+
defineStore("example", {
|
|
178
|
+
actions: {
|
|
179
|
+
updateArrow: (id, value) => {}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
`,
|
|
183
|
+
errors: [
|
|
184
|
+
{
|
|
185
|
+
messageId: "singlePayloadArgument"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
code: `
|
|
191
|
+
import { defineStore } from "pinia";
|
|
192
|
+
|
|
193
|
+
defineStore("example", {
|
|
194
|
+
actions: {
|
|
195
|
+
forwardArguments(...args) {}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
`,
|
|
199
|
+
errors: [
|
|
200
|
+
{
|
|
201
|
+
messageId: "singlePayloadArgument"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
code: `
|
|
207
|
+
import { defineStore as definePiniaStore } from "pinia";
|
|
208
|
+
|
|
209
|
+
definePiniaStore("example", {
|
|
210
|
+
actions: {
|
|
211
|
+
updateMethod(id, value) {},
|
|
212
|
+
updateFunction: function(id, value, extra) {},
|
|
213
|
+
updateArrow: (id, value = null) => {},
|
|
214
|
+
forward: (...args) => {}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
`,
|
|
218
|
+
errors: [
|
|
219
|
+
{
|
|
220
|
+
messageId: "singlePayloadArgument"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
messageId: "singlePayloadArgument"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
messageId: "singlePayloadArgument"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
messageId: "singlePayloadArgument"
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import rule from "../../rules/vue-props-declaration-line-break.js";
|
|
2
|
+
import createRuleTester from "../rule-tester.js";
|
|
3
|
+
|
|
4
|
+
const ruleTester = createRuleTester();
|
|
5
|
+
|
|
6
|
+
ruleTester.run("vue-props-declaration-line-break", rule, {
|
|
7
|
+
valid: [
|
|
8
|
+
{
|
|
9
|
+
code: `
|
|
10
|
+
export default {
|
|
11
|
+
props: {
|
|
12
|
+
items: {
|
|
13
|
+
type: Array,
|
|
14
|
+
|
|
15
|
+
default: function() { return []; }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
`
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
code: "export default { props: { items: { type: Array, default: () => [] } } };"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
invalid: [
|
|
27
|
+
{
|
|
28
|
+
code:
|
|
29
|
+
"export default { props: { items: { type: Array, " +
|
|
30
|
+
"default: function() { return []; } } } };",
|
|
31
|
+
output:
|
|
32
|
+
"export default { props: { items: { type: Array,\n\n" +
|
|
33
|
+
"default: function() { return []; } } } };",
|
|
34
|
+
errors: [
|
|
35
|
+
{
|
|
36
|
+
message:
|
|
37
|
+
"There should be a line break between 'type' and 'default' " +
|
|
38
|
+
"function in prop definition."
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
code: `export default {
|
|
44
|
+
props: {
|
|
45
|
+
items: {
|
|
46
|
+
type: Array, default: function() { return []; }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};`,
|
|
50
|
+
output: `export default {
|
|
51
|
+
props: {
|
|
52
|
+
items: {
|
|
53
|
+
type: Array,
|
|
54
|
+
|
|
55
|
+
default: function() { return []; }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};`,
|
|
59
|
+
errors: [
|
|
60
|
+
{
|
|
61
|
+
message:
|
|
62
|
+
"There should be a line break between 'type' and 'default' " +
|
|
63
|
+
"function in prop definition."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import rule from "../../rules/vue-props-declaration-multiline.js";
|
|
2
|
+
import createRuleTester from "../rule-tester.js";
|
|
3
|
+
|
|
4
|
+
const ruleTester = createRuleTester();
|
|
5
|
+
|
|
6
|
+
ruleTester.run("vue-props-declaration-multiline", rule, {
|
|
7
|
+
valid: [
|
|
8
|
+
{
|
|
9
|
+
code: `
|
|
10
|
+
export default {
|
|
11
|
+
props: {
|
|
12
|
+
label: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
`
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
code: "export default { props: { enabled: Boolean } };"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
invalid: [
|
|
26
|
+
{
|
|
27
|
+
code: "export default { props: { label: {type: String, required: true} } };",
|
|
28
|
+
output:
|
|
29
|
+
"export default { props: { label: {\n" +
|
|
30
|
+
"type: String,\n" +
|
|
31
|
+
"required: true\n" +
|
|
32
|
+
"} } };",
|
|
33
|
+
errors: [
|
|
34
|
+
{
|
|
35
|
+
message: "Props should be declared in multiple lines."
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import rule from "../../rules/vue-props-declaration-order.js";
|
|
2
|
+
import createRuleTester from "../rule-tester.js";
|
|
3
|
+
|
|
4
|
+
const ruleTester = createRuleTester();
|
|
5
|
+
|
|
6
|
+
ruleTester.run("vue-props-declaration-order", rule, {
|
|
7
|
+
valid: [
|
|
8
|
+
{
|
|
9
|
+
code: "export default { props: { alpha: String, beta: Boolean } };"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
code: "const options = { props: { beta: Boolean, alpha: String } };"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
invalid: [
|
|
17
|
+
{
|
|
18
|
+
code: "export default { props: { beta: Boolean, alpha: String } };",
|
|
19
|
+
output: "export default { props: { alpha: String, beta: Boolean } };",
|
|
20
|
+
errors: [
|
|
21
|
+
{
|
|
22
|
+
message: "Props should be in alphabetical order."
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import rule from "../../rules/vue-ref-case.js";
|
|
2
|
+
import { createVueRuleTester } from "../rule-tester.js";
|
|
3
|
+
|
|
4
|
+
const ruleTester = createVueRuleTester();
|
|
5
|
+
const filename = "TestComponent.vue";
|
|
6
|
+
|
|
7
|
+
ruleTester.run("vue-ref-case", rule, {
|
|
8
|
+
valid: [
|
|
9
|
+
{
|
|
10
|
+
filename,
|
|
11
|
+
code: `<template>
|
|
12
|
+
<input ref="email_input">
|
|
13
|
+
<input :ref="dynamicRef">
|
|
14
|
+
<section ref />
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup>
|
|
18
|
+
const dynamicRef = "email_input";
|
|
19
|
+
</script>`
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
invalid: [
|
|
24
|
+
{
|
|
25
|
+
filename,
|
|
26
|
+
code: `<template>
|
|
27
|
+
<input ref="emailInput">
|
|
28
|
+
<input ref="email-input">
|
|
29
|
+
</template>`,
|
|
30
|
+
errors: [
|
|
31
|
+
{
|
|
32
|
+
message: "Ref attribute \"emailInput\" should be snake-cased."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
message: "Ref attribute \"email-input\" should be snake-cased."
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import rule from "../../rules/vue-watch-handler.js";
|
|
2
|
+
import createRuleTester from "../rule-tester.js";
|
|
3
|
+
|
|
4
|
+
const ruleTester = createRuleTester();
|
|
5
|
+
|
|
6
|
+
ruleTester.run("vue-watch-handler", rule, {
|
|
7
|
+
valid: [
|
|
8
|
+
{
|
|
9
|
+
code: `
|
|
10
|
+
export default {
|
|
11
|
+
watch: {
|
|
12
|
+
ready: { handler() {} },
|
|
13
|
+
value: { handler(value) {} },
|
|
14
|
+
item: { handler(newValue, oldValue) {} }
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
`
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
code: `
|
|
21
|
+
export default {
|
|
22
|
+
watch: {
|
|
23
|
+
value: {
|
|
24
|
+
immediate: true,
|
|
25
|
+
handler: (value) => {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
`
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
code: "const options = { observe: { value(value) {} } };"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
code: "const options = { watch: { value(value) {} } };"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
invalid: [
|
|
40
|
+
{
|
|
41
|
+
code: "export default { watch: { value(value) {} } };",
|
|
42
|
+
errors: [
|
|
43
|
+
{
|
|
44
|
+
messageId: "objectForm"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
code: "export default { watch: { value: { immediate: true } } };",
|
|
50
|
+
errors: [
|
|
51
|
+
{
|
|
52
|
+
messageId: "missingHandler"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
code: "export default { watch: { value: { handler: \"onValue\" } } };",
|
|
58
|
+
errors: [
|
|
59
|
+
{
|
|
60
|
+
messageId: "invalidHandler"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
code: "export default { watch: { value: { handler(current, previous) {} } } };",
|
|
66
|
+
errors: [
|
|
67
|
+
{
|
|
68
|
+
messageId: "invalidSignature"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
code: "export default defineComponent({ watch: { value(value) {} } });",
|
|
74
|
+
errors: [
|
|
75
|
+
{
|
|
76
|
+
messageId: "objectForm"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
code: "export default { \"watch\": { value(value) {} } };",
|
|
82
|
+
errors: [
|
|
83
|
+
{
|
|
84
|
+
messageId: "objectForm"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
|
|
5
|
+
test("every rule has a matching unit test file", async () => {
|
|
6
|
+
const ruleFiles = await readdir(new URL("../rules/", import.meta.url));
|
|
7
|
+
const testFiles = await readdir(new URL("./rules/", import.meta.url));
|
|
8
|
+
|
|
9
|
+
const rules = ruleFiles
|
|
10
|
+
.filter(file => file.endsWith(".js"))
|
|
11
|
+
.map(file => file.slice(0, -3))
|
|
12
|
+
.sort();
|
|
13
|
+
const testedRules = testFiles
|
|
14
|
+
.filter(file => file.endsWith(".test.js"))
|
|
15
|
+
.map(file => file.slice(0, -8))
|
|
16
|
+
.sort();
|
|
17
|
+
|
|
18
|
+
assert.deepEqual(testedRules, rules);
|
|
19
|
+
});
|