-
Notifications
You must be signed in to change notification settings - Fork 108
Organize imports with Prettier plugin #2853
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
Conversation
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.
There are plenty of unused imports, but they can be hidden in the noise, so I've highlighted two.
@@ -18,7 +18,6 @@ | |||
*/ | |||
|
|||
import { Dictionary } from '@spec_utils/Dictionary' | |||
import { UserDefinedValue } from '@spec_utils/UserDefinedValue' |
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.
Here's an example of unused import.
import { IndexSettings } from '@indices/_types/IndexSettings' | ||
import { Dictionary } from '@spec_utils/Dictionary' | ||
import { IndexName, Metadata, Name, VersionNumber } from '@_types/common' | ||
import { TypeMapping } from '@_types/mapping/TypeMapping' | ||
import { | ||
DataStreamLifecycle, |
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.
And this is the import that actively misled me, as it shows up when I asked my editor to find references or DataStreamLifecycle
.
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
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!
If it does not change the output, I assume it's fine.
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.14 8.14
# Navigate to the new working tree
cd .worktrees/backport-8.14
# Create a new branch
git switch --create backport-2853-to-8.14
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 82c3eff90b4db30469321f9f67c26d5753452b2b
# Push it to GitHub
git push --set-upstream origin backport-2853-to-8.14
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.14 Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.15 8.15
# Navigate to the new working tree
cd .worktrees/backport-8.15
# Create a new branch
git switch --create backport-2853-to-8.15
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 82c3eff90b4db30469321f9f67c26d5753452b2b
# Push it to GitHub
git push --set-upstream origin backport-2853-to-8.15
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.15 Then, create a pull request where the |
(cherry picked from commit 82c3eff)
(cherry picked from commit 82c3eff)
Prettier does not organize imports by default, but there's a popular plugin to do so: https://www.npmjs.com/package/prettier-plugin-organize-imports. My initial motivation was to avoid unused imports, but not having to worry about import order is nice too.