Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "Flat Config" (ESLint 9) #333

Open
JoshuaKGoldberg opened this issue Feb 13, 2024 · 4 comments
Open

Support "Flat Config" (ESLint 9) #333

JoshuaKGoldberg opened this issue Feb 13, 2024 · 4 comments

Comments

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Feb 13, 2024

👋 Coming over from eslint/eslint#18093: ESLint is migrating to a new "flat config" format that will be the default in ESLint v9.

It doesn't look like eslint-plugin-react-native has support yet. I'm posting this issue here as a reference & cross-linking it to the table in eslint/eslint#18093. If there's anything technical blocking the extension from supporting flat configs, please let us know - we'd be happy to try to help! 💜

Additional resources:

@Miguel-A-Jara
Copy link

If anyone is trying to use this with eslint's flat config. You can use the fixupPluginRules from @eslint/compat.
https://www.npmjs.com/package/@eslint/compat

import { fixupPluginRules } from '@eslint/compat'
import reactNative from 'eslint-plugin-react-native'

export default [
  // ...
  {
    plugins: {
      'react-native': fixupPluginRules(reactNative)
    }
  }
]

@generosocarbone
Copy link

@Miguel-A-Jara I got the following:

$ eslint .

Oops! Something went wrong! :(

ESLint: 9.12.0

ConfigError: Config (unnamed): Key "plugins": Cannot redefine plugin "react-native".
    at rethrowConfigError (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:303:8)
    at /Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:1098:5
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfigWithStatus (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:1091:43)
    at FlatConfigArray.getConfig (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:1120:15)
    at entryFilter (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/eslint/lib/eslint/eslint-helpers.js:286:40)
    at async NodeHfs.<anonymous> (file:///Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@humanfs/core/src/hfs.js:560:24)
    at async NodeHfs.walk (file:///Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@humanfs/core/src/hfs.js:600:3)
    at async globSearch (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/eslint/lib/eslint/eslint-helpers.js:327:26)
    at async Promise.allSettled (index 0)
error Command failed with exit code 2.

@srtp
Copy link

srtp commented Dec 18, 2024

@Miguel-A-Jara I got the following:

$ eslint .

Oops! Something went wrong! :(

ESLint: 9.12.0

ConfigError: Config (unnamed): Key "plugins": Cannot redefine plugin "react-native".
    at rethrowConfigError (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:303:8)
    at /Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:1098:5
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfigWithStatus (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:1091:43)
    at FlatConfigArray.getConfig (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@eslint/config-array/dist/cjs/index.cjs:1120:15)
    at entryFilter (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/eslint/lib/eslint/eslint-helpers.js:286:40)
    at async NodeHfs.<anonymous> (file:///Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@humanfs/core/src/hfs.js:560:24)
    at async NodeHfs.walk (file:///Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/@humanfs/core/src/hfs.js:600:3)
    at async globSearch (/Users/generosocarbone/syscake-dev/techser/snap-mobile/node_modules/eslint/lib/eslint/eslint-helpers.js:327:26)
    at async Promise.allSettled (index 0)
error Command failed with exit code 2.

How to fix ??

@caralin3
Copy link

Any updates as to when eslint-plugin-react-native will support ESLint v9?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants