sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
306 stars 38 forks source link

chore: Avoid using deprecated FlatConfig eslint type #856

Closed KuSh closed 1 month ago

KuSh commented 2 months ago

This type has been deprecated in eslint, see https://github.com/eslint/eslint/blob/71f37c5bf04afb704232d312cc6c72c957d1c14e/lib/types/index.d.ts#L1306

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: 5cdc41dc7a7845d9a9689b997daf4139be38fac1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------- | ----- | | eslint-plugin-svelte | Patch |

Not sure what this means? Click here to learn what changesets are.

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

KuSh commented 1 month ago

Maybe this change will cause type errors for users who use ESLint v8. So I'm worried that this should be changed in the next major version of eslint-plugin-svelte. What do you think?

I dont think so or they already have the problem because the latest type is used everywhere exept for that specific config, see https://www.npmjs.com/package/eslint-plugin-svelte?activeTab=code

ota-meshi commented 1 month ago

Are you saying you don't think using ESLint v8 would cause any problems? Have you tried that?

KuSh commented 1 month ago

Are you saying you don't think using ESLint v8 would cause any problems? Have you tried that?

I'm saying the type Linter.Config is already used in the same file for all flat config entries except the flat/all one so if ESLint v8 would cause problem it already does.

See the generated types for v2.44.1:

import './rule-types';
import type { RuleModule } from './types';
import * as processor from './processor';
declare const _default: {
    meta: typeof processor.meta;
    configs: {
        base: import("eslint").Linter.LegacyConfig<import("eslint").Linter.RulesRecord, import("eslint").Linter.RulesRecord>;
        recommended: import("eslint").Linter.LegacyConfig<import("eslint").Linter.RulesRecord, import("eslint").Linter.RulesRecord>;
        prettier: import("eslint").Linter.LegacyConfig<import("eslint").Linter.RulesRecord, import("eslint").Linter.RulesRecord>;
        all: import("eslint").Linter.LegacyConfig<import("eslint").Linter.RulesRecord, import("eslint").Linter.RulesRecord>;
        'flat/base': import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
        'flat/recommended': import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
        'flat/prettier': import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
        'flat/all': import("eslint").Linter.FlatConfig[];
    };
    rules: {
        [key: string]: RuleModule;
    };
    processors: {
        '.svelte': typeof processor;
        svelte: typeof processor;
    };
};
export = _default;
ota-meshi commented 1 month ago

In @types/eslint v8, Linter.Config was defined as a type representing the old configuration.

ota-meshi commented 1 month ago

See the generated types for v2.44.1:

Oh I didn't understand that. I didn't realize that eslint-plugin-svelte had already changed the types and released them. We can assume that if no new issues are being opened then it's fine for users. Thank you for explaining it to me.