Skip to content

Commit 49d0f30

Browse files
prepare documentation
1 parent c4b20ca commit 49d0f30

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

docs/rules/force-types-on-object-props.md

+68-5
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,82 @@ description: xxx
1212

1313
## :book: Rule Details
1414

15-
This rule ....
15+
Prevent missing type declaration of not primitive objects in a TypeScript projects.
16+
17+
Bad:
1618

1719
<eslint-code-block :rules="{'vue/force-types-on-object-props': ['error']}">
1820

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>
2132

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+
}
2343
```
2444

2545
</eslint-code-block>
2646

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
2879

2980
Nothing.
3081

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)

0 commit comments

Comments
 (0)