Package Exports
- eslint-ts-patch
- eslint-ts-patch/package.json
- eslint-ts-patch/register
- eslint-ts-patch/use-at-your-own-risk
Readme
eslint-ts-patch
Support loading eslint.config.mjs and eslint.config.ts as flat config files for ESLint.
Configure files will be searched in the following order, the first one found will be used:
eslint.config.jseslint.config.cjseslint.config.mjseslint.config.tseslint.config.ctseslint.config.mts
For .js, .cjs, and .mjs files, they will be loaded by Node's native import().
For .ts, .cts, and .mts files, they will be loaded using jiti.
Context: Unfortunately ESLint team decided to not support .cjs and .mjs.
Install
npm i -D eslint-ts-patch eslint@npm:eslint-ts-patchIt should make your eslint CLI works for MJS and TypeScript flat config files. If it's still not, you can try switching the CLI to eslint-ts.
Versioning
This package proxies all ESLint exports, it should be compatible by aliasing the eslint package. The version of this package is the same as the latest supported ESLint version. It's using ^ relaxed dependency of eslint, so it should work with any newer versions of ESLint.
When this package releases patches while ESLint hasn't bumped its version, it will be released with the same version as ESLint with a patch version suffix, e.g. 8.55.0-1
How it works
As the support of eslint.config.js seems to be quite hard-coded in ESLint, this package proxies all exports of ESLint and installs this register beforehand. The register will swap some internal code of ESLint at runtime to make it work.
Disclaimer
It's only recommended to install this as top-level development dependency (user-aware). For plugin or library authors, it's ok to document the usage of this package for better DX. But please avoid having this as the dependency of your library or plugin, otherwise, take your own risk.
Sponsors
License
MIT License © 2023-PRESENT Anthony Fu