Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit 848a7a6

Browse files
committed
Skip type specifiers. [closes #153]
1 parent 4da1ac1 commit 848a7a6

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"babel-core": "^6.18.2",
2323
"babel-plugin-add-module-exports": "~0.2.1",
2424
"babel-plugin-lodash": "3.2.10",
25+
"babel-plugin-syntax-flow": "^6.18.0",
2526
"babel-plugin-syntax-jsx": "^6.18.0",
2627
"babel-plugin-transform-object-rest-spread": "^6.19.0",
2728
"babel-plugin-transform-runtime": "^6.15.0",

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ export default function lodash({ types }) {
7474
_.each(specs, spec => {
7575
const { imported, local } = spec;
7676
const binding = file.scope.getBinding(local);
77+
const { importKind = 'value' } = binding.path.parent;
78+
79+
// Skip type specifiers.
80+
if (importKind != 'value') {
81+
return;
82+
}
7783
const isChain = isLodash && imported == 'chain';
7884

7985
_.each(binding.referencePaths, refPath => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"plugins": [
3+
"syntax-flow"
4+
],
5+
"presets": [
6+
"es2015"
7+
]
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { Predicate } from 'lodash';
2+
3+
function a(b: Predicate<*>) {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
function a(b: Predicate<*>) {}

0 commit comments

Comments
 (0)