File tree Expand file tree Collapse file tree 1 file changed +24
-20
lines changed Expand file tree Collapse file tree 1 file changed +24
-20
lines changed Original file line number Diff line number Diff line change @@ -18,44 +18,48 @@ It will catch most commonly made mistakes which are using strings instead of con
18
18
19
19
## Rule Details
20
20
21
- Examples of ** incorrect ** code for this rule:
22
-
23
- ``` js
21
+ < eslint- code-block :rules = " {'vue/require-prop-type-constructor': ['error']} " >
22
+ ``` vue
23
+ <script>
24
24
export default {
25
25
props: {
26
- myProp: " Number" ,
27
- anotherProp: [" Number" , " String" ],
26
+ /* ✓ GOOD */
27
+ myProp: Number,
28
+ anotherProp: [Number, String],
28
29
myFieldWithBadType: {
29
- type: " Object" ,
30
+ type: Object,
30
31
default: function() {
31
32
return {}
32
33
},
33
34
},
34
35
myOtherFieldWithBadType: {
35
- type: " Number" ,
36
+ type: Number,
36
37
default: 1,
37
38
},
38
- }
39
- }
40
- ```
41
-
42
- Examples of ** correct** code for this rule:
43
-
44
- ``` js
45
- export default {
46
- props: {
47
- myProp: Number ,
48
- anotherProp: [Number , String ],
39
+ /* ✗ BAD */
40
+ myProp: "Number",
41
+ anotherProp: ["Number", "String"],
49
42
myFieldWithBadType: {
50
- type: Object ,
43
+ type: " Object" ,
51
44
default: function() {
52
45
return {}
53
46
},
54
47
},
55
48
myOtherFieldWithBadType: {
56
- type: Number ,
49
+ type: " Number" ,
57
50
default: 1,
58
51
},
59
52
}
60
53
}
54
+ </script>
61
55
```
56
+ </eslint-code-block >
57
+
58
+ ## :wrench : Options
59
+
60
+ Nothing.
61
+
62
+ ## :mag : Implementation
63
+
64
+ - [ Rule source] ( https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/require-prop-type-constructor.js )
65
+ - [ Test source] ( https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/require-prop-type-constructor.js )
You can’t perform that action at this time.
0 commit comments