|
14 | 14 |
|
15 | 15 | This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names. All the goodness that the ES2015+ static module syntax intends to provide, marked up in your editor.
|
16 | 16 |
|
| 17 | +It started as a fork of [`eslint-plugin-import`] using [`get-tsconfig`] to replace [`tsconfig-paths`] and heavy [`typescript`] under the hood, making it faster, through less [heavy dependency on Typescript](https://github.com/import-js/eslint-plugin-import/blob/da5f6ec13160cb288338db0c2a00c34b2d932f0d/src/exportMap/typescript.js#L16), and cleaner dependencies altogether. |
| 18 | + |
17 | 19 | [`eslint-plugin-i` is now `eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x/issues/24#issuecomment-1991605123)
|
18 | 20 |
|
19 | 21 | **IF YOU ARE USING THIS WITH SUBLIME**: see the [bottom section](#sublimelinter-eslint) for important info.
|
20 | 22 |
|
21 | 23 | ## TOC <!-- omit in toc -->
|
22 | 24 |
|
| 25 | +- [Why](#why) |
| 26 | +- [Differences](#differences) |
23 | 27 | - [Installation](#installation)
|
24 | 28 | - [Configuration (legacy: `.eslintrc*`)](#configuration-legacy-eslintrc)
|
25 | 29 | - [TypeScript](#typescript)
|
@@ -50,6 +54,35 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
|
50 | 54 | - [Changelog](#changelog)
|
51 | 55 | - [License](#license)
|
52 | 56 |
|
| 57 | +## Why |
| 58 | + |
| 59 | +Many issues cannot be fixed easily without API changes. For example, see: |
| 60 | + |
| 61 | +- <https://github.com/import-js/eslint-plugin-import/issues/1479> |
| 62 | +- <https://github.com/import-js/eslint-plugin-import/issues/2108> |
| 63 | +- <https://github.com/import-js/eslint-plugin-import/issues/2111> |
| 64 | + |
| 65 | +[`eslint-plugin-import`] refused to accept BREAKING CHANGES for these issues, so we had to fork it. |
| 66 | + |
| 67 | +[`eslint-plugin-import`] now claims in <https://github.com/un-ts/eslint-plugin-import-x/issues/170> that it will accept BREAKING CHANGES. However, still nothing is happening: <https://github.com/import-js/eslint-plugin-import/pull/3091>. |
| 68 | + |
| 69 | +[`eslint-plugin-import`] refuses to support the `exports` feature, and the maintainer even locked the feature request issue <https://github.com/import-js/eslint-plugin-import/issues/1810> to prevent future discussion. In the meantime, `eslint-plugin-import-x` now provides first-party support for the `exports` feature <https://github.com/un-ts/eslint-plugin-import-x/pull/209>, which will become the default in the next major version (v5). |
| 70 | + |
| 71 | +We haven't resolved all the issues yet, but we are working on them, which could happen in the next major version (v5): <https://github.com/un-ts/eslint-plugin-import-x/issues/235>. |
| 72 | + |
| 73 | +## Differences |
| 74 | + |
| 75 | +So what are the differences from `eslint-plugin-import` exactly? |
| 76 | + |
| 77 | +- we target [Node `^18.18.0 || ^20.9.0 || >=21.1.0`](https://github.com/un-ts/eslint-plugin-import-x/blob/8b2d6d3b612eb57fb68c3fddec25b02fc622df7c/package.json#L12) + [ESLint `^8.57.0 || ^9.0.0`](https://github.com/un-ts/eslint-plugin-import-x/blob/8b2d6d3b612eb57fb68c3fddec25b02fc622df7c/package.json#L71), while `eslint-plugin-import` targets [Node `>=4`](https://github.com/import-js/eslint-plugin-import/blob/da5f6ec13160cb288338db0c2a00c34b2d932f0d/package.json#L6) and [ESLint `^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9`](https://github.com/import-js/eslint-plugin-import/blob/da5f6ec13160cb288338db0c2a00c34b2d932f0d/package.json#L115C16-L115C64) |
| 78 | +- we don't depend on old and outdated dependencies, so [we have 49 dependencies](https://npmgraph.js.org/?q=eslint-plugin-import-x) compared to [117 dependencies for `eslint-plugin-import`](https://npmgraph.js.org/?q=eslint-plugin-import) |
| 79 | +- `eslint-plugin-import` uses `tsconfig-paths` + `typescript` itself to load `tsconfig`s while we use the single `get-tsconfig` instead, which is much faster and cleaner |
| 80 | +- `eslint-plugin-import` uses [`resolve`] which doesn't support the `exports` field in `package.json` while we build our own rust-based resolver [`unrs-resolver`] instead, which is feature-rich and way more performant. |
| 81 | +- Our [v3 resolver](./resolvers/README.md#v3) interface shares a single `resolver` instance by default which is used all across resolving chains so it would benefit from caching and memoization out-of-the-box |
| 82 | +- ... |
| 83 | + |
| 84 | +The list could be longer in the future, but we don't want to make it too long here. Hope you enjoy and let's get started. |
| 85 | + |
53 | 86 | ## Installation
|
54 | 87 |
|
55 | 88 | ```sh
|
@@ -662,9 +695,15 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
|
662 | 695 | [MIT][] © [JounQin][]@[1stG.me][]
|
663 | 696 |
|
664 | 697 | [`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
|
| 698 | +[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import |
665 | 699 | [`eslint-import-resolver-typescript`]: https://github.com/import-js/eslint-import-resolver-typescript
|
666 | 700 | [`eslint_d`]: https://www.npmjs.com/package/eslint_d
|
667 | 701 | [`eslint-loader`]: https://www.npmjs.com/package/eslint-loader
|
| 702 | +[`get-tsconfig`]: https://github.com/privatenumber/get-tsconfig |
| 703 | +[`napi-rs`]: https://github.com/napi-rs/napi-rs |
| 704 | +[`tsconfig-paths`]: https://github.com/dividab/tsconfig-paths |
| 705 | +[`typescript`]: https://github.com/microsoft/TypeScript |
| 706 | +[`unrs-resolver`]: https://github.com/unrs/unrs-resolver |
668 | 707 | [`resolve`]: https://www.npmjs.com/package/resolve
|
669 | 708 | [`externals`]: https://webpack.github.io/docs/library-and-externals.html
|
670 | 709 | [1stG.me]: https://www.1stG.me
|
|
0 commit comments