-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat!: add import sorting rule #126
Conversation
This PR shows an example of what changes ipfs/eslint-config-ipfs#126 would enforce. All of this these changes (except package.json) were done by running `npm run lint -- --fix`. CALLOUTS: 1. eslint was failing with locally linked package on missing plugins. 1. lint fix was called twice, with the first run failing due to an empty line the first fix runthrough didn't fix. 1. tsc seems to be failing for aegir
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.
LGTM. I don't love all the empty lines between groups of imports because you frequently have one lone import in a group which just looks weird sitting there all on it's own, but I don't hate them either.
I updated the title to be feat!:
because feature will break linting for pretty much every project, though it's easy to fix.
One caveat is that --fix
only moves the imports around - it doesn't move the accompanying // @ts-expect-error no types
comments we have in lots of places above imports of modules that don't ship with types.
ipfs/eslint-config-ipfs#126 will introduce linting rules on import sorting so order imports during building in a way that will comply with the new linting rules.
ipfs/eslint-config-ipfs#126 will introduce linting rules on import sorting so order imports during building in a way that will comply with the new linting rules.
Yea, that's important. we could update the rule to support moving associated comments, but I haven't looked into that. |
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.
A few suggestions to make this a bit simpler.
Lint import sorting, and support auto-fixing of import order. see ipfs/aegir#1178 for an example --------- Co-authored-by: Alex Potsides <alex@achingbrain.net>
## [4.0.0](v3.1.7...v4.0.0) (2023-04-05) ### ⚠ BREAKING CHANGES * `await` is not allowed before `return` unless it is inside a `try/catch` in which case it is required Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> * previously jsx and tsx files were not linted, now they are * add import sorting rule (#126) ### Features * add import sorting rule ([#126](#126)) ([1462d09](1462d09)) * lint jsx ([#140](#140)) ([fb5e5b6](fb5e5b6)) ### Bug Fixes * only require `await`ing promises returned from inside try/catch blocks ([#133](#133)) ([a6e4a7b](a6e4a7b)), closes [#130](#130) ### Trivial Changes * convert to aegir project ([81d8ba3](81d8ba3)) * **deps:** bump eslint-config-standard-with-typescript from 27.0.1 to 34.0.1 ([#135](#135)) ([fc9aa6f](fc9aa6f)) * **deps:** bump eslint-plugin-jsdoc from 39.9.1 to 40.1.1 ([#139](#139)) ([bd1422b](bd1422b)) * fix linting ([adffc58](adffc58)) * use unified ci ([2674c56](2674c56))
Lint import sorting, and support auto-fixing of import order. see ipfs/aegir#1178 for an example