npm

@briankosw/prettier-plugin-sort-imports

0.0.5 • Public • Published

@briankosw/prettier-plugin-sort-imports

A Prettier plugin that sorts your import declarations.

Setup

Install the plugin:

# Yarn
yarn add -D @briankosw/prettier-plugin-sort-imports

# npm
npm install -D @briankosw/prettier-plugin-sort-imports

Configure the plugin:

{
  "addEmptyLinesBetweenImportGroups": boolean  # default: false
  "importGroups": ["builtin", "src", "*"]      # default: ["builtin", "*"]
}

If, for whatever reason, you want the plugin to not run for a file, then add the following pragma to the file:

// @briankosw/prettier-plugin-sort-imports:disable

Currently, the plugin only supports TypeScript.

Disclaimer

This plugin modifies the AST of the passed in code, which goes against Prettier's principle of not mutating the AST.

Readme

Keywords

none

Package Sidebar

Install

npm i @briankosw/prettier-plugin-sort-imports

Weekly Downloads

4,719

Version

0.0.5

License

MIT

Unpacked Size

28.2 MB

Total Files

429

Last publish

Collaborators

  • briankosw