Skip to content

Commit

Permalink
docs: sort-imports add single named import example (#15675)
Browse files Browse the repository at this point in the history
Added examples of a single named import. Clarifying that it should be grouped with the default/single imports and not with the named/multiple imports.

I find the current behavior confusing and so do others #14259 #14570 #14735 #13655 #13222 #11159 #10878.
  • Loading branch information
arye-eidelman authored Mar 4, 2022
1 parent c178ce7 commit 8f675b1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/rules/sort-imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The import statement is used to import members (functions, objects or primitives
```js
// single - Import single member.
import myMember from "my-module.js";
import {myOtherMember} from "my-other-module.js";

// multiple - Import multiple members.
import {foo, bar} from "my-module.js";
Expand Down Expand Up @@ -72,7 +73,7 @@ import * as foo from 'foo.js';
import {alpha, beta} from 'alpha.js';
import {delta, gamma} from 'delta.js';
import a from 'baz.js';
import b from 'qux.js';
import {b} from 'qux.js';

/*eslint sort-imports: "error"*/
import a from 'foo.js';
Expand All @@ -84,6 +85,7 @@ import 'foo.js'
import * as bar from 'bar.js';
import {a, b} from 'baz.js';
import c from 'qux.js';
import {d} from 'quux.js';

/*eslint sort-imports: "error"*/
import {a, b, c} from 'foo.js'
Expand All @@ -108,6 +110,10 @@ import {a, b} from 'bar.js';
import a from 'foo.js';
import {b, c} from 'bar.js';

/*eslint sort-imports: "error"*/
import {a} from 'foo.js';
import {b, c} from 'bar.js';

/*eslint sort-imports: "error"*/
import a from 'foo.js';
import * as b from 'bar.js';
Expand Down

0 comments on commit 8f675b1

Please sign in to comment.