gajus / eslint-plugin-flowtype

Flow type linting rules for ESLint.
Other
1.08k stars 154 forks source link

Value ["boolean"] should NOT have more than 0 items. #527

Open leahlin01 opened 1 month ago

leahlin01 commented 1 month ago

got this error when i try to build a create-react-app project env: node v18.18.0 webpack5 error message:

Failed to compile.

[eslint] BaseConfig » plugin:flowtype/recommended:
        Configuration for rule "flowtype/boolean-style" is invalid:
        Value ["boolean"] should NOT have more than 0 items.

my webpack config code:

plugins: [
      // Generates an `index.html` file with the <script> injected.
      new ESLintPlugin({
        extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
        formatter: require.resolve('react-dev-utils/eslintFormatter'),
        eslintPath: require.resolve('eslint'),
        context: paths.appSrc,
        cache: true,
        cwd: paths.appPath,
        resolvePluginsRelativeTo: __dirname,
        baseConfig: {
          extends: [
            require.resolve('eslint-config-react-app/base'),
            'plugin:flowtype/recommended'
          ],
          plugins: ['flowtype'],
          rules: {
            "flowtype/define-flow-type": 1,
            'flowtype/boolean-style': [
              2,
              "boolean"
            ],
          },
          parser: '@babel/eslint-parser',
          parserOptions: {
            requireConfigFile: false,
            babelOptions: {
              presets: ['@babel/preset-react', '@babel/preset-flow'],
            },
          },
          settings: {
            flowtype: {
              onlyFilesWithFlowAnnotation: true,
            },
          },
        },
      })
    ].filter(Boolean),
coltenkrauter commented 1 month ago

Did you figure out what is going on?

ngyikp commented 1 month ago

This plugin is broken on ESLint 9 due to this breaking change: https://eslint.org/docs/latest/use/migrate-to-9.0.0#meta-schema-required

There hasn't been any updates to this plugin in 3 years, best to switch to this fork: https://github.com/flow-typed/eslint-plugin-ft-flow