Skip to content

Add eslint rule to alphabetize imports#3994

Merged
joshri merged 2 commits intomainfrom
alphabetize-imports
Sep 11, 2023
Merged

Add eslint rule to alphabetize imports#3994
joshri merged 2 commits intomainfrom
alphabetize-imports

Conversation

@joshri
Copy link
Copy Markdown
Contributor

@joshri joshri commented Sep 7, 2023

Related: weaveworks/weave-gitops-enterprise#3215

Took a dip into the .eslintrc to prepare for work on unifying our configs between OSS and EE. This PR adds a rule that alphabetizes imports in ascending order. You can easily configure this as part of your formatting on save if you're finding yourself having to run npm run lint -- --fix too much by setting

"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },

in your settings.json

@joshri joshri added area/ui Issues that require front-end work ui_triage Cross-team/project UI issues for triage labels Sep 7, 2023
@joshri joshri requested a review from jpellizzari September 7, 2023 22:56
@joshri joshri force-pushed the alphabetize-imports branch from a48c0a0 to 993905a Compare September 8, 2023 17:26
@jpellizzari
Copy link
Copy Markdown
Contributor

jpellizzari commented Sep 8, 2023

@joshri How does this compare to the Organize Imports command in VSCode?

Reference: https://dev.to/shanesc/how-to-sort-and-cleanup-imports-on-save-in-vs-code-52p1

@joshri
Copy link
Copy Markdown
Contributor Author

joshri commented Sep 8, 2023

@joshri How does this compare to the Organize Imports command in VSCode?

Reference: https://dev.to/shanesc/how-to-sort-and-cleanup-imports-on-save-in-vs-code-52p1

The main thing is that this will force everyone to do it since it will be tied to CI

@foot
Copy link
Copy Markdown
Contributor

foot commented Sep 11, 2023

Cool! Is there some cli variant that we could invoke via make/yarn as a fallback for non-vscode users?

@joshri
Copy link
Copy Markdown
Contributor Author

joshri commented Sep 11, 2023

Cool! Is there some cli variant that we could invoke via make/yarn as a fallback for non-vscode users?

By cli variant do you mean npm run lint -- --fix? This setting is always able to be auto-fixed with that --fix flag

@joshri joshri force-pushed the alphabetize-imports branch from 993905a to 2aabe98 Compare September 11, 2023 18:20
@joshri joshri merged commit 24a4617 into main Sep 11, 2023
@joshri joshri deleted the alphabetize-imports branch September 11, 2023 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ui Issues that require front-end work ui_triage Cross-team/project UI issues for triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants