Skip to content

Commit 581eee9

Browse files
committed
feature: @putout/plugin-putout: add-index-to-import: cjs
1 parent 05212ee commit 581eee9

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import addAction from './add-action.cjs';
2+
3+
export const rules = {};

packages/plugin-putout/lib/add-index-to-import/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export const traverse = ({push, listStore}) => ({
3535
const createImportVisitor = (push) => (path) => {
3636
const {value} = path.node.source;
3737

38+
if (value.endsWith('.cjs'))
39+
return;
40+
3841
if (value.endsWith('index.js'))
3942
return;
4043

packages/plugin-putout/lib/add-index-to-import/index.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ test('packages: add-index-to-import: transform: add-index-to-import', (t) => {
1616
t.transform('add-index-to-import');
1717
t.end();
1818
});
19+
20+
test('packages: add-index-to-import: no report: cjs', (t) => {
21+
t.noReport('cjs');
22+
t.end();
23+
});

0 commit comments

Comments
 (0)