Skip to content

Commit

Permalink
eslint-plugin-simple-import-sort v10.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Jan 27, 2023
1 parent 3ef8f5a commit 7d4947a
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
### Version 10.0.0 (2023-01-27)

This release might move some imported items with `type` around. This is a breaking formatting change (that only affects TypeScript and Flow), but only in the form of that you need to autofix your files.

In previous versions, `type` specifiers came first:

```ts
import { type B, a } from "a";
export { type B, a } from "a";
```

Now, all specifiers are sorted alphabetically, regardless of `type`:

```ts
import { a, type B } from "a";
export { a, type B } from "a";
```

Motivation:

You might import a class for a type annotation using:

<!-- prettier-ignore -->
```ts
import {
type MyClass,
coolFunction,
} from "example";
```

Later, you also start instantiating that class in the same file (`new MyClass()`), so you remove `type`.

Previously, this resulted in a messy diff due to the class moving:

```diff
import {
- type MyClass,
coolFunction,
+ MyClass,
} from "example";
```

Now, the sorting with the `type` keyword would be:

<!-- prettier-ignore -->
```ts
import {
coolFunction,
type MyClass,
} from "example";
```

Now there’s no reordering diff, just the `type` keyword being removed:

```diff
import {
coolFunction,
- type MyClass,
+ MyClass,
} from "example";
```

This is consistent with [“Why sort on `from`?”][sort-from].

Thanks to Jake Bailey (@jakebailey) for reporting and suggesting the fix!

### Version 9.0.0 (2023-01-16)

This version adds support for [eslint-plugin-svelte], and for `declare module` in TypeScript.
Expand Down
2 changes: 1 addition & 1 deletion package-real.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-simple-import-sort",
"version": "9.0.0",
"version": "10.0.0",
"license": "MIT",
"author": "Simon Lydell",
"repository": "lydell/eslint-plugin-simple-import-sort",
Expand Down

0 comments on commit 7d4947a

Please sign in to comment.