You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Lower barrier:** Any editor that has ESLint support now supports Flow 🎉
16
16
***Less editor configuration:** No need to change your entire workflow to incorporate flow. No multiple-linters-per-file nonsense.
17
17
***Simple:** Its literally just an ESLint rule! Just install the dependency, add a flowconfig, and you're good to go!
18
18
19
19
## Getting Started
20
+
20
21
This guide assumes that you have installed eslint, babel, babel-plugin-transform-flow-strip-types and configured flow. Check out the [from-scratch guide](https://github.com/amilajack/eslint-plugin-flowtype-errors/wiki/Getting-Started) for the full guide on getting started.
21
22
22
-
⚠️ Make sure the 64-bit version of your texteditor/IDE. For atom, [see this comment](https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/40#issuecomment-275983387)
23
+
⚠️ Make sure the 64-bit version of your text editor or IDE. For atom, [see this comment](https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/40#issuecomment-275983387)
Add this line to the 'rules' section of your `.eslintrc` to report flow errors.
33
-
```js
34
-
"flowtype-errors/show-errors":"error"
35
-
```
36
-
37
-
Add this line to the 'rules' section of your `.eslintrc` to report flow warnings.
38
-
```js
39
-
"flowtype-errors/show-warnings":"warn"
40
-
```
41
-
Note that flow won't report warnings unless you add this setting to your `.flowconfig`:
42
-
```toml
43
-
[options]
44
-
include_warnings=true
45
-
```
46
-
47
-
Add this line to the 'rules' section of your `.eslintrc` to enforce a minimum percentage of flow coverage per file (optional). Here's an example of enforcing a converage of at least 50%:
Add this line to the 'plugins' section of your `.eslintrc`
53
-
```js
54
-
"flowtype-errors"
33
+
Extend the recommended config:
34
+
```jsonc
35
+
{
36
+
"extends": ["plugin:flowtype-errors/recommended"]
37
+
}
55
38
```
56
39
57
-
Add the `@flow` pragma to files that you want to lint
58
-
Also make sure that your `.flowconfig` is in the root of your project directory
59
-
```js
60
-
/**
61
-
* @flow
62
-
*/
63
-
```
64
-
65
-
**Step 3. Settings (optional)**
66
-
67
-
Add this line to the 'settings' section of your `.eslintrc` to force the Flow server to stop after it finishes checking types.
68
-
69
-
```js
70
-
"settings": {
71
-
"flowtype-errors": {
72
-
"stopOnExit":true
73
-
}
74
-
},
75
-
```
76
-
77
-
**Step 4. Lint**
78
-
79
-
Run `eslint` and you're all set!
80
-
81
40
## Support
82
41
83
42
If this project is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!
@@ -89,29 +48,11 @@ If this project is saving you (or your team) time, please consider supporting it
89
48
</p>
90
49
91
50
## CI Configuration
92
-
**Flow is supported on all OS's except Windows 32bit. Add [this line](https://github.com/amilajack/eslint-plugin-flowtype-errors/blob/master/appveyor.yml#L12) to appveyor to make tests run properly.**
Flow is supported on all OS's except Windows 32bit. Add [this line](https://github.com/amilajack/eslint-plugin-flowtype-errors/blob/master/appveyor.yml#L12) to appveyor to make tests run properly.
107
53
108
-
## Planned Implementations
109
-
* Add more extensive tests
110
-
* Allow passing arguments to flow binary
111
-
* Run flow minimal amount of times for faster linting
112
-
* Custom formatting of flow error messages
113
-
* Enable rules to allow and disallow specific flow errors
Copy file name to clipboardExpand all lines: test/__snapshots__/format.spec.js.snap
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ exports[`Check codebases project-1 - eslint should give expected output 1`] = `
130
130
131
131
./9.example.js
132
132
8:18 error Cannot create \`Hello\` element because property \`name\` is missing in props but exists in object type (see ./9.example.import.js:6) flowtype-errors/show-errors
133
-
8:28 error Cannot call \`ReactDOM.render\` with \`document.getElementById(...)\` bound to \`container\` because null (see https://github.com/facebook/flow/blob/v0.93.0/lib/dom.js#L783) is incompatible with \`Element\` (see https://github.com/facebook/flow/blob/v0.93.0/lib/react-dom.js#L18) flowtype-errors/show-errors
133
+
8:28 error Cannot call \`ReactDOM.render\` with \`document.getElementById(...)\` bound to \`container\` because null (see https://github.com/facebook/flow/blob/v0.95.1/lib/dom.js#L785) is incompatible with \`Element\` (see https://github.com/facebook/flow/blob/v0.95.1/lib/react-dom.js#L18) flowtype-errors/show-errors
134
134
135
135
✖ 21 problems (21 errors, 0 warnings)
136
136
@@ -600,7 +600,7 @@ Array [
600
600
"offset": 170,
601
601
},
602
602
},
603
-
"message": "Cannot call \`ReactDOM.render\` with \`document.getElementById(...)\` bound to \`container\` because null (see https://github.com/facebook/flow/blob/v0.93.0/lib/dom.js#L783) is incompatible with \`Element\` (see https://github.com/facebook/flow/blob/v0.93.0/lib/react-dom.js#L18).",
603
+
"message": "Cannot call \`ReactDOM.render\` with \`document.getElementById(...)\` bound to \`container\` because null (see https://github.com/facebook/flow/blob/v0.95.1/lib/dom.js#L785) is incompatible with \`Element\` (see https://github.com/facebook/flow/blob/v0.95.1/lib/react-dom.js#L18).",
0 commit comments