-
-
Notifications
You must be signed in to change notification settings - Fork 41
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 all 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' |
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,35 @@ | |||||||||
- [Changelog](#changelog) | ||||||||||
- [License](#license) | ||||||||||
|
||||||||||
## Why | ||||||||||
|
||||||||||
Many issues cannot be fixed easily without API changes. For example, 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 |
||||||||||
|
||||||||||
[`eslint-plugin-import`] refused to accept BREAKING CHANGES for these issues, so we had to fork it. | ||||||||||
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. This sentence might be accurate, but it's not precise. Saying someone "refused" and you "had to fork" could mean a lot of things. As a result I think it sounds accusatory, even though that's not the intent. "refused" is a loaded word! I think what this line is really trying to get at is why it is/was difficult to get these changes upstream. Right? import-js/eslint-plugin-import#1479 (comment) & import-js/eslint-plugin-import#1479 (comment) -> the issue is marked as import-js/eslint-plugin-import#2108 (comment) -> import-js/eslint-plugin-import#2108 (comment): same thing but with a draft PR that has a pending question. So it's similarly that it's just difficult & more work to work with their constraints, right? import-js/eslint-plugin-import#2111: same thing with import-js/eslint-plugin-import#2111 (comment), just a 'no breaking changes' constraint that makes the design space harder? Here's a first draft at a rewrite...
Suggested change
...but I'm not confident that that rewrite is 100% right. I'm trying to convey exactly the technical reasons without implying any "blame". More word-crafting is probably required. 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.
I don't get what's blocking the PR actually. All tests are passing. And when the maintainer says "is this potentially a breaking change", I just don't want to continue that PR. All possible breaking changes are refused. All the issues are in the same condition IMO. |
||||||||||
|
||||||||||
[`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>. | ||||||||||
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. Have you checked with ljharb? Is this just pending review? As an outsider, seeing a 7 month old semver-major PR without review makes me think there's some intrigue behind-the-scenes I'm not privy to. 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 should I/we do that, we've already moved away for a long time? |
||||||||||
|
||||||||||
[`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). | ||||||||||
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.
It looks to me like the root issue of fixing
My read of import-js/eslint-plugin-import#1810 (comment) was that the lock was because one particular person was repeatedly arguming with the maintainer on that one day, and the conversation was getting heated & off-topic? The "for a bit" makes me think the conversation was supposed to be un-locked and that just never happened, unintentionally. Maybe now is the time for a ping to re-open? 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.
Difficult due to backward compatibility, so it's just refusing.
You may help to reconstruct the sentence, it's just our feelings, everyone could have different feelings.
Feel free to do that, while I'm not interested. |
||||||||||
|
||||||||||
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>. | ||||||||||
JounQin marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
## Differences | ||||||||||
|
||||||||||
So what are the differences from `eslint-plugin-import` exactly? | ||||||||||
|
||||||||||
- 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 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) | ||||||||||
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. Data request: the counts and links to npmgraph are a good start, but don't immediately describe what the real impact is. Dependency tree size is abstract and vague, and not an end-user metric (e.g. 1 of the 49 dependencies might be larger than all of the opposing 117 combined). In order to get to any end-user-relevant info such as the actual unpacked module size you have to know to:
I think most readers will not do that, so calling out the 6 MB vs 36 MB comparison here would be required for getting it known. 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. We'll get even less dependencies when dropping |
||||||||||
- `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 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. | ||||||||||
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.
This is abstract and non-tangible: what do you mean? How is this relevant to a reader? 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. Feel free to PR to replace them. |
||||||||||
- 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 | ||||||||||
- ... | ||||||||||
|
||||||||||
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. | ||||||||||
|
||||||||||
## Installation | ||||||||||
|
||||||||||
```sh | ||||||||||
|
@@ -662,9 +695,15 @@ | |||||||||
[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 | ||||||||||
[`napi-rs`]: https://github.com/napi-rs/napi-rs | ||||||||||
Check warning on line 703 in README.md
|
||||||||||
[`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 | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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!