Skip to content

Commit

Permalink
feat: support ESLint v9 & Flat Config (#79)
Browse files Browse the repository at this point in the history
Co-authored-by: anubra266 <[email protected]>
  • Loading branch information
koba04 and anubra266 authored Jun 18, 2024
1 parent 08ea335 commit 15a4f9c
Show file tree
Hide file tree
Showing 40 changed files with 1,113 additions and 438 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"sandbox",
"sandbox-*",
"fixture"
]
}
5 changes: 5 additions & 0 deletions .changeset/tough-steaks-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pandacss/eslint-plugin': patch
---

Fix scope manager
18 changes: 11 additions & 7 deletions plugin/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ export const isPandaIsh = (name: string, context: RuleContext<any, any>) => {
}

const findDeclaration = (name: string, context: RuleContext<any, any>) => {
const scope = analyze(context.sourceCode.ast, {
sourceType: 'module',
})
const decl = scope.variables
.find((v) => v.name === name)
?.defs.find((d) => isIdentifier(d.name) && d.name.name === name)?.node
if (isVariableDeclarator(decl)) return decl
try {
const scope = analyze(context.sourceCode.ast, {
sourceType: 'module',
})
const decl = scope.variables
.find((v) => v.name === name)
?.defs.find((d) => isIdentifier(d.name) && d.name.name === name)?.node
if (isVariableDeclarator(decl)) return decl
} catch (error) {
return
}
}

const isLocalStyledFactory = (node: TSESTree.JSXOpeningElement, context: RuleContext<any, any>) => {
Expand Down
3 changes: 2 additions & 1 deletion plugin/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//@ts-expect-error
import { RuleTester } from 'eslint-docgen'
import { RuleTester as ERuleTester } from 'eslint'
import parser from '@typescript-eslint/parser'

const baseTesterConfig = {
parser: require.resolve('@typescript-eslint/parser'),
parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
Expand Down
Loading

0 comments on commit 15a4f9c

Please sign in to comment.