Skip to content

Bug: distributing types.ts makes it checked by TypeScript, which might find unfixable problems #397

Closed
@andreww2012

Description

@andreww2012

Environment

ESLint version: 9.28.0
@eslint/markdown version: 6.4.0
Node version: n/a
npm version: pnpm 10.11.0
Operating System: Stackblitz

Which language are you using?

commonmark

What did you do?

Hello! Due to distribution of types.ts with this package, TypeScript tries to typecheck it and on certain setups, it might report unfixable type errors.

We have remark@14.0.2 installed as a dependency, which in turn has a dependency "@types/mdast": "^3.0.0".

Probably due to how pnpm places file with shamefully-hoist=true and due to how TypeScript modules resolution works, type-import of mdast from @eslint/markdown resolves to v3 instead of v4 which causes TS compiler to report errors.

My eslint.config.ts:

import eslintPluginMarkdown from '@eslint/markdown';
import { defineConfig } from 'eslint/config';

export default defineConfig({
  files: ['*.md'],
  plugins: {
    markdown: eslintPluginMarkdown,
  },
});

What did you expect to happen?

I expect no type errors which would have not been reported if types.ts file was not distributed, because only .d.ts from node_modules are not checked with TS' "skipLibCheck": true.

What actually happened?

Described above

Link to Minimal Reproducible Example

https://stackblitz.com/edit/vitejs-vite-4oazaeek

Participation

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

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrepro:neededThis issue should include a reproducible example

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions