File tree 1 file changed +68
-5
lines changed
1 file changed +68
-5
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,82 @@ description: xxx
12
12
13
13
## :book : Rule Details
14
14
15
- This rule ....
15
+ Prevent missing type declaration of not primitive objects in a TypeScript projects.
16
+
17
+ Bad:
16
18
17
19
<eslint-code-block :rules =" {'vue/force-types-on-object-props': ['error']} " >
18
20
19
- ``` vue
20
- <template>
21
+ ``` js
22
+ export default {
23
+ props: {
24
+ prop: {
25
+ type: Object ,
26
+ },
27
+ },
28
+ }
29
+ ```
30
+
31
+ </eslint-code-block >
21
32
22
- </template>
33
+ <eslint-code-block :rules =" {'vue/force-types-on-object-props': ['error']} " >
34
+
35
+ ``` ts
36
+ export default {
37
+ props: {
38
+ prop: {
39
+ type: Array
40
+ }
41
+ }
42
+ }
23
43
```
24
44
25
45
</eslint-code-block >
26
46
27
- ## :wrench : Options
47
+ Good:
48
+
49
+ <eslint-code-block :rules =" {'vue/force-types-on-object-props': ['error']} " >
50
+
51
+ ``` ts
52
+ export default {
53
+ props: {
54
+ prop: {
55
+ type: Object as Props <Anything >,
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ </eslint-code-block >
62
+
63
+ <eslint-code-block :rules =" {'vue/force-types-on-object-props': ['error']} " >
64
+
65
+ ``` ts
66
+ export default {
67
+ props: {
68
+ prop: {
69
+ type: String , // or any other primitive type
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ </eslint-code-block >
76
+
77
+
78
+ ### Options
28
79
29
80
Nothing.
30
81
82
+ ## When Not To Use It
83
+
84
+ When you're not using TypeScript in the project.
85
+
86
+ ## Further Reading
87
+
88
+ Nothing
89
+
90
+ ## :mag : Implementation
91
+
92
+ - [ Rule source] ( https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/force-types-on-object-props.js )
93
+ - [ Test source] ( https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/force-types-on-object-props.js )
You can’t perform that action at this time.
0 commit comments