From 0faac2717c1332dcebf35a680a5d7474c05595b5 Mon Sep 17 00:00:00 2001 From: anubra266 Date: Sat, 10 Feb 2024 17:45:12 -0600 Subject: [PATCH] fix: Invalid nesting parsing unrelated objects --- plugin/src/rules/no-invalid-nesting.ts | 5 +++-- plugin/src/utils/worker.ts | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/src/rules/no-invalid-nesting.ts b/plugin/src/rules/no-invalid-nesting.ts index 9a342b6..ffc522e 100644 --- a/plugin/src/rules/no-invalid-nesting.ts +++ b/plugin/src/rules/no-invalid-nesting.ts @@ -1,6 +1,6 @@ import { isIdentifier, isLiteral, isObjectExpression, isTemplateLiteral } from '../utils/nodes' import { type Rule, createRule } from '../utils' -import { isPandaAttribute } from '../utils/helpers' +import { isInJSXProp, isInPandaFunction, isStyledProperty } from '../utils/helpers' export const RULE_NAME = 'no-invalid-nesting' @@ -21,7 +21,8 @@ const rule: Rule = createRule({ return { Property(node) { if (!isObjectExpression(node.value) || isIdentifier(node.key)) return - if (isPandaAttribute(node, context)) return + if (!isInPandaFunction(node, context) && !isInJSXProp(node, context)) return + if (isStyledProperty(node, context)) return const invalidLiteral = isLiteral(node.key) && typeof node.key.value === 'string' && !node.key.value.includes('&') diff --git a/plugin/src/utils/worker.ts b/plugin/src/utils/worker.ts index 02366a4..06d4fd1 100644 --- a/plugin/src/utils/worker.ts +++ b/plugin/src/utils/worker.ts @@ -4,7 +4,6 @@ import { createContext } from 'fixture' import { resolveTsPathPattern } from '@pandacss/config/ts-path' import { findConfig, bundleConfig } from '@pandacss/config' import path from 'path' -import fs from 'fs' import type { ImportResult } from '.' let promise: Promise | undefined