Skip to content

Commit 6c78d14

Browse files
committed
feature: @putout/plugin-putout: apply-lowercase-to-node-builders: exclude not types
1 parent 1ab8503 commit 6c78d14

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const CallExpression = maybeParens((path, {indent, print, maybe, traverse}) => {});
2+
const OptionalCallExpression = {};
3+
4+
module.exports.OptionalCallExpression = CallExpression;
5+
module.exports.CallExpression = CallExpression;
6+
7+
const {
8+
ExportNamespaceSpecifier,
9+
ExportSpecifier,
10+
} = exportDeclarations;
11+
12+
ExportSpecifier();

packages/plugin-putout/lib/apply-lowercase-to-node-builders/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import {types, operator} from 'putout';
22

3-
const {
4-
rename,
5-
compare,
6-
getBindingPath,
7-
} = operator;
3+
const {rename, getBindingPath} = operator;
84

9-
const {isVariableDeclarator} = types;
5+
const {
6+
isVariableDeclarator,
7+
isIdentifier,
8+
} = types;
109

1110
const getNewName = (name) => {
1211
if (name.startsWith('TS')) {
@@ -46,7 +45,7 @@ export const traverse = ({push}) => ({
4645
if (!isVariableDeclarator(bindingPath))
4746
return;
4847

49-
if (compare(bindingPath.node.init, 'require(__a)'))
48+
if (!isIdentifier(bindingPath.node.init, {name: 'types'}))
5049
return;
5150

5251
if (!/[A-Z]/.test(first))

packages/plugin-putout/lib/apply-lowercase-to-node-builders/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@ test('putout: apply-lowercase-to-node-builders: no report: require', (t) => {
5151
t.noReport('require');
5252
t.end();
5353
});
54+
55+
test('putout: apply-lowercase-to-node-builders: no report: not-types', (t) => {
56+
t.noReport('not-types');
57+
t.end();
58+
});

0 commit comments

Comments
 (0)