Skip to content

Bug: "Type 'typeof plugin' is not assignable to type 'Plugin'." #178

@Janpot

Description

@Janpot

Environment

ESLint version: 9.39.0
@eslint/json version: 0.13.2
Node version: v20.19.1
npm version: 10.8.2
Operating System: Stackblitz webcontainer

Which language are you using?

json

What did you do?

Just as from the README

Configuration
import { defineConfig } from 'eslint/config';
import json from '@eslint/json';

/**
 * @returns {import('eslint').Linter.Config[]}
 */
export function createJsonConfig() {
  return defineConfig([
    {
      name: 'JSON files',
      files: ['**/*.json'],
      ignores: ['package-lock.json'],
      plugins: { json },
      language: 'json/json',
      extends: [json.configs.recommended],
    },

    {
      name: 'JSONC files',
      files: [
        '**/*.jsonc',
        '**/tsconfig.json',
        '**/tsconfig.*.json',
        '.vscode/**/*.json',
        'renovate.json',
      ],
      plugins: { json },
      language: 'json/jsonc',
      extends: [json.configs.recommended],
    },

    {
      name: 'JSON5 files',
      files: ['**/*.json5'],
      plugins: { json },
      language: 'json/json5',
      extends: [json.configs.recommended],
    },
  ]);
}

What did you expect to happen?

no typescript errors

What actually happened?

Typescript error

eslint.config.mjs:7:7 - error TS2322: Type 'typeof plugin' is not assignable to type 'Plugin'.
  Types of property 'rules' are incompatible.

See https://stackblitz.com/edit/stackblitz-starters-4dbwc63k

Link to Minimal Reproducible Example

https://stackblitz.com/edit/stackblitz-starters-4dbwc63k

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

We ran into this at mui/mui-public#774

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedbugSomething isn't workingrepro:yesIssues with a reproducible example

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions