Skip to content

Commit 15a4f9c

Browse files
koba04anubra266
andauthored
feat: support ESLint v9 & Flat Config (#79)
Co-authored-by: anubra266 <anubra266@gmail.com>
1 parent 08ea335 commit 15a4f9c

40 files changed

+1113
-438
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": [
11-
"sandbox",
11+
"sandbox-*",
1212
"fixture"
1313
]
1414
}

.changeset/tough-steaks-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@pandacss/eslint-plugin': patch
3+
---
4+
5+
Fix scope manager

plugin/src/utils/helpers.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ export const isPandaIsh = (name: string, context: RuleContext<any, any>) => {
9494
}
9595

9696
const findDeclaration = (name: string, context: RuleContext<any, any>) => {
97-
const scope = analyze(context.sourceCode.ast, {
98-
sourceType: 'module',
99-
})
100-
const decl = scope.variables
101-
.find((v) => v.name === name)
102-
?.defs.find((d) => isIdentifier(d.name) && d.name.name === name)?.node
103-
if (isVariableDeclarator(decl)) return decl
97+
try {
98+
const scope = analyze(context.sourceCode.ast, {
99+
sourceType: 'module',
100+
})
101+
const decl = scope.variables
102+
.find((v) => v.name === name)
103+
?.defs.find((d) => isIdentifier(d.name) && d.name.name === name)?.node
104+
if (isVariableDeclarator(decl)) return decl
105+
} catch (error) {
106+
return
107+
}
104108
}
105109

106110
const isLocalStyledFactory = (node: TSESTree.JSXOpeningElement, context: RuleContext<any, any>) => {

plugin/test-utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//@ts-expect-error
22
import { RuleTester } from 'eslint-docgen'
33
import { RuleTester as ERuleTester } from 'eslint'
4+
import parser from '@typescript-eslint/parser'
45

56
const baseTesterConfig = {
6-
parser: require.resolve('@typescript-eslint/parser'),
7+
parser,
78
parserOptions: {
89
ecmaVersion: 'latest',
910
sourceType: 'module',

0 commit comments

Comments
 (0)