Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
plugin
✓ // In .eslintrc: 'plugins': ['flowtype']
✗ plugins: ['eslint-plugin-flowtype']
ESLint automatically adds prefix; just use 'flowtype'.
rules
✓ // In .eslintrc: 'rules': { 'flowtype/boolean-style': 'error' }
✗ rules: { 'boolean-style': 'error' }
Rules must be prefixed with 'flowtype/'.
configs
✓ // In .eslintrc: 'extends': ['plugin:flowtype/recommended']
✗ extends: ['eslint-plugin-flowtype/recommended']
Use plugin: prefix for shareable configs.
Installation and basic ESLint configuration with recommended rules and a simple Flow-annotated function.
// Install: npm install --save-dev eslint eslint-plugin-flowtype @babel/plugin-syntax-flow @babel/plugin-transform-react-jsx
// .eslintrc.json
{
"plugins": ["flowtype"],
"extends": ["plugin:flowtype/recommended"],
"rules": {
"flowtype/boolean-style": [2, "boolean"],
"flowtype/define-flow-type": 1,
"flowtype/delimiter-dangle": [1, "never"],
"flowtype/generic-spacing": [1, "never"],
"flowtype/no-mixed": 2,
"flowtype/no-primitive-constructor-types": 2,
"flowtype/no-weak-types": 2,
"flowtype/object-type-delimiter": [1, "comma"],
"flowtype/require-parameter-type": 2,
"flowtype/require-return-type": [2, "always", { "annotateUndefined": "never" }],
"flowtype/require-valid-file-annotation": 2,
"flowtype/semi": [1, "always"],
"flowtype/space-after-type-colon": [1, "always"],
"flowtype/space-before-generic-bracket": [1, "never"],
"flowtype/space-before-type-colon": [1, "never"],
"flowtype/type-id-match": [2, "^([A-Z][a-z0-9]+)+Type$"],
"flowtype/union-intersection-spacing": [1, "always"],
"flowtype/use-flow-type": 1,
"flowtype/valid-syntax": 1
}
}
// Example .js file with Flow
// @flow
function square(n: number): number {
return n * n;
}
Errors
Common errors & fixes
Error: Failed to load plugin 'flowtype' - Cannot find module 'eslint-plugin-flowtype'
Missing eslint-plugin-flowtype dependency
fixnpm install --save-dev eslint-plugin-flowtype
Error: ESLint configuration in .eslintrc.json is invalid: "plugins" must be an array
Wrong format for plugins field
fixUse 'plugins': ['flowtype']
Error: Cannot find module '@babel/plugin-syntax-flow'
Missing peer dependency
fixnpm install --save-dev @babel/plugin-syntax-flow @babel/plugin-transform-react-jsx
Audit
Dependencies
eslintrequiredpeer dependency; plugin works as an ESLint plugin
@babel/plugin-syntax-flowrequiredpeer dependency; required for parsing Flow syntax with Babel
@babel/plugin-transform-react-jsxoptionalpeer dependency; required for React JSX support when using Flow