-
-
Notifications
You must be signed in to change notification settings - Fork 43
docs: add why
section on the top to clarify
#323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
35a0087
0d2833a
ae2c473
2db56e5
360a34b
f74abd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default } from '@1stg/lint-staged/tsc' | ||
export { default } from '@1stg/nano-staged/tsc' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I've been swamped this week but hoped to get to reviewing this before merge. Filing a bookmark to come back to you with a review soon. Sorry for the delay! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,16 @@ | |
|
||
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. | ||
|
||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
replace
|
||
|
||
[`eslint-plugin-i` is now `eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x/issues/24#issuecomment-1991605123) | ||
|
||
**IF YOU ARE USING THIS WITH SUBLIME**: see the [bottom section](#sublimelinter-eslint) for important info. | ||
|
||
## TOC <!-- omit in toc --> | ||
|
||
- [Why](#why) | ||
- [Differences](#differences) | ||
- [Installation](#installation) | ||
- [Configuration (legacy: `.eslintrc*`)](#configuration-legacy-eslintrc) | ||
- [TypeScript](#typescript) | ||
|
@@ -50,6 +54,34 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a | |
- [Changelog](#changelog) | ||
- [License](#license) | ||
|
||
## Why | ||
|
||
Because a lot of issues can not be fixed easily without API changes, see | ||
|
||
- <https://github.com/import-js/eslint-plugin-import/issues/1479> | ||
- <https://github.com/import-js/eslint-plugin-import/issues/2108> | ||
- <https://github.com/import-js/eslint-plugin-import/issues/2111> | ||
Comment on lines
+61
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (more on this on the next line) Having three issue links is a good start, but all three require a ton of reading. Two are labeled as |
||
|
||
But [`eslint-plugin-import`] refused to accept BREAKING CHANGES for these issues, so we have to fork it. | ||
|
||
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>, | ||
but it still doesn't happen or even seems to happen: <https://github.com/import-js/eslint-plugin-import/pull/3091>. | ||
|
||
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>. | ||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Differences | ||
|
||
So what's the differences from `eslint-plugin-import` exactly? | ||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- 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) | ||
- 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> | ||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- `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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prove it! Show me the data! 😄 As a developer, I have been trained to not believe any performance comparison not backed up by data. One should always back perf comparisons up with repeatable experiments. Note that isolated experiments in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://github.com/privatenumber/get-tsconfig#features I can't say for 3rd part libraries. And I'm not interested to prove it because it may be hard as you said. Similar package: https://github.com/dominikg/tsconfck with benchmark https://github.com/dominikg/tsconfck/blob/main/docs/benchmark.md And There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why would an end-user care about this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we're cleaning the ecosystem? https://e18e.dev/guide/cleanup.html |
||
- `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 | ||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- 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 | ||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- ... | ||
|
||
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. | ||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Installation | ||
|
||
```sh | ||
|
@@ -662,13 +694,19 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m | |
[MIT][] © [JounQin][]@[1stG.me][] | ||
|
||
[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser | ||
[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import | ||
[`eslint-import-resolver-typescript`]: https://github.com/import-js/eslint-import-resolver-typescript | ||
[`eslint_d`]: https://www.npmjs.com/package/eslint_d | ||
[`eslint-loader`]: https://www.npmjs.com/package/eslint-loader | ||
[`get-tsconfig`]: https://github.com/privatenumber/get-tsconfig | ||
[`tsconfig-paths`]: https://github.com/dividab/tsconfig-paths | ||
[`typescript`]: https://github.com/microsoft/TypeScript | ||
[`unrs-resolver`]: https://github.com/unrs/unrs-resolver | ||
[`resolve`]: https://www.npmjs.com/package/resolve | ||
[`externals`]: https://webpack.github.io/docs/library-and-externals.html | ||
[1stG.me]: https://www.1stG.me | ||
[JounQin]: https://github.com/JounQin | ||
[MIT]: http://opensource.org/licenses/MIT | ||
[napi-rs]: https://github.com/napi-rs/napi-rs | ||
[node]: https://www.npmjs.com/package/eslint-import-resolver-node | ||
[webpack]: https://www.npmjs.com/package/eslint-import-resolver-webpack |
Uh oh!
There was an error while loading. Please reload this page.