npm.io
1.0.0 • Published 5 years ago

prettier-plugin-import-sort-regex

Licence
MIT
Version
1.0.0
Deps
3
Size
6 kB
Vulns
0
Weekly
0
Stars
1

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

Keywords