Skip to content

Commit

Permalink
fix: array syntax in no-dynamic-styling (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
anubra266 authored Oct 6, 2024
2 parents 3b1027e + d33a582 commit 7656163
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-geckos-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pandacss/eslint-plugin': patch
---

Fix array syntax in `no-dynamic-styling`
11 changes: 4 additions & 7 deletions plugin/src/rules/no-dynamic-styling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ const rule: Rule = createRule({

// Don't warn for objects. Those are conditions
if (isObjectExpression(node.value.expression)) return
if (isArrayExpression(node.value.expression)) {
return checkElements(node.value.expression, context)
}

if (!isPandaProp(node, context)) return

if (isArrayExpression(node.value.expression)) {
return checkElements(node.value.expression, context)
return checkArrayElements(node.value.expression, context)
}

context.report({
Expand Down Expand Up @@ -83,7 +80,7 @@ const rule: Rule = createRule({
if (!isPandaAttribute(node, context)) return

if (isArrayExpression(node.value)) {
return checkElements(node.value, context)
return checkArrayElements(node.value, context)
}

context.report({
Expand All @@ -95,7 +92,7 @@ const rule: Rule = createRule({
},
})

function checkElements(array: TSESTree.ArrayExpression, context: Parameters<(typeof rule)['create']>[0]) {
function checkArrayElements(array: TSESTree.ArrayExpression, context: Parameters<(typeof rule)['create']>[0]) {
array.elements.forEach((node) => {
if (!node) return
if (isLiteral(node)) return
Expand Down

0 comments on commit 7656163

Please sign in to comment.