@@ -79,11 +79,7 @@ const _getImports = (context: RuleContext<any, any>) => {
79
79
80
80
const getImports = ( context : RuleContext < any , any > ) => {
81
81
const imports = _getImports ( context )
82
- try {
83
- return imports . filter ( ( imp ) => syncAction ( 'matchImports' , getSyncOpts ( context ) , imp ) )
84
- } catch ( error ) {
85
- return [ ]
86
- }
82
+ return imports . filter ( ( imp ) => syncAction ( 'matchImports' , getSyncOpts ( context ) , imp ) )
87
83
}
88
84
89
85
const isValidStyledProp = < T extends Node | string > ( node : T , context : RuleContext < any , any > ) => {
@@ -156,7 +152,7 @@ export const isPandaProp = (node: TSESTree.JSXAttribute, context: RuleContext<an
156
152
return true
157
153
}
158
154
159
- export const isStyledNode = ( node : TSESTree . Property , context : RuleContext < any , any > , calleeName ?: string ) => {
155
+ export const isStyledProperty = ( node : TSESTree . Property , context : RuleContext < any , any > , calleeName ?: string ) => {
160
156
if ( ! isIdentifier ( node . key ) && ! isLiteral ( node . key ) && ! isTemplateLiteral ( node . key ) ) return
161
157
162
158
if ( isIdentifier ( node . key ) && ! isValidProperty ( node . key . name , context , calleeName ) ) return
@@ -167,20 +163,9 @@ export const isStyledNode = (node: TSESTree.Property, context: RuleContext<any,
167
163
)
168
164
return
169
165
if ( isTemplateLiteral ( node . key ) && ! isValidProperty ( node . key . quasis [ 0 ] . value . raw , context , calleeName ) ) return
170
-
171
166
return true
172
167
}
173
168
174
- export const isStyledProperty = ( node : TSESTree . Property , context : RuleContext < any , any > , calleeName ?: string ) => {
175
- const ancestor = node . parent . parent
176
-
177
- const isValidFuncAncestor =
178
- isCallExpression ( ancestor ) && isIdentifier ( ancestor . callee ) && isPandaIsh ( ancestor . callee . name , context )
179
- if ( isValidFuncAncestor ) return isStyledNode ( node , context , calleeName )
180
-
181
- return isStyledNode ( ancestor as any , context , calleeName ) && isStyledNode ( node , context , calleeName )
182
- }
183
-
184
169
export const isInPandaFunction = ( node : TSESTree . Property , context : RuleContext < any , any > ) => {
185
170
const callAncestor = getAncestor ( isCallExpression , node )
186
171
if ( ! callAncestor ) return
@@ -271,10 +256,6 @@ export const getInvalidTokens = (value: string, context: RuleContext<any, any>)
271
256
return syncAction ( 'filterInvalidTokens' , getSyncOpts ( context ) , tokens )
272
257
}
273
258
274
- export const getExtendWarnings = ( context : RuleContext < any , any > ) => {
275
- return syncAction ( 'getExtendWarnings' , getSyncOpts ( context ) )
276
- }
277
-
278
259
export const getTokenImport = ( context : RuleContext < any , any > ) => {
279
260
const imports = _getImports ( context )
280
261
return imports . find ( ( imp ) => imp . name === 'token' )
0 commit comments