|
1 | | -import * as t from 'babel-types' |
2 | | - |
3 | 1 | const VALID_TOP_LEVEL_IMPORT_PATHS = [ |
4 | 2 | 'styled-components', |
5 | 3 | 'styled-components/no-tags', |
@@ -43,14 +41,14 @@ const importLocalName = (name, state) => { |
43 | 41 | return localName |
44 | 42 | } |
45 | 43 |
|
46 | | -export const isStyled = (tag, state) => { |
| 44 | +export const isStyled = t => (tag, state) => { |
47 | 45 | if ( |
48 | 46 | t.isCallExpression(tag) && |
49 | 47 | t.isMemberExpression(tag.callee) && |
50 | 48 | tag.callee.property.name !== 'default' /** ignore default for #93 below */ |
51 | 49 | ) { |
52 | 50 | // styled.something() |
53 | | - return isStyled(tag.callee.object, state) |
| 51 | + return isStyled(t)(tag.callee.object, state) |
54 | 52 | } else { |
55 | 53 | return ( |
56 | 54 | (t.isMemberExpression(tag) && |
@@ -78,18 +76,18 @@ export const isStyled = (tag, state) => { |
78 | 76 | } |
79 | 77 | } |
80 | 78 |
|
81 | | -export const isCSSHelper = (tag, state) => |
| 79 | +export const isCSSHelper = t => (tag, state) => |
82 | 80 | t.isIdentifier(tag) && tag.name === importLocalName('css', state) |
83 | 81 |
|
84 | | -export const isCreateGlobalStyleHelper = (tag, state) => |
| 82 | +export const isCreateGlobalStyleHelper = t => (tag, state) => |
85 | 83 | t.isIdentifier(tag) && |
86 | 84 | tag.name === importLocalName('createGlobalStyle', state) |
87 | 85 |
|
88 | | -export const isInjectGlobalHelper = (tag, state) => |
| 86 | +export const isInjectGlobalHelper = t => (tag, state) => |
89 | 87 | t.isIdentifier(tag) && tag.name === importLocalName('injectGlobal', state) |
90 | 88 |
|
91 | | -export const isKeyframesHelper = (tag, state) => |
| 89 | +export const isKeyframesHelper = t => (tag, state) => |
92 | 90 | t.isIdentifier(tag) && tag.name === importLocalName('keyframes', state) |
93 | 91 |
|
94 | | -export const isHelper = (tag, state) => |
95 | | - isCSSHelper(tag, state) || isKeyframesHelper(tag, state) |
| 92 | +export const isHelper = t => (tag, state) => |
| 93 | + isCSSHelper(t)(tag, state) || isKeyframesHelper(t)(tag, state) |
0 commit comments