@peergrade/prettier-plugin-import-sort

0.0.6-next.2 • Public • Published

prettier-plugin-import-sort

This is Prettier plugin to sort imports using import-sort for javascript and typescript files.

Installation

$ npm i -D prettier prettier-plugin-import-sort

You will also want to install an import sort style module of your choice, such as:

$ npm i -D import-sort-style-module

You will then need the configuration for import-sorts available, e.g. something like this in package.json

"importSort": {
    ".js, .jsx, .ts, .tsx": {
      "style": "module"
    }
  }

If you are using typescript, you may also need to specify the typescript parser. This is somewhat dependant upon the typescript features used (decorators for instance), e.g.

"importSort": {
    ".js, .jsx, .ts, .tsx": {
      "style": "module",
      "parser": "typescript"
    }
  }

Credits:

A large part of this code was copied from import-sort-cli.

Package Sidebar

Install

npm i @peergrade/prettier-plugin-import-sort

Weekly Downloads

1

Version

0.0.6-next.2

License

MIT

Unpacked Size

165 kB

Total Files

16

Last publish

Collaborators

  • florian_eduflow
  • malthejorgensen
  • git-pull
  • notifly
  • tony
  • marconunnari