Skip to content

Commit ff4f857

Browse files
committed
docs: correct examples (fixes #333)
1 parent 51f4ba2 commit ff4f857

File tree

2 files changed

+17
-35
lines changed

2 files changed

+17
-35
lines changed

Diff for: .README/rules/no-existential-type.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ Disallows use of the existential type (*). [See more](https://flow.org/en/docs/t
1111
```
1212

1313

14-
<!-- assertions newlineAfterFlowAnnotation -->
15-
14+
<!-- assertions noExistentialType -->

Diff for: README.md

+16-33
Original file line numberDiff line numberDiff line change
@@ -1277,48 +1277,25 @@ Disallows use of the existential type (*). [See more](https://flow.org/en/docs/t
12771277
The following patterns are considered problems:
12781278
12791279
```js
1280-
// @flow
1281-
import Foo from './foo';
1282-
// Message: Expected newline after flow annotation
1283-
1284-
// Options: ["always"]
1285-
// @flow
1286-
import Foo from './foo';
1287-
// Message: Expected newline after flow annotation
1288-
1289-
// Options: ["always-windows"]
1290-
// @flow
1291-
import Foo from './foo';
1292-
// Message: Expected newline after flow annotation
1293-
1294-
// Options: ["never"]
1295-
// @flow
1280+
type T = *;
1281+
// Message: Unexpected use of existential type (*).
12961282

1283+
type T = U<*, *>;
1284+
// Message: Unexpected use of existential type (*).
1285+
// Message: Unexpected use of existential type (*).
12971286

1298-
// Message: Expected no newline after flow annotation
1287+
const f: (*) => null = () => null;
1288+
// Message: Unexpected use of existential type (*).
12991289
```
13001290
13011291
The following patterns are not considered problems:
13021292
13031293
```js
1304-
// Options: ["always"]
1305-
// @flow
1306-
1307-
import Foo from './foo';
1308-
1309-
// Options: ["always-windows"]
1310-
// @flow
1311-
1312-
import Foo from './foo';
1313-
1314-
// Options: ["never"]
1315-
// @flow
1316-
import Foo from './foo';
1294+
type T = string | null
13171295
```
13181296
13191297
13201298
1321-
13221299
<a name="eslint-plugin-flowtype-rules-no-flow-fix-me-comments"></a>
13231300
### <code>no-flow-fix-me-comments</code>
13241301
@@ -2437,8 +2414,6 @@ This rule validates Flow file annotations.
24372414
24382415
This rule can optionally report missing or missed placed annotations, common typos (e.g. `// @floww`), and enforce a consistant annotation style.
24392416

2440-
This rule is autofixable with the `--fix` argument. This will autofix files by adding missing flow annotations to the top of each file. To avoid autofixing this rule per-file, you can add a `// @noflow` annotation to the top of individual files.
2441-
24422417
<a name="eslint-plugin-flowtype-rules-require-valid-file-annotation-options"></a>
24432418
#### Options
24442419

@@ -2520,6 +2495,14 @@ a;
25202495
// Options: ["always",{"annotationStyle":"block"}]
25212496
// @noflow
25222497
// Message: Flow file annotation style must be `/* @noflow */`
2498+
2499+
// Options: ["always"]
2500+
a;
2501+
// Message: Flow file annotation is missing.
2502+
2503+
// Options: ["always",{"annotationStyle":"block"}]
2504+
a;
2505+
// Message: Flow file annotation is missing.
25232506
```
25242507
25252508
The following patterns are not considered problems:

0 commit comments

Comments
 (0)