eslint-plugin-ft-flow

raw JSON →
3.0.11 verified Sat Apr 25 auth: no javascript

ESLint plugin providing Flowtype linting rules, maintained by the flow-typed community as a fork of the original eslint-plugin-flowtype. Current version 3.0.11, with regular releases every few months. Unlike the original plugin, it is actively maintained, supports ESLint 9 flat config, and includes additional rules like `no-duplicate-type-union-intersection-members` and `sort-type-union-intersection-members`. Requires `eslint` ^8.56.0 or ^9.0.0 and optionally `hermes-eslint` >=0.15.0.

error Error: Plugin 'ft-flow' was conflicted between '.eslintrc.js' and 'eslint.config.js'
cause Mixing legacy and flat configs.
fix
Use only one config format; remove .eslintrc.* if using eslint.config.js.
error TypeError: Cannot destructure property 'getSourceCode' of 'context' as it is undefined.
cause Using an incompatible version of ESLint or outdated plugin version.
fix
Update eslint to ^8.56.0 or ^9.0.0 and eslint-plugin-ft-flow to >=3.0.10.
error Error: Cannot find module 'eslint-plugin-ft-flow'
cause Module not installed or not resolved.
fix
Run npm install eslint-plugin-ft-flow --save-dev
error Parsing error: The keyword 'import' is reserved
cause ESLint is not configured for ES modules.
fix
Set 'sourceType': 'module' in ESLint config or use .mjs extension.
breaking Version 3.0.10 deprecated CommonJS require; only ESM imports work.
fix Use import statement instead of require().
deprecated Some rules may be deprecated and replaced; check documentation.
fix Use the recommended rule set and migrate deprecated rules.
gotcha Rule 'define-flow-type' may conflict with ESLint's 'no-unused-vars'.
fix Add 'no-unused-vars': 'off' or configure appropriately.
gotcha Peer dependency hermes-eslint is optional but if used must be >=0.15.0.
fix Install hermes-eslint@^0.15.0 if you need Hermes parsing.
gotcha Flat config (ESLint 9) is supported but not all legacy config formats.
fix Use eslint.config.js flat config; for .eslintrc use version <3.0.0.
npm install eslint-plugin-ft-flow
yarn add eslint-plugin-ft-flow
pnpm add eslint-plugin-ft-flow

Show how to set up eslint-plugin-ft-flow with ESLint flat config, enabling a few rules for Flowtype linting.

// eslint.config.js (flat config, ESLint 9)
import plugin from 'eslint-plugin-ft-flow';

export default [
  {
    files: ['**/*.js', '**/*.jsx'],
    plugins: {
      'ft-flow': plugin,
    },
    rules: {
      'ft-flow/define-flow-type': 1,
      'ft-flow/use-flow-type': 1,
      'ft-flow/no-weak-types': 2,
    },
  },
];