-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Description:
When using @vitest/eslint-plugin
in a flat ESLint config with TypeScript, I encounter the following type error:
TS2322: Type '{ meta: { name: string; version: string; }; rules: { ... } }' is not assignable to type 'Plugin'.
Types of property 'configs' are incompatible.
Type '{ ...; env: { ... } }' is not assignable to type 'Record<string, Config<RulesRecord> | LegacyConfig<RulesRecord, RulesRecord> | Config<RulesRecord>[]>'.
Property 'env' is incompatible with index signature.
Type '{ name: string; languageOptions: { globals: { ... } } }' is not assignable to type 'Config<RulesRecord> | LegacyConfig<RulesRecord, RulesRecord> | Config<RulesRecord>[]'.
Type '{ name: string; languageOptions: { globals: { ... } } }' is not assignable to type 'Config<RulesRecord>'.
The types of 'languageOptions.globals' are incompatible between these types.
Type '{ suite: string; ... }' is not assignable to type 'Globals'.
Property 'suite' is incompatible with index signature.
Type 'string' is not assignable to type 'GlobalConf'.
Excerpt from my config:
import Vitest from "@vitest/eslint-plugin";
import type { Linter } from "eslint";
const ESLINT_TESTS_CONFIG = {
name: "tests",
files: ["tests/**/*.spec.ts"],
plugins: { vitest: Vitest },
// ...
} satisfies Linter.Config;
Environment:
@vitest/eslint-plugin
version:1.3.4
- TypeScript version:
5.8.3
- ESLint version:
9.30.1
Steps to reproduce:
- Import and use the plugin in a flat ESLint config with TypeScript.
- Assign the plugin to the
plugins
property. - Type-check the config.
Expected behavior:
No type errors should occur when using the plugin in a flat config with TypeScript.
Actual behavior:
TypeScript reports a type incompatibility for the env
property in the plugin's configs
.
Additional context:
It appears the env
config in the plugin uses a globals
object with string values, but the expected type is GlobalConf
. This causes a type mismatch in strict TypeScript projects.
Thank you for your work on this plugin! π
aryaemami59, kouts, zemd, websolutions-hamburg, bsiguret and 1 more
Metadata
Metadata
Assignees
Labels
No labels