fix prettier triggering from dependencies

This commit is contained in:
Dax Raad 2025-07-31 00:57:22 -04:00
parent a6572725bc
commit 20a92ea019

View file

@ -65,9 +65,11 @@ export const prettier: Info = {
],
async enabled() {
const app = App.info()
const nms = await Filesystem.findUp("node_modules", app.path.cwd, app.path.root)
for (const item of nms) {
if (await Bun.file(path.join(item, ".bin", "prettier")).exists()) return true
const items = await Filesystem.findUp("package.json", app.path.cwd, app.path.root)
for (const item of items) {
const json = await Bun.file(item).json()
if (json.dependencies?.prettier) return true
if (json.devDependencies?.prettier) return true
}
return false
},