@ianvs/prettier-plugin-sort-imports
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -47,3 +47,9 @@ "use strict"; | ||
} | ||
/** e.g. import Default from "someModule" */ | ||
/** | ||
* Default type or value import | ||
* | ||
* e.g. | ||
* import Default from "someModule" | ||
* import type Default from "someModule" | ||
*/ | ||
function nodeIsImportDefaultSpecifier(node) { | ||
@@ -85,2 +91,7 @@ return node.type === 'ImportDefaultSpecifier'; | ||
} | ||
if (nodeToKeep.importKind === 'type' && nodeToKeep.specifiers.some(nodeIsImportDefaultSpecifier) || | ||
nodeToForget.importKind === 'type' && nodeToForget.specifiers.some(nodeIsImportDefaultSpecifier)) { | ||
// Cannot merge default type imports (.e.g. import type React from 'react') | ||
return false; | ||
} | ||
return true; | ||
@@ -87,0 +98,0 @@ } |
{ | ||
"name": "@ianvs/prettier-plugin-sort-imports", | ||
"private": false, | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "A prettier plugins to sort imports in provided RegEx order", | ||
@@ -6,0 +6,0 @@ "main": "lib/src/index.js", |
@@ -231,4 +231,14 @@ # Prettier plugin sort imports <!-- omit in toc --> | ||
A boolean value to enable or disable sorting of the specifiers in an import declarations. | ||
A boolean value to enable or disable sorting of the specifiers in an import declarations. If enabled, type imports will be sorted after value imports. | ||
Before: | ||
```ts | ||
import Default, {type Bravo, delta as echo, charlie, type Alpha} from 'source'; | ||
``` | ||
After: | ||
```ts | ||
import Default, {charlie, delta as echo, type Alpha, type Bravo} from 'source'; | ||
``` | ||
#### `importOrderGroupNamespaceSpecifiers` | ||
@@ -235,0 +245,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75953
1081
383