From 8f675b1f7f6c0591abe36c20410d226bd9e1faa6 Mon Sep 17 00:00:00 2001 From: Arye Eidelman Date: Fri, 4 Mar 2022 05:20:02 -0500 Subject: [PATCH] docs: sort-imports add single named import example (#15675) 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. --- docs/rules/sort-imports.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/rules/sort-imports.md b/docs/rules/sort-imports.md index 087a008bb6f..5ba4509a228 100644 --- a/docs/rules/sort-imports.md +++ b/docs/rules/sort-imports.md @@ -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"; @@ -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'; @@ -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' @@ -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';