eslint-typegen icon indicating copy to clipboard operation
eslint-typegen copied to clipboard

Type augmentation is broken on ESLint >= 9.38.0

Open abarani opened this issue 5 months ago • 0 comments

Describe the bug

When the includeAugmentation option is set the generated code contains the following declaration:

declare module 'eslint' {
  namespace Linter {
    interface RulesRecord extends RuleOptions {}
  }
}

In ESLint 9.38.0 Linter.RulesRecord is now a type in place of an interface and thus can no longer be extended: https://github.com/eslint/eslint/blob/8fe511b4c0fb74df3290271b29c672c3fbf3be1f/lib/types/index.d.ts#L1328

If I'm getting it correctly the new proposed way to extend config type going forward is:

declare module '@eslint/core' {
  interface RulesConfig extends RuleOptions {}
}

As a side note Linter.RuleEntry has been changed too in ESLint 9.39.0. Although it still work as the type is essentially the same, it may be worth importing RuleConfig directly from the @eslint/core module.

Reproduction

Generate any .d.ts file with includeAugmentation set

System Info

-

Used Package Manager

pnpm

Validations

  • [x] Follow our Code of Conduct
  • [x] Read the Contributing Guide.
  • [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [x] The provided reproduction is a minimal reproducible of the bug.

Contributions

  • [x] I am willing to submit a PR to fix this issue
  • [ ] I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

abarani avatar Nov 06 '25 14:11 abarani