Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-import-sort

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-import-sort

Prettier plugin to pass javascript and typescript through import-sort

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
59K
decreased by-0.58%
Maintainers
1
Weekly downloads
 
Created
Source

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"
    }
  }

Note: importSort silently falls back to its default configuration if it finds a setup error. Make sure that the extension list is like the example above and not something like "*.js" which is an error.

Credits:

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

Keywords

FAQs

Package last updated on 25 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc