Registry / testing / eslint-plugin-flowtype

eslint-plugin-flowtype

JSON →
library8.0.3jsnpmunverified

ESLint plugin providing Flow type linting rules. Current stable version is 8.0.3, released October 2021. It adds over 40 rules specific to Flow type annotations, such as enforcing type styles, preventing duplicates, and requiring type declarations. Key differentiators: it is the primary ESLint plugin for Flow, with extensive rule coverage and shareable configs. It requires ESLint 8+ and Node 12+. Maintenance is active but may slow as Flow usage declines. Alternative: use TypeScript with `@typescript-eslint` instead.

npm install eslint-plugin-flowtype
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-FLOW
E
eslint-plugin-flowtype
testingjavascriptv8.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 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; }
Debug
Known issues
breakingv8.0.0 drops support for ESLint v7 and Node v10.
fix
Upgrade to ESLint 8+ and Node 12+.
affects: >=8.0.0
breakingv6.0.0 contains potentially breaking dependency updates.
fix
Review changelog for full list of updated dependencies.
affects: >=6.0.0 <7.0.0
deprecatedv7.0.0 dropped Node v10 support.
fix
Use Node >=12.
affects: >=7.0.0 <8.0.0
gotchaAdding 'eslint-plugin-flowtype' as plugin name will not work.
fix
Use 'flowtype' without prefix.
affects: >=4.0.0
gotchaRules must be prefixed with 'flowtype/' in rule configuration.
fix
Use 'flowtype/rule-name' instead of just 'rule-name'.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'flowtype' - Cannot find module 'eslint-plugin-flowtype'
Missing eslint-plugin-flowtype dependency
fix
npm install --save-dev eslint-plugin-flowtype
Error: ESLint configuration in .eslintrc.json is invalid: "plugins" must be an array
Wrong format for plugins field
fix
Use 'plugins': ['flowtype']
Error: Cannot find module '@babel/plugin-syntax-flow'
Missing peer dependency
fix
npm install --save-dev @babel/plugin-syntax-flow @babel/plugin-transform-react-jsx
Upgrade
Version history
8.0.3latest on npm
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
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-flowtype — npm install eslint-plugin-flowtype · libregistry