Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Compatibility with new eslint config spec #307

Open
jjangga0214 opened this issue Sep 9, 2022 · 3 comments
Open

Compatibility with new eslint config spec #307

jjangga0214 opened this issue Sep 9, 2022 · 3 comments

Comments

@jjangga0214
Copy link

jjangga0214 commented Sep 9, 2022

Eslint announced a new config spec.
https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new

스크린샷 2022-09-09 오후 10 07 49

According to eslint's official blog, though backward compatibility was taken care of, not all shareable configs continue to work with the new config system.

Are eslint-config-airbnb-typescript and eslint-config-airbnb-typescript/base compatible with the new config?

Thanks.

@samuelneff
Copy link

Two years later and the README doesn't have any references to flat config support.

@samuelneff
Copy link

Some more searching and I stumbled across the compatibility helpers that allow this project to be used with flat config.

Example:

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from "eslint-config-prettier";

import { FlatCompat } from "@eslint/eslintrc";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
  baseDirectory: __dirname
});

export default tseslint.config(
  eslint.configs.recommended,
  ...compat.extends("airbnb-base"),
  ...compat.extends("airbnb-typescript/base"),
  ...tseslint.configs.recommendedTypeChecked,
  eslintConfigPrettier,
  {
    languageOptions: {
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  {
      files: ['**/*.{js,jsx,cjs,mjs}'],
      extends: [tseslint.configs.disableTypeChecked],
  }
);

From: https://stackoverflow.com/questions/78253188/flat-config-file-with-configs-from-legacy-eslintrc-compat-error

My setup based on this one works. 🙏

@Kenneth-Sills
Copy link

I'll make a PR to add this documentation. Thanks for bringing it up, @samuelneff!

jrolfs pushed a commit to jrolfs/eslint-config-airbnb-typescript that referenced this issue Aug 16, 2024
- Explicitly note the lack of ESLint 9 support, link to tracking ticket.
- Provide flat configuration instructions (and recommend their use).
- Update instructions for NPM v7 automatically installing peer dependencies.
- Update configuration for use with typescript-eslint v8.
- Some restructuring for readability.
- Added instructions for removing formatting rules, since it's less simple
  with the ESLint stylistic rules (until the Prettier config gets updated).

Closes iamturns#307
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants