Skip to content

Comments

fix: export more precise plugin type#68

Draft
serhalp wants to merge 1 commit intoe18e:mainfrom
serhalp:fix/67
Draft

fix: export more precise plugin type#68
serhalp wants to merge 1 commit intoe18e:mainfrom
serhalp:fix/67

Conversation

@serhalp
Copy link

@serhalp serhalp commented Feb 18, 2026

Problem

Fixes #67.

Fix

  • Use satisfies ESLint.Plugin instead of : ESLint.Plugin type annotation to preserve the inferred type of the default export
  • Restructure config assignment to avoid mutation and unsafe non-null assertion

The generated .d.ts now types configs as a required property with all four named configs as Linter.Config.

- Use `satisfies ESLint.Plugin` instead of `: ESLint.Plugin` type annotation to preserve the
  inferred type of the default export
- Restructure config assignment to avoid mutation and unsafe non-null assertion

The generated `.d.ts` now types `configs` as a required property with all four named configs as
`Linter.Config`.

See e18e#67 for what this is fixing.
@serhalp
Copy link
Author

serhalp commented Feb 18, 2026

Note that strictly speaking this adds a requirement of TypeScript 4.9 (released Nov 2022), which added satisfies.

};
} satisfies ESLint.Plugin;

plugin.configs!.recommended = recommended(plugin);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason for this was so the plugin a config has is the same plugin you import.

this isn't the case anymore if you export a new object (L56).

which means ESLint's new extends syntax will get confused. e.g.

{
  plugins: [
    e18e
  },
  extends: [
    'e18e/recommended' // this'll now cause problems since the `e18e` above and the one this config holds are different objects
  ]
}

@serhalp serhalp marked this pull request as draft February 20, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e18e.configs is possibly undefined when in type-checked eslint config files

2 participants