Skip to content
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

build: organize imports in ts and spec files with prettier #404

Merged
merged 4 commits into from
Feb 7, 2022

Conversation

peterpeterparker
Copy link
Member

Motivation

To ease the review of PR and to improve our DX, automatically organize and sort the import

Changes

Note

  • the plugin does not organize imports in .svelte yet but will do so in all other files (all .ts and .spec.ts files)

Copy link
Contributor

@nmattia nmattia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for splitting the commits!

@@ -30,6 +30,7 @@
"postcss": "^8.4.5",
"postcss-load-config": "^3.1.1",
"prettier": "^2.5.0",
"prettier-plugin-organize-imports": "^2.3.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity: just adding the dep enables the plugin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, magic 🧙🏼‍♂️

from its README:

A plugin that makes Prettier organize your imports (i. e. sorts, combines and removes unused ones) using the organizeImports feature of the TypeScript language service API. This is the same as using the "Organize Imports" action in VS Code.

@peterpeterparker peterpeterparker merged commit ddd1999 into main Feb 7, 2022
@peterpeterparker peterpeterparker deleted the svelte-prettier-plugin-organize-imports branch February 7, 2022 11:27
peterpeterparker added a commit to dfinity/ic-js that referenced this pull request Feb 9, 2022
# Motivation

To ease the review of PR and to improve our DX, automatically organize and sort the `import`.

# Changes

- add [prettier-plugin-organize-imports](https://github.com/simonhaenisch/prettier-plugin-organize-imports)

# Note

We use the plugin in [nns-dapp](dfinity/nns-dapp#404) too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants