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

chore: eslint 9 support #101

Merged
merged 12 commits into from
Aug 26, 2024
Merged

chore: eslint 9 support #101

merged 12 commits into from
Aug 26, 2024

Conversation

DianaSuvorova
Copy link
Owner

Adding eslint support.
Planning a minor version release.

@DianaSuvorova
Copy link
Owner Author

I have dropped node below 18 support for my ci since eslint@9 is not happy about it. Still hope this could be a minor for the release.

@DianaSuvorova DianaSuvorova requested a review from ljharb August 17, 2024 19:33
@DianaSuvorova DianaSuvorova merged commit 18f9f27 into master Aug 26, 2024
4 checks passed
@mike-lock
Copy link

Nice! When will this be available in npm?

Copy link

🎉 This PR is included in version 4.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@p-szalast
Copy link

p-szalast commented Sep 26, 2024

Is there any guide for configuring eslint-plugin-react-redux with eslint flat config?
There is no info on https://www.npmjs.com/package/eslint-plugin-react-redux/v/4.2.0

Would it look like this?

import reactRedux from "eslint-plugin-react-redux";

export default [ { files: ["**/*.{jsx, tsx}"], plugins: { "react-redux": reactRedux, }, rules: { ... } } ]

@mike-lock
Copy link

We have it like this:

import tsEsLint from 'typescript-eslint'
import jestPlugin from 'eslint-plugin-jest'
import jsxRuntime from 'eslint-plugin-jsx-a11y'
import react from 'eslint-plugin-react'
import reactRedux from 'eslint-plugin-react-redux'
import reactHooks from 'eslint-plugin-react-hooks'
import reactHooksAddons from 'eslint-plugin-react-hooks-addons'
import esLintConfigPrettier from 'eslint-config-prettier'
import esLintPluginPrettier from 'eslint-plugin-prettier/recommended'
import globals from 'globals'
import { fixupPluginRules } from '@eslint/compat'

export default tsEsLint.config(
  esLint.configs.recommended,
  ...tsEsLint.configs.recommended,
  react.configs.flat.recommended,
  react.configs.flat['jsx-runtime'],
  jsxRuntime.flatConfigs.recommended,
  esLintConfigPrettier,
  esLintPluginPrettier,
  {
    files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
    languageOptions: {
      globals: {
        ...globals.serviceworker,
        ...globals.browser,
        ...globals.jest,
        ...globals.es2025,
      },
      parserOptions: {
        ecmaFeatures: {
          jsx: true,
        },
        ecmaVersion: 'latest',
        sourceType: 'module',
      },
    },
    plugins: {
      ['react-redux']: fixupPluginRules(reactRedux),
      ['react-hooks']: fixupPluginRules(reactHooks),
      ['react-hooks-addons']: fixupPluginRules(reactHooksAddons),
    },
    settings: {
      react: {
        version: 'detect',
      },
      'import/resolver': {
        '@typescript-eslint/parser': ['.ts', '.tsx'],
      },
    },
    rules: {
      ...reactRedux.rules.recommended,
      ...reactHooks.rules.recommended,
      ...reactHooksAddons.rules.recommended,
      // The rest of your custom rule settings
    },
  },
)

@ljharb ljharb deleted the beta branch September 26, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants