Skip to content

Commit

Permalink
fix: normalize paths
Browse files Browse the repository at this point in the history
  • Loading branch information
anubra266 committed Feb 10, 2024
1 parent 802bb4c commit 782889b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-mayflies-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pandacss/eslint-plugin": patch
---

Normalize paths
9 changes: 4 additions & 5 deletions plugin/src/utils/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,21 @@ async function isColorAttribute(ctx: PandaContext, _attr: string): Promise<boole
}

const arePathsEqual = (path1: string, path2: string) => {
const stats1 = fs.statSync(path1)
const stats2 = fs.statSync(path2)
const normalizedPath1 = path.resolve(path1)
const normalizedPath2 = path.resolve(path2)

return stats1.dev === stats2.dev && stats1.ino === stats2.ino
return normalizedPath1 === normalizedPath2
}

async function isConfigFile(fileName: string): Promise<boolean> {
return arePathsEqual(configPath!, fileName)
}

async function isValidFile(ctx: PandaContext, fileName: string): Promise<boolean> {
return ctx.getFiles().includes(fileName)
return ctx.getFiles().some((file) => arePathsEqual(file, fileName))
}

async function resolveShorthands(ctx: PandaContext, name: string): Promise<string[] | undefined> {
console.log('name', name, ctx.utility.getPropShorthandsMap().get(name))
return ctx.utility.getPropShorthandsMap().get(name)
}

Expand Down

0 comments on commit 782889b

Please sign in to comment.