1.0.9 • Published 8 months ago

@adaskothebeast/prettier-import-sort v1.0.9

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

@adaskothebeast/prettier-import-sort

Prettier plugin for sort imports using import-sort for javascript and TypeScript files based on prettier-plugin-import-sort great work of @ggascoigne and @renke - adjustment for Prettier v3;

Installation

  1. Install Prettier and this plugin with:

    npm i -D prettier @adaskothebeast/prettier-import-sort import-sort-config

    or

    yarn add -D prettier @adaskothebeast/prettier-import-sort import-sort-config
  2. You will also want to install an import sort style module of your choice, such as:

    npm i -D import-sort-style-module

    or

    yarn add -D import-sort-style-module
  3. You will then need the configuration for import-sorts available for example in importsortrc.js

    module.exports = {
      '.js, .jsx, .ts, .tsx': {
        style: 'module',
        parser: 'babel',
      },
    };
  4. 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.

    module.exports = {
      '.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.

  5. adjust your .prettierrc file to include the plugin:

    {
      "plugins": ["@adaskothebeast/prettier-import-sort"]
    }

Credits:

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

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago