8000 require-prop-type-constructor · vuejs/eslint-plugin-vue@5dda9a0 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5dda9a0

Browse files
armano2michalsnik
authored andcommitted
require-prop-type-constructor
1 parent 029c14a commit 5dda9a0

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

docs/rules/require-prop-type-constructor.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,48 @@ It will catch most commonly made mistakes which are using strings instead of con
1818

1919
## Rule Details
2020

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>
2424
export default {
2525
props: {
26-
myProp: "Number",
27-
anotherProp: ["Number", "String"],
26+
/* ✓ GOOD */
27+
myProp: Number,
28+
anotherProp: [Number, String],
2829
myFieldWithBadType: {
29-
type: "Object",
30+
type: Object,
3031
default: function() {
3132
return {}
3233
},
3334
},
3435
myOtherFieldWithBadType: {
35-
type: "Number",
36+
type: Number,
3637
default: 1,
3738
},
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"],
4942
myFieldWithBadType: {
50-
type: Object,
43+
type: "Object",
5144
default: function() {
5245
return {}
5346
},
5447
},
5548
myOtherFieldWithBadType: {
56-
type: Number,
49+
type: "Number",
5750
default: 1,
5851
},
5952
}
6053
}
54+
</script>
6155
```
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)

0 commit comments

Comments
 (0)
0