1.0.0 • Published 3 years ago
prettier-plugin-import-sort-regex v1.0.0
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$"
]
}
1.0.0
3 years ago