Detect .flowconfig and automatically enable ESLint rule to enforce Flow headers
Created by: FezVrasta
Is your proposal related to a problem?
Right now I need to use customize-cra
just to extend the react-app
ESLint preset with the following rule:
rules: {
'flowtype/require-valid-file-annotation': [
'warn',
'always',
],
},
which, basically, forces every file to have a // @flow
(or // @noflow
) comment on top of them.
Describe the solution you'd like
CRA should check for the presence of the .flowconfig
file and automatically enable the Flow-related ESLint rule.
Describe alternatives you've considered
Alternatively, following the --typescript
flag approach, provide a --flow
flag that can be used to initialize the project with the above Flow-related rule enabled.
Additional context
I'm willing to work on a PR to introduce this if you are interested.
Actually, I just prepared it since it was quick to do: https://github.com/facebook/create-react-app/pull/7547