Skip to content

Type augmentation is broken on ESLint >= 9.38.0 #19

@abarani

Description

@abarani

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

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

Contributions

  • 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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions