Skip to content

Commit

Permalink
docs: sort-imports add single named import example (eslint#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 eslint#14259 eslint#14570 eslint#14735 eslint#13655 eslint#13222 eslint#11159 eslint#10878.
  • Loading branch information
arye-eidelman authored and srijan-deepsource committed May 30, 2022
1 parent ac4bb45 commit 46f2a67
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/rules/sort-imports.md
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 46f2a67

Please sign in to comment.