Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Apr 23, 2023
1 parent f4b9e29 commit 90aeb70
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ or, using yarn
yarn add --dev @ianvs/prettier-plugin-sort-imports
```

**Note: If you are migrating from v2.x.x to v3.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**
**Note: If you are migrating from v3.x.x to v4.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**

## Usage

Expand All @@ -128,7 +128,7 @@ module.exports = {
trailingComma: 'all',
singleQuote: true,
semi: true,
importOrder: ['^@core/(.*)$', '^@server/(.*)$', '^@ui/(.*)$', '^[./]'],
importOrder: ['^@core/(.*)$', '', '^@server/(.*)$', '', '^@ui/(.*)$', '', '^[./]'],
importOrderCaseInsensitive: true,
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
importOrderMergeDuplicateImports: true,
Expand Down
28 changes: 28 additions & 0 deletions docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@
- The `importOrderBuiltinModulesToTop` option has been removed, and node.js built in modules are always sorted to the top.
- The `importOrderSeparation` option has been removed. Use empty quotes in your `importOrder` to control the placement of blank lines.

#### `importOrderSeparation` removed

This option was removed to simplify the configuration of the plugin. But if you like to separate your import groups with newlines, you can do so by adding `""` groups to your `importOrder` array.

For example:

```js
"importOrder": [
"", // This emptry group at the start will separate side-effects
"<THIRD_PARTY_MODULES>",
"",
"^@app/(.*)$",
"",
"^[./]"
]
```

Or, if you would like to keep all imports together, but add a newline before side-effect imports:

```js
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^@app/(.*)$",
"^[./]"
"", // This will add a newline between side-effect groups (i.e. the chunks that are sorted)
]
```

### Migrating from v2.x.x to v3.x.x

#### TL;DR
Expand Down

0 comments on commit 90aeb70

Please sign in to comment.