ESLint Plugin Flow (alias for eslint-plugin-flowtype)
raw JSON → 2.29.1 verified Sat Apr 25 auth: no javascript deprecated
This package (eslint-plugin-flow) is a legacy alias for eslint-plugin-flowtype, which provides Flowtype linting rules for ESLint. The current stable version of eslint-plugin-flowtype is 8.0.3 (October 2021). The package enforces Flow type annotations with over 30 rules, including type-id-match, no-weak-types, and sort-type-union-intersection-members. It is designed for projects using Flow with ESLint 8+. Key differentiators: it is the most mature Flow linting plugin, supports ESLint 8, and is maintained by the community. However, note that this alias package is deprecated and should be replaced with eslint-plugin-flowtype directly.
Common errors
error Cannot find module 'eslint-plugin-flow' ↓
cause The package is deprecated and may not be published to npm under that name.
fix
npm install --save-dev eslint-plugin-flowtype and replace all references.
error Error: ESLint configuration in .eslintrc is invalid: Environment key "eslint-plugin-flowtype/rules" is not valid. ↓
cause Using the deprecated alias to try to access rules.
fix
Use valid rule names like 'flowtype/no-weak-types' in rules.
error TypeError: plugin is not a function ↓
cause Attempting to call the default export as a function (e.g., plugin()).
fix
The default export is an object, not a function. Use it as part of ESLint's plugin system.
Warnings
breaking eslint-plugin-flowtype v8 drops support for ESLint 7. Requires ESLint 8+. ↓
fix Upgrade ESLint to version 8 or later, or use eslint-plugin-flowtype@^7 if you must stay on ESLint 7.
breaking eslint-plugin-flowtype v7 drops Node.js 10 support. ↓
fix Use Node.js 12 or later.
deprecated eslint-plugin-flow is deprecated. Use eslint-plugin-flowtype instead. ↓
fix Replace 'eslint-plugin-flow' with 'eslint-plugin-flowtype' in your package.json and update all imports/requires.
gotcha The plugin's default export is the plugin object, not a function. You cannot use it with ESLint's 'plugin' key incorrectly. ↓
fix In .eslintrc, use: plugins: ['flowtype'] and rules: { 'flowtype/no-weak-types': 2 }.
gotcha Some rules require specific Flow version schemas; not all rules work with older Flow versions. ↓
fix Ensure your Flow version is compatible with the rule semantics (e.g., sort-type-union-intersection-members requires Flow 0.155+).
Install
npm install eslint-plugin-flow yarn add eslint-plugin-flow pnpm add eslint-plugin-flow Imports
- plugin as default wrong
const plugin = require('eslint-plugin-flow')correctimport plugin from 'eslint-plugin-flowtype' - rules wrong
const { rules } = require('eslint-plugin-flow')correctimport { rules } from 'eslint-plugin-flowtype' - configs
import { configs } from 'eslint-plugin-flowtype'
Quickstart
// .eslintrc.js
module.exports = {
plugins: ['flowtype'],
extends: ['plugin:flowtype/recommended'],
rules: {
'flowtype/boolean-style': [2, 'boolean'],
'flowtype/no-weak-types': 2,
},
};
// Install:
// npm install --save-dev eslint eslint-plugin-flowtype
// Do not use eslint-plugin-flow (deprecated).