Skip to content

Wrong typing in flat config: SourceType #2555

Closed
@phil294

Description

@phil294

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 9.10.0
  • eslint-plugin-vue version: 9.28.0
  • Vue version: 3.5.5
  • Node version: 18.20.4
  • Operating System: Manjaro Linux

Please show your full configuration:

// eslint.config.mjs
import pluginVue from 'eslint-plugin-vue'

/** @type {import('eslint').Linter.Config[]} */
export default [
	...pluginVue.configs['flat/recommended'],
]

What did you do?

enable strict type checking in JS files

What did you expect to happen?
no error in lint config

What actually happened?

TS doesn't like the types here:

Type '({ name: string; plugins: { readonly vue: { meta: typeof import("/home/phi/b/git-log--graph-vscode-ext/node_modules/eslint-plugin-vue/lib/meta"); configs: { base: { parser: string; parserOptions: { ecmaVersion: number; sourceType: string; }; env: { ...; }; plugins: string[]; rules: { ...; }; }; ... 13 more ...; 'fla...' is not assignable to type 'Config<RulesRecord>[]'.
  Type '{ name: string; plugins: { readonly vue: { meta: typeof import("/home/phi/b/git-log--graph-vscode-ext/node_modules/eslint-plugin-vue/lib/meta"); configs: { base: { parser: string; parserOptions: { ecmaVersion: number; sourceType: string; }; env: { ...; }; plugins: string[]; rules: { ...; }; }; ... 13 more ...; 'flat...' is not assignable to type 'Config<RulesRecord>'.
    Type '{ name: string; plugins: { readonly vue: { meta: typeof import("/home/phi/b/git-log--graph-vscode-ext/node_modules/eslint-plugin-vue/lib/meta"); configs: { base: { parser: string; parserOptions: { ecmaVersion: number; sourceType: string; }; env: { ...; }; plugins: string[]; rules: { ...; }; }; ... 13 more ...; 'flat...' is not assignable to type 'Config<RulesRecord>'.
      The types of 'languageOptions.sourceType' are incompatible between these types.
        Type 'string' is not assignable to type 'SourceType | undefined'.ts(2322)

Repository to reproduce this issue

https://github.com/phil294/bug-repro-vue-eslint

Clone and open in VSCode, open eslint.config.mjs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions