javascript icon indicating copy to clipboard operation
javascript copied to clipboard

eslint v9 support

Open ljharb opened this issue 10 months ago • 14 comments

(see also #2478, https://github.com/airbnb/javascript/issues/2223, https://github.com/airbnb/javascript/issues/2036, https://github.com/airbnb/javascript/issues/1834, https://github.com/airbnb/javascript/issues/1447)

eslint v9 was released on 2024.04.05.

The current plan is, if possible, to release a new semver-minor of both configs, that supports 7 || 8 || 9.

Note that this is different from whether flat config is supported or not by these plugins, and from whether this project will convert to flat config.

The timeframe for eslint v9 support is "not as soon as you would like, but as soon as we can". Please accept this, and please add no noise to this thread beyond emoji reactions - distractions won't help anyone get the work done any faster.

Please do not file additional issues and do not file pull requests attempting to add support - please, instead, continue to use eslint v8 until such time as our configs support v9.

Peer Dep eslint combined v7, v8, and v9 support released:

ljharb avatar Apr 06 '24 14:04 ljharb

Heads-up that the PR for eslint-plugin-jsx-a11y was closed in favour of https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/993. This has now been merged.

curdin avatar Jul 02 '24 03:07 curdin

Updates to the checklist above:

  • eslint-plugin-react now has support for eslint 9 and flat config [1]
  • eslint-plugin-react-hooks has support for eslint 9 in its canary [2]. They’re waiting for React 19 to ship (which is held up indefinitely by their issues with suspense orchestration) to release stable. Flat config works with the canary release.

eslint-plugin-jsx-a11y still has flat config support but not eslint 9 support; and there’s nothing completed for eslint-plugin-import or eslint-find-rules

controversial avatar Aug 03 '24 18:08 controversial

Hello,

I just wanted to share a configuration with ESlint v9 with Airbnb rules on it. It is clearly not perfect but seems to work pretty well. I'm just sharing it for those who are interested without waiting for a resolution of this issue.

It is on react with typescript project.

// @ts-check

import pluginJs from '@eslint/js';
import eslintPluginImportX from 'eslint-plugin-import-x';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import eslintReact from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import tsEslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
import eslintConfigAirbnbReact from 'eslint-config-airbnb/rules/react';
import eslintConfigAirbnbReactA11y from 'eslint-config-airbnb/rules/react-a11y';
import eslintConfigAirbnbErrors from 'eslint-config-airbnb-base/rules/errors';
import eslintConfigAirbnbEs6 from 'eslint-config-airbnb-base/rules/es6';
import eslintConfigAirbnbStrict from 'eslint-config-airbnb-base/rules/strict';

import tsParser from '@typescript-eslint/parser';

export default tsEslint.config(
  pluginJs.configs.recommended,
  /**
   * ESLint Typescript recommended
   * @see
   */
  {
    files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
    languageOptions: {
      parser: tsParser,
      ecmaVersion: 'latest',
      sourceType: 'module',
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
    settings: {
      'import-x/resolver': {
        typescript: true,
      },
    },
  },
  ...tsEslint.configs.recommended,

  /**
   * Eslint import X
   */
  eslintPluginImportX.flatConfigs.recommended,
  eslintPluginImportX.flatConfigs.typescript,

  /**
   * React
   */
  eslintReact.configs.flat.all,
  {
    files: ['**/*.{ts, tsx}'],
    plugins: {
      'react-hooks': hooksPlugin,
    },
    rules: {
      ...hooksPlugin.configs.recommended.rules,
    },
  },

  /**
   * Static AST checker for accessibility rules on JSX elements.
   * @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
   */
  jsxA11y.flatConfigs.recommended,

  /**
   * Unicorn
   */
  {
    plugins: {
      unicorn: eslintPluginUnicorn,
    },
    // rules: {
    //   'unicorn/better-regex': 'error',
    //   'unicorn/…': 'error',
    // },
  },

  /**
   * From Airbnb
   */
  { rules: eslintConfigAirbnbReact.rules },
  { rules: eslintConfigAirbnbReactA11y.rules },
  { rules: eslintConfigAirbnbErrors.rules },
  { rules: eslintConfigAirbnbEs6.rules },
  { rules: eslintConfigAirbnbStrict.rules },

  /**
   * Prettier
   */
  eslintPluginPrettierRecommended,
);

Oxyno-zeta

oxyno-zeta avatar Sep 01 '24 13:09 oxyno-zeta

Is this PR enabled now? https://github.com/airbnb/javascript/pull/2826

For the record: eslint-plugin-import now supports flat configs

rarenatoe avatar Sep 04 '24 22:09 rarenatoe

technically yes, but until both packages can support it there’s no point in doing it for one.

ljharb avatar Sep 05 '24 04:09 ljharb

The eslint-plugin-react-hooks PR is merged and available at least in canary release (can be checked off?), and flat config support for it has a PR now waiting to be merged (can be linked). @michaelfaith really putting in the work to help get all these pre-reqs complete. Is Airbnb support gonna happen soon?

hubjongit avatar Sep 14 '24 05:09 hubjongit

J

Dush, 7-okt, 2024, 20:55 Eike Foken @.***>:

FYI @ljharb https://github.com/ljharb sarbbottam/eslint-find-rules#354 https://github.com/sarbbottam/eslint-find-rules/pull/354

— Reply to this email directly, view it on GitHub https://github.com/airbnb/javascript/issues/2961#issuecomment-2397300884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP3XLTVMEK6BNOC4DQCLVD3Z2KVIVAVCNFSM6AAAAABF2QB32WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJXGMYDAOBYGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

JorabekDev avatar Oct 07 '24 16:10 JorabekDev