1.0.12 • Published 6 years ago
eslint-plugin-fin-eslint-flow-enforcement v1.0.12
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-devUsage
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-flowtyperule 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 theincludeCallsoption to be typed. Exempt any variables that regex matchexcludeVariableMatchrequire-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"]
}
}