prettier-plugin-import-sort-regex

1.0.0 • Public • Published

prettier-plugin-import-sort-regex

Prettier plugin using import-sort to organize by regular expressions.

Usage

Installation

With npm:

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

With yarn:

yarn add -D prettier-plugin-import-sort-regex

Customization

Add the importSortGroups key to your prettier configuration (eg. in .prettierrc.json, .prettierrc.js, etc.) with a string array of regex patterns. An empty string "" will insert a separator line between entries. The regex pattern will match against the import package name.

Example:

{
  "importSortGroups": [
    "^react$",
    "",
    "^(?:_|clsx|fs|lodash/?.*|path)$",
    "",
    "^@?[\\w\\-]+",
    "",
    "^\\./[\\w\\-]+$",
    "",
    "^\\.\\?./",
    "",
    "\\.json$",
    "",
    "\\.s?css$"
  ]
}

Package Sidebar

Install

npm i prettier-plugin-import-sort-regex

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.61 kB

Total Files

4

Last publish

Collaborators

  • dev.jwn