prettier / eslint-plugin-prettier

ESLint plugin for Prettier formatting
https://npm.im/eslint-plugin-prettier
MIT License
3.33k stars 182 forks source link

feat: change type from deprecated `FlatConfig` to `Config` #674

Open irsooti opened 3 months ago

irsooti commented 3 months ago

Hello,

the type FlatConfig has been replaced with Config, according to the deprecation warning. image

I just changed the type with the suggested one.

Cheers!

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: 3451c3ecb6df551f9fbf525b15b8d958e54f3983

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

MartinX3 commented 2 months ago

@irsooti I tried your change but maybe it's because I use the eslint.config.ts since ESLint 9.9.0.

eslint.config.ts:29:3 - error TS2345: Argument of type 'Config<RulesRecord>' is not assignable to parameter of type 'ConfigWithExtends'.
  Types of property 'languageOptions' are incompatible.
    Type 'import("path/node_modules/.pnpm/@types+eslint@9.6.0/node_modules/@types/eslint/index").Linter.LanguageOptions | undefined' is not assignable to type 'import("path/node_modules/.pnpm/@typescript-eslint+utils@8.0.1_eslint@9.9.0_jiti@1.21.6__typescript@5.5.4/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions | undefined'.
      Type 'import("path/node_modules/.pnpm/@types+eslint@9.6.0/node_modules/@types/eslint/index").Linter.LanguageOptions' is not assignable to type 'import("path/node_modules/.pnpm/@typescript-eslint+utils@8.0.1_eslint@9.9.0_jiti@1.21.6__typescript@5.5.4/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions'.
        Types of property 'globals' are incompatible.
          Type 'Globals | undefined' is not assignable to type 'GlobalsConfig | undefined'.
            Type 'Globals' is not assignable to type 'GlobalsConfig'.
              'string' index signatures are incompatible.
                Type 'GlobalConf' is not assignable to type 'GlobalVariableOption'.
                  Type '"readable"' is not assignable to type 'GlobalVariableOption'.

Edit: It seems to work using Readonly<Linter.RulesRecord> instead of Linter.Config like used here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/136deed9a5c0adaea7bc7674783bb52608673d05/types/eslint__js/index.d.ts#L5