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

ESLint v9 Support? (flat config) #156

Open
timble-one opened this issue Dec 6, 2024 · 0 comments
Open

ESLint v9 Support? (flat config) #156

timble-one opened this issue Dec 6, 2024 · 0 comments

Comments

@timble-one
Copy link

timble-one commented Dec 6, 2024

Compatibility Problem? - TypeError: Error while loading rule 'relay/no-future-added-value': Rule must be an object with a create method

eslint.config.js

export default [
  ...tseslint.config(
    { ignores: ['dist'] },
    {
      files: ['**/*.{ts,tsx}'],
      languageOptions: {
        ecmaVersion: 2020,
        globals: globals.browser,
      },
      extends: [js.configs.recommended, ...tseslint.configs.recommended, relay.configs.recommended],
      rules: {
        ...reactHooks.configs.recommended.rules,
        ...reactRefresh.configs.recommended.rules,
        'react-refresh/only-export-components': [
          'warn',
          { allowConstantExport: true },
        ],
        'react-hooks/exhaustive-deps': 'off',
      },
      plugins: {
        'react-hooks': reactHooks,
        'react-refresh': reactRefresh,
        relay
      },
    },
  ),
]

Error

Oops! Something went wrong! :(

ESLint: 9.20.0

TypeError: Error while loading rule 'relay/no-future-added-value': Rule must be an object with a `create` method
Occurred while linting /Users/timo/projects/flexirent/flexirent-frontend/src/app/pages/Page.tsx
    at createRuleListeners (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:1002:15)
    at /Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:1144:84
    at Array.forEach (<anonymous>)
    at runRules (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:1075:34)
    at #flatVerifyWithoutProcessors (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:2001:31)
    at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:2083:49)
    at Linter._verifyWithFlatConfigArray (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:2172:21)
    at Linter.verify (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:1626:61)
    at Linter.verifyAndFix (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/linter/linter.js:2410:29)
    at verifyText (/Users/timo/projects/flexirent/flexirent-frontend/node_modules/eslint/lib/eslint/eslint.js:327:48)

Workaround

First i tried to disable this rule (relay/no-future-added-value) but it looks like all of the rules cause this error.

I also tried to use the compability-library from eslint: https://github.com/eslint/eslintrc#usage
Doesn't solve the problem neither.

I downgraded eslint to v8.5 and backported eslint.config.js to .eslintrc.cjs
But because eslint v8 is end of live this is not really satisfying.

Import Problem (solved) - TypeError: relay.configs.recommended is not iterable

it looks like this plugin does not yet support the new flat config system introduced in ESLint v9.

If i do this:

export default tseslint.config(
  { ignores: ['dist'] },
  {
    extends: [
      js.configs.recommended,
      ...tseslint.configs.recommended,
      ...relay.configs.recommended
    ],

I get this:

TypeError: relay.configs.recommended is not iterable

Solution for Import Problem

This was a stupid mistake of mine.

If i import it like this, this works: import relay from 'eslint-plugin-relay'

@timble-one timble-one changed the title TypeError: relay.configs.recommended is not iterable ESLint v9 Support? Feb 11, 2025
@timble-one timble-one changed the title ESLint v9 Support? ESLint v9 Support? (flat config) Feb 11, 2025
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

1 participant