-
-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
Status: ReleasedThe issue has been releasedThe issue has been releasedType: BugSomething isn't workingSomething isn't working
Description
Describe the bug
When type checking is enabled for eslint.config.js
, defineConfig
can't accept recommended-type-checked
in any possible position. It works fine at runtime, if ignored, so it may be just a type declarations issue.
Possibly, the same is happening with other configs.
Reproduction
https://stackblitz.com/edit/vitejs-vite-jmnavvcs?file=eslint.config.js&view=editor
q
Enter
tsc -b
Get the following error
eslint.config.js(37,20): error TS2322: Type '{ readonly meta: { readonly name: string; readonly version: string; }; readonly configs: { readonly all: typeof allConfig; readonly "all-legacy": { plugins: string[]; rules: RulePreset; }; ... 25 more ...; readonly "off-dom-legacy": { ...; }; }; readonly rules: { ...; }; }' is not assignable to type 'Plugin'.
Types of property 'configs' are incompatible.
Type '{ readonly all: typeof allConfig; readonly "all-legacy": { plugins: string[]; rules: RulePreset; }; readonly debug: typeof debugConfig; readonly "debug-legacy": { plugins: string[]; rules: RulePreset; }; ... 23 more ...; readonly "off-dom-legacy": { ...; }; }' is not assignable to type 'Record<string, LegacyConfig<RulesRecord, RulesRecord> | Config<RulesRecord> | Config<RulesRecord>[]>'.
Property 'all' is incompatible with index signature.
Type 'typeof allConfig' is not assignable to type 'LegacyConfig<RulesRecord, RulesRecord> | Config<RulesRecord> | Config<RulesRecord>[]'.
Type 'typeof allConfig' is not assignable to type 'Config<RulesRecord>'.
Types of property 'plugins' are incompatible.
Type '{ "@eslint-react/debug": { configs: { all: { plugins: { "react-debug": { readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }; }; name: ...' is not assignable to type 'Record<string, Plugin>'.
Property '"@eslint-react/debug"' is incompatible with index signature.
Type '{ configs: { all: { plugins: { "react-debug": { readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }; }; name: string; rules: RulePreset...' is not assignable to type 'Plugin'.
Types of property 'configs' are incompatible.
Type '{ all: { plugins: { "react-debug": { readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }; }; name: string; rules: RulePreset; }; "all-l...' is not assignable to type 'Record<string, LegacyConfig<RulesRecord, RulesRecord> | Config<RulesRecord> | Config<RulesRecord>[]>'.
Property 'all' is incompatible with index signature.
Type '{ plugins: { "react-debug": { readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }; }; name: string; rules: RulePreset; }' is not assignable to type 'LegacyConfig<RulesRecord, RulesRecord> | Config<RulesRecord> | Config<RulesRecord>[]'.
Type '{ plugins: { "react-debug": { readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }; }; name: string; rules: RulePreset; }' is not assignable to type 'Config<RulesRecord>'.
Types of property 'plugins' are incompatible.
Type '{ "react-debug": { readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }; }' is not assignable to type 'Record<string, Plugin>'.
Property '"react-debug"' is incompatible with index signature.
Type '{ readonly meta: { readonly name: string; readonly version: string; }; readonly rules: { readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; ... 4 more ...; readonly "react-hooks": RuleModule<...>; }; }' is not assignable to type 'Plugin'.
Types of property 'rules' are incompatible.
Type '{ readonly "class-component": RuleModule<"classComponent", [], unknown, RuleListener>; readonly "function-component": RuleModule<"functionComponent", [], unknown, RuleListener>; readonly hook: RuleModule<...>; readonly "is-from-react": RuleModule<...>; readonly jsx: RuleModule<...>; readonly "react-hooks": RuleModul...' is not assignable to type 'Record<string, RuleDefinition<RuleDefinitionTypeOptions>>'.
Property '"class-component"' is incompatible with index signature.
Type 'RuleModule<"classComponent", [], unknown, RuleListener>' is not assignable to type 'RuleDefinition<RuleDefinitionTypeOptions>'.
Types of property 'create' are incompatible.
Type '(context: Readonly<RuleContext<"classComponent", []>>) => RuleListener' is not assignable to type '(context: RuleContext<{ LangOptions: LanguageOptions; Code: SourceCode<{ LangOptions: LanguageOptions; RootNode: unknown; SyntaxElementWithLoc: unknown; ConfigNode: unknown; }>; RuleOptions: unknown[]; Node: unknown; MessageIds: string; }>) => RuleVisitor'.
Types of parameters 'context' and 'context' are incompatible.
Type 'RuleContext<{ LangOptions: LanguageOptions; Code: SourceCode<{ LangOptions: LanguageOptions; RootNode: unknown; SyntaxElementWithLoc: unknown; ConfigNode: unknown; }>; RuleOptions: unknown[]; Node: unknown; MessageIds: string; }>' is missing the following properties from type 'Readonly<RuleContext<"classComponent", []>>': getAncestors, getDeclaredVariables, getScope, markVariableAsUsed
Expected behavior
tsc
should report no errors.
Platform and versions
Node 20.19.1
@eslint-react/eslint-plugin 1.52.6
Stack trace
Additional context
No response
Metadata
Metadata
Assignees
Labels
Status: ReleasedThe issue has been releasedThe issue has been releasedType: BugSomething isn't workingSomething isn't working