|
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, 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,34 @@ 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 | +Because a lot of issues can not be fixed easily without API changes, 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 | +But [`eslint-plugin-import`] refused to accept BREAKING CHANGES for these issues, so we have to fork it. |
| 66 | + |
| 67 | +And then [`eslint-plugin-import`] claimed to be allowed to update with BREAKING CHANGES at <https://github.com/un-ts/eslint-plugin-import-x/issues/170>, |
| 68 | +but it still doesn't happen or even seems to happen: <https://github.com/import-js/eslint-plugin-import/pull/3091>. |
| 69 | + |
| 70 | +We haven't resolved all the issues yet, but we are working on it which could happen in the next major version (v5): <https://github.com/un-ts/eslint-plugin-import-x/issues/235>. |
| 71 | + |
| 72 | +## Differences |
| 73 | + |
| 74 | +So what's the differences from `eslint-plugin-import` exactly? |
| 75 | + |
| 76 | +- 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) |
| 77 | +- we don't depend on old and outdated dependencies, so we have short dependency depths, see also <https://github.com/un-ts/eslint-plugin-import-x/pull/11> |
| 78 | +- `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 |
| 79 | +- `eslint-plugin-import` uses [`resolve`] which doesn't support `exports` field in `package.json` while we use [`unrs-resolver`] instead, which is a [napi-rs] project so it's much faster |
| 80 | +- 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 box |
| 81 | +- ... |
| 82 | + |
| 83 | +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. |
| 84 | + |
53 | 85 | ## Installation
|
54 | 86 |
|
55 | 87 | ```sh
|
@@ -662,13 +694,19 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
|
662 | 694 | [MIT][] © [JounQin][]@[1stG.me][]
|
663 | 695 |
|
664 | 696 | [`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
|
| 697 | +[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import |
665 | 698 | [`eslint-import-resolver-typescript`]: https://github.com/import-js/eslint-import-resolver-typescript
|
666 | 699 | [`eslint_d`]: https://www.npmjs.com/package/eslint_d
|
667 | 700 | [`eslint-loader`]: https://www.npmjs.com/package/eslint-loader
|
| 701 | +[`get-tsconfig`]: https://github.com/privatenumber/get-tsconfig |
| 702 | +[`tsconfig-paths`]: https://github.com/dividab/tsconfig-paths |
| 703 | +[`typescript`]: https://github.com/microsoft/TypeScript |
| 704 | +[`unrs-resolver`]: https://github.com/unrs/unrs-resolver |
668 | 705 | [`resolve`]: https://www.npmjs.com/package/resolve
|
669 | 706 | [`externals`]: https://webpack.github.io/docs/library-and-externals.html
|
670 | 707 | [1stG.me]: https://www.1stG.me
|
671 | 708 | [JounQin]: https://github.com/JounQin
|
672 | 709 | [MIT]: http://opensource.org/licenses/MIT
|
| 710 | +[napi-rs]: https://github.com/napi-rs/napi-rs |
673 | 711 | [node]: https://www.npmjs.com/package/eslint-import-resolver-node
|
674 | 712 | [webpack]: https://www.npmjs.com/package/eslint-import-resolver-webpack
|
0 commit comments