Skip to content

Commit 8fd60d6

Browse files
authored
docs: regenerate README.md (#470)
Followup after fd838c3 I didn't generate the docs because I misunderstood the contribution guide. This commit fixes it and updates the contribution guide a little bit.
1 parent fd838c3 commit 8fd60d6

File tree

3 files changed

+123
-19
lines changed

3 files changed

+123
-19
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ Run them with `npm test`.
3131

3232
Run with `npm run lint`.
3333

34-
## Submitting a PR
35-
36-
Just before submitting a PR, run `npm run create-readme` to generate the new README.md
37-
3834
## Adding a Rule
3935

4036
### Source & Tests
@@ -51,7 +47,6 @@ Just before submitting a PR, run `npm run create-readme` to generate the new REA
5147
* Use [./.README/rules/require-valid-file-annotation.md](./.README/rules/require-valid-file-annotation.md) as a template.
5248
* Ensure that rule documentation document includes `<!-- assertions spaceAfterTypeColon -->` declaration.
5349
1. Update [./.README/README.md](/.README/README.md) to include the new rule.
54-
55-
A CI service will build and publish the new documentation.
50+
1. Run `npm run create-readme` to generate the new `README.md` (you should be on `master` branch for this command to work)
5651

5752
Note: Sections "The following patterns are considered problems:" and "The following patterns are not considered problems:" are **generated automatically** using the test cases.

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* [`no-dupe-keys`](#eslint-plugin-flowtype-rules-no-dupe-keys)
2828
* [`no-existential-type`](#eslint-plugin-flowtype-rules-no-existential-type)
2929
* [`no-flow-fix-me-comments`](#eslint-plugin-flowtype-rules-no-flow-fix-me-comments)
30+
* [`no-internal-flow-type`](#eslint-plugin-flowtype-rules-no-internal-flow-type)
3031
* [`no-mixed`](#eslint-plugin-flowtype-rules-no-mixed)
3132
* [`no-mutable-array`](#eslint-plugin-flowtype-rules-no-mutable-array)
3233
* [`no-primitive-constructor-types`](#eslint-plugin-flowtype-rules-no-primitive-constructor-types)
@@ -2020,6 +2021,88 @@ const text = 'HELLO';
20202021
20212022
20222023
2024+
<a name="eslint-plugin-flowtype-rules-no-internal-flow-type"></a>
2025+
### <code>no-internal-flow-type</code>
2026+
2027+
Warns against using internal Flow types such as `React$Node`, `React$Ref` and others and suggests using public alternatives instead (`React.Node`, `React.Ref`, …).
2028+
2029+
The following patterns are considered problems:
2030+
2031+
```js
2032+
type X = React$AbstractComponent<Config, Instance>
2033+
// Message: Type identifier 'React$AbstractComponent' is not allowed. Use 'React.AbstractComponent' instead.
2034+
2035+
type X = React$ChildrenArray<string>
2036+
// Message: Type identifier 'React$ChildrenArray' is not allowed. Use 'React.ChildrenArray' instead.
2037+
2038+
type X = React$ComponentType<Props>
2039+
// Message: Type identifier 'React$ComponentType' is not allowed. Use 'React.ComponentType' instead.
2040+
2041+
type X = React$Config<Prosp, DefaultProps>
2042+
// Message: Type identifier 'React$Config' is not allowed. Use 'React.Config' instead.
2043+
2044+
type X = React$Element<typeof Component>
2045+
// Message: Type identifier 'React$Element' is not allowed. Use 'React.Element' instead.
2046+
2047+
type X = React$ElementConfig<typeof Component>
2048+
// Message: Type identifier 'React$ElementConfig' is not allowed. Use 'React.ElementConfig' instead.
2049+
2050+
type X = React$ElementProps<typeof Component>
2051+
// Message: Type identifier 'React$ElementProps' is not allowed. Use 'React.ElementProps' instead.
2052+
2053+
type X = React$ElementRef<typeof Component>
2054+
// Message: Type identifier 'React$ElementRef' is not allowed. Use 'React.ElementRef' instead.
2055+
2056+
type X = React$ElementType
2057+
// Message: Type identifier 'React$ElementType' is not allowed. Use 'React.ElementType' instead.
2058+
2059+
type X = React$Key
2060+
// Message: Type identifier 'React$Key' is not allowed. Use 'React.Key' instead.
2061+
2062+
type X = React$Node
2063+
// Message: Type identifier 'React$Node' is not allowed. Use 'React.Node' instead.
2064+
2065+
type X = React$Ref<typeof Component>
2066+
// Message: Type identifier 'React$Ref' is not allowed. Use 'React.Ref' instead.
2067+
2068+
type X = React$StatelessFunctionalComponent<Props>
2069+
// Message: Type identifier 'React$StatelessFunctionalComponent' is not allowed. Use 'React.StatelessFunctionalComponent' instead.
2070+
```
2071+
2072+
The following patterns are not considered problems:
2073+
2074+
```js
2075+
type X = React.AbstractComponent<Config, Instance>
2076+
2077+
type X = React.ChildrenArray<string>
2078+
2079+
type X = React.ComponentType<Props>
2080+
2081+
type X = React.Config<Props, DefaultProps>
2082+
2083+
type X = React.Element<typeof Component>
2084+
2085+
type X = React.ElementConfig<typeof Component>
2086+
2087+
type X = React.ElementProps<typeof Component>
2088+
2089+
type X = React.ElementRef<typeof Component>
2090+
2091+
type X = React.ElementType
2092+
2093+
type X = React.Key
2094+
2095+
type X = React.Node
2096+
2097+
type X = React.Ref<typeof Component>
2098+
2099+
type X = React.StatelessFunctionalComponent<Props>
2100+
2101+
type X = React$Rocks
2102+
```
2103+
2104+
2105+
20232106
<a name="eslint-plugin-flowtype-rules-no-mixed"></a>
20242107
### <code>no-mixed</code>
20252108

tests/rules/assertions/noInternalFlowType.js

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,95 @@ export default {
33
{
44
code: 'type X = React$AbstractComponent<Config, Instance>',
55
errors: [
6-
'Type identifier \'React$AbstractComponent\' is not allowed. Use \'React.AbstractComponent\' instead.',
6+
{
7+
message: 'Type identifier \'React$AbstractComponent\' is not allowed. Use \'React.AbstractComponent\' instead.',
8+
},
79
],
810
},
911
{
1012
code: 'type X = React$ChildrenArray<string>',
1113
errors: [
12-
'Type identifier \'React$ChildrenArray\' is not allowed. Use \'React.ChildrenArray\' instead.',
14+
{
15+
message: 'Type identifier \'React$ChildrenArray\' is not allowed. Use \'React.ChildrenArray\' instead.',
16+
},
1317
],
1418
},
1519
{
1620
code: 'type X = React$ComponentType<Props>',
1721
errors: [
18-
'Type identifier \'React$ComponentType\' is not allowed. Use \'React.ComponentType\' instead.',
22+
{
23+
message: 'Type identifier \'React$ComponentType\' is not allowed. Use \'React.ComponentType\' instead.',
24+
},
1925
],
2026
},
2127
{
2228
code: 'type X = React$Config<Prosp, DefaultProps>',
23-
errors: ['Type identifier \'React$Config\' is not allowed. Use \'React.Config\' instead.'],
29+
errors: [{
30+
message: 'Type identifier \'React$Config\' is not allowed. Use \'React.Config\' instead.',
31+
}],
2432
},
2533
{
2634
code: 'type X = React$Element<typeof Component>',
27-
errors: ['Type identifier \'React$Element\' is not allowed. Use \'React.Element\' instead.'],
35+
errors: [{
36+
message: 'Type identifier \'React$Element\' is not allowed. Use \'React.Element\' instead.',
37+
}],
2838
},
2939
{
3040
code: 'type X = React$ElementConfig<typeof Component>',
3141
errors: [
32-
'Type identifier \'React$ElementConfig\' is not allowed. Use \'React.ElementConfig\' instead.',
42+
{
43+
message: 'Type identifier \'React$ElementConfig\' is not allowed. Use \'React.ElementConfig\' instead.',
44+
},
3345
],
3446
},
3547
{
3648
code: 'type X = React$ElementProps<typeof Component>',
3749
errors: [
38-
'Type identifier \'React$ElementProps\' is not allowed. Use \'React.ElementProps\' instead.',
50+
{
51+
message: 'Type identifier \'React$ElementProps\' is not allowed. Use \'React.ElementProps\' instead.',
52+
},
3953
],
4054
},
4155
{
4256
code: 'type X = React$ElementRef<typeof Component>',
4357
errors: [
44-
'Type identifier \'React$ElementRef\' is not allowed. Use \'React.ElementRef\' instead.',
58+
{
59+
message: 'Type identifier \'React$ElementRef\' is not allowed. Use \'React.ElementRef\' instead.',
60+
},
4561
],
4662
},
4763
{
4864
code: 'type X = React$ElementType',
4965
errors: [
50-
'Type identifier \'React$ElementType\' is not allowed. Use \'React.ElementType\' instead.',
66+
{
67+
message: 'Type identifier \'React$ElementType\' is not allowed. Use \'React.ElementType\' instead.',
68+
},
5169
],
5270
},
5371
{
5472
code: 'type X = React$Key',
55-
errors: ['Type identifier \'React$Key\' is not allowed. Use \'React.Key\' instead.'],
73+
errors: [{
74+
message: 'Type identifier \'React$Key\' is not allowed. Use \'React.Key\' instead.',
75+
}],
5676
},
5777
{
5878
code: 'type X = React$Node',
59-
errors: ['Type identifier \'React$Node\' is not allowed. Use \'React.Node\' instead.'],
79+
errors: [{
80+
message: 'Type identifier \'React$Node\' is not allowed. Use \'React.Node\' instead.',
81+
}],
6082
},
6183
{
6284
code: 'type X = React$Ref<typeof Component>',
63-
errors: ['Type identifier \'React$Ref\' is not allowed. Use \'React.Ref\' instead.'],
85+
errors: [{
86+
message: 'Type identifier \'React$Ref\' is not allowed. Use \'React.Ref\' instead.',
87+
}],
6488
},
6589
{
6690
code: 'type X = React$StatelessFunctionalComponent<Props>',
6791
errors: [
68-
'Type identifier \'React$StatelessFunctionalComponent\' is not allowed. Use \'React.StatelessFunctionalComponent\' instead.',
92+
{
93+
message: 'Type identifier \'React$StatelessFunctionalComponent\' is not allowed. Use \'React.StatelessFunctionalComponent\' instead.',
94+
},
6995
],
7096
},
7197
],

0 commit comments

Comments
 (0)