Skip to content

Commit 25dc146

Browse files
committed
feature: @putout/plugin-esm: sort-imports-by-specifiers: do not switch oterh then # with #
1 parent d8a3a9f commit 25dc146

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

packages/plugin-esm/lib/group-imports-by-source/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {
99
remove,
1010
} = operator;
1111

12-
module.exports.report = () => `Group imports by source: 'builtins', 'external', 'internal'`;
12+
module.exports.report = () => `Group imports by source: 'builtins', 'external', 'hashed', 'internal'`;
1313

1414
module.exports.fix = ({grouped}) => {
1515
const [first, ...others] = grouped;

packages/plugin-esm/lib/group-imports-by-source/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const test = createTest(__dirname, {
1515
});
1616

1717
test('putout: group-imports-by-source: report', (t) => {
18-
t.report('group-imports-by-source', `Group imports by source: 'builtins', 'external', 'internal'`);
18+
t.report('group-imports-by-source', `Group imports by source: 'builtins', 'external', 'hashed', 'internal'`);
1919
t.end();
2020
});
2121

@@ -42,7 +42,7 @@ test('putout: group-imports-by-source: transform: convert-esm-to-commonjs', (t)
4242
});
4343

4444
test('putout: group-imports-by-source: transform: sort-imports-by-specifiers', (t) => {
45-
t.transform('sort-imports-by-specifiers', {
45+
t.noReportAfterTransform('sort-imports-by-specifiers', {
4646
sortImportsBySpecifiers,
4747
});
4848
t.end();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {
2+
parse,
3+
print,
4+
operator,
5+
types,
6+
} from 'putout';
7+
import {traverse} from '#fatlint';

packages/plugin-esm/lib/sort-imports-by-specifiers/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports.traverse = ({push}) => ({
4040
reversed: [
4141
['./', './'],
4242
['../', '../'],
43+
['#', '#'],
4344
],
4445
});
4546

packages/plugin-esm/lib/sort-imports-by-specifiers/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ test('putout: sort-imports-by-specifiers: external-internal', (t) => {
4343
t.noTransform('external-internal');
4444
t.end();
4545
});
46+
47+
test('putout: sort-imports-by-specifiers: external-hashed', (t) => {
48+
t.noReport('external-hashed');
49+
t.end();
50+
});

0 commit comments

Comments
 (0)