Make Prettier organize your imports using the TypeScript language service API.
MIT License
Bot releases are visible (Hide)
Full Changelog: https://github.com/simonhaenisch/prettier-plugin-organize-imports/compare/v3.2.3...v3.2.4
Published by simonhaenisch 11 months ago
Just readme updates to explain compatibility with Prettier 3. Also bumped TypeScript to v5 as a dev dependency to ensure compatibility.
Published by simonhaenisch almost 2 years ago
Fixes a performance regression introduced in 3.2.0
(see #90).
This version fixes the implementation of the language service host's getCurrentDirectory
method to return the directory containing the tsconfig, rather than using ts.sys.getCurrentDirectory
(which returns process.cwd()
). This should prevent issues with resolving compiler plugins with Volar (which is used for Vue support).
Hopefully it doesn't break anything else 🤞 I don't think the tsconfig location is always the project root because of nested/extended tsconfigs, but it should be good enough for module resolution. If someone knows a better way of finding a project's root via the TypeScript API please let me know 🙏
This version adds and fixes support for pug templates in Vue files (via @volar/vue-language-plugin-pug
). Please be aware that you'll need to update your version of the @volar/vue-typescript
peer dependency from 0.x
to 1.x
.
Published by simonhaenisch about 2 years ago
If you don't want destructive code actions (like removing unused imports), you can enable the option organizeImportsSkipDestructiveCodeActions
via your Prettier config.
// prettierrc.js
module.exports = {
// ...
organizeImportsSkipDestructiveCodeActions: true,
};
Published by simonhaenisch about 2 years ago
Fixes a performance regression that was introduced in 3.0.2
.
Published by simonhaenisch about 2 years ago
This version fixes a regression introduced by adding some file-system related methods (fileExists
and readFile
) to the language service host (to fix #63), which revealed that the implementation of getScriptSnapshot
was incorrect.
Published by simonhaenisch about 2 years ago
@volar/vue-typescript
is now an optional peer dependency and requires version 0.39.0
or later. This should fix a couple of issues, e.g. not removing imports anymore when a component was used in the template via kebab-case.fileExists
and readFile
which should fix some issues with NodeNext
module resolution.Published by simonhaenisch over 2 years ago
Switched to a different package for Vue support, so if you're using this plugin with Vue, you'll have to install @volar/vue-typescript
as a dev dependency now, and you can remove @vue/compiler-sfc
/@vue/component-compiler-utils
/vue-template-compiler
.
Otherwise, no breaking changes.
Published by simonhaenisch about 3 years ago
Fixed a bug where empty comment lines were inserted into Vue 2 files.
Published by simonhaenisch over 3 years ago
Published by simonhaenisch over 3 years ago
The version published to npm was missing files which has been fixed now.
Published by simonhaenisch over 3 years ago
Thanks @blidblid for helping debug this performance issue.
Published by simonhaenisch over 3 years ago
Adds support for Vue.js (.vue
) files (see #16 and 474bbcb1202535ba374f340a481c1e3f3b8033a6).
Published by simonhaenisch over 3 years ago
Now supports JavaScript via the babel
parser and also supports TypeScript via the babel-ts
parser 🎉
Special thanks to @duniul for the contribution (see #18)!
Both parsers are only available since Prettier v2, therefore the peer dependency has had a major version bump, which led me to release this as a major version as well. There are no breaking changes otherwise, so unless you're still on Prettier v1, you can just upgrade.
(The parser was called babylon
in Prettier v1 but had a different signature so it would not have been easy to do a backwards-compatible implementation)
Published by simonhaenisch over 4 years ago
Added the files
list to package.json
to reduce the size on npm.