-
-
Notifications
You must be signed in to change notification settings - Fork 10k
[Bug]: Config is not assignable to type when using defineConfig #34468
Copy link
Copy link
Open
Description
Describe the bug
We are using defineConfig in our project for setting up ESLint:
export default defineConfig([
globalIgnores([
"coverage",
"dist",
"node_modules",
".astro/**",
".github",
".vscode",
"!.storybook",
]),
{
...
},
...storybook.configs["flat/recommended"],
]);When linting it with it, we get:
Type '{ name: string; plugins: { readonly storybook: { configs: any; rules: { 'await-interactions': RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>; ... 14 more ...; 'use-storybook-testing-library': RuleModule<...>; }; }; }; files?: undefined; rules?: undefined; } | { ...; } | { ...' is not assignable to type 'InfiniteArray<ConfigWithExtends>'.
Type '{ name: string; plugins: { readonly storybook: { configs: any; rules: { 'await-interactions': RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>; ... 14 more ...; 'use-storybook-testing-library': RuleModule<...>; }; }; }; files?: undefined; rules?: undefined; }' is not assignable to type 'InfiniteArray<ConfigWithExtends>'.
Type '{ name: string; plugins: { readonly storybook: { configs: any; rules: { 'await-interactions': RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>; ... 14 more ...; 'use-storybook-testing-library': RuleModule<...>; }; }; }; files?: undefined; rules?: undefined; }' is not assignable to type 'ConfigWithExtends'.
Types of property 'plugins' are incompatible.
Type '{ readonly storybook: { configs: any; rules: { 'await-interactions': RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>; 'context-in-play-function': RuleModule<...>; ... 13 more ...; 'use-storybook-testing-library': RuleModule<...>; }; }; }' is not assignable to type 'Record<string, Plugin>'.
Property 'storybook' is incompatible with index signature.
Type '{ configs: any; rules: { 'await-interactions': RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>; 'context-in-play-function': RuleModule<...>; ... 13 more ...; 'use-storybook-testing-library': RuleModule<...>; }; }' is not assignable to type 'Plugin'.
Types of property 'rules' are incompatible.
Type '{ 'await-interactions': RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>; 'context-in-play-function': RuleModule<"passContextToPlayFunction", never[], unknown, RuleListener>; ... 13 more ...; 'use-storybook-testing-library': RuleModule<...>; }' is not assignable to type 'Record<string, RuleDefinition<RuleDefinitionTypeOptions>>'.
Property ''await-interactions'' is incompatible with index signature.
Type 'RuleModule<"interactionShouldBeAwaited" | "fixSuggestion", never[], unknown, RuleListener>' is not assignable to type 'RuleDefinition<RuleDefinitionTypeOptions>'.
Types of property 'create' are incompatible.
Type '(context: Readonly<RuleContext<"interactionShouldBeAwaited" | "fixSuggestion", never[]>>) => 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<"interactionShouldBeAwaited" | "fixSuggestion", never[]>>': parserOptions, parserPath, getAncestors, getDeclaredVariables, and 6 more.Reproduction link
https://github.com/SalahAdDin/central-mosque-bogota/tree/main/frontend
Reproduction steps
- Go to the
eslint.config.ts. - Run the linter.
- See the error.
System
│ Storybook Environment Info:
│
│ System:
│ OS: Linux 6.12 Deepin 25 25
│ CPU: (32) x64 Intel(R) Core(TM) i9-14900HX
│ Shell: 5.9 - /usr/bin/zsh
│ Binaries:
│ Node: 24.14.1 - /run/user/1001/fnm_multishells/34205_1775444517610/bin/node
│ Yarn: 1.22.22 - /usr/local/bin/yarn
│ npm: 11.11.0 - /run/user/1001/fnm_multishells/34205_1775444517610/bin/npm
│ pnpm: 10.33.0 - /run/user/1001/fnm_multishells/34205_1775444517610/bin/pnpm
│ <----- active
│ npmPackages:
│ @storybook/addon-a11y: 10.3.4 => 10.3.4
│ @storybook/addon-designs: 11.1.3 => 11.1.3
│ @storybook/addon-docs: 10.3.4 => 10.3.4
│ @storybook/addon-themes: 10.3.4 => 10.3.4
│ @storybook/addon-vitest: 10.3.4 => 10.3.4
│ @storybook/builder-vite: 10.3.4 => 10.3.4
│ eslint-plugin-storybook: 10.3.4 => 10.3.4
│ storybook: 10.3.4 => 10.3.4
│ storybook-addon-rtl: 3.0.1 => 3.0.1
│ storybook-addon-tag-badges: 3.1.0 => 3.1.0Additional context
No response
Reactions are currently unavailable