eslint-plugin-fin-eslint-flow-enforcement
v1.0.12
Published
Custom rules by Fin Analytics to enforce flow typing
Downloads
8
Maintainers
Readme
eslint-plugin-fin-eslint-flow-enforcement
Custom rules by Fin Analytics to enforce flow typing
Installation
To add this ESLint plugin to your repo, add eslint-plugin-fin-eslint-flow-enforcement
under devDependencies
in your package.json
.
You may also need to run:
$ npm install eslint-plugin-fin-eslint-flow-enforcement --save-dev
Usage
Add fin-eslint-flow-enforcement
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"fin-eslint-flow-enforcement"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"fin-eslint-flow-enforcement/rule-name": 2
}
}
Supported Rules
require-typed-returns-on-exports
- require only exported functions to declare return types. Takes the same options as theeslint-plugin-flowtype
rule it was based on: https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-require-return-typerequire-specific-typed-variables
- require variables that result from one of the function calls in theincludeCalls
option to be typed. Exempt any variables that regex matchexcludeVariableMatch
require-specific-param-casts
- require specific property names in function calls, such asapolloClient.mutate({ variables })
to be type cast so flow can validate their shape. Below is some sample options:
{
checkPropertyNamesByCallName: {
"apolloClient.mutate": ["variables"],
"apolloClient.query": ["variables"],
"sendExtensionVersionedMessage": ["data"]
}
}