You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prettier experimental CLI fails when the repository contains a file or directory named propertyIsEnumerable #69
Have a repository where Prettier 3.6 runs correctly.
Create either a file or a directory called propertyIsEnumerable
Run Prettier with the experimental cli:
npx prettier --experimental-cli --check .
Expected behavior:
Prettier runs correctly, no issues.
Actual behavior:
Prettier those an exception:
file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3664
directoriesNamesToPaths.propertyIsEnumerable(name) || (directoriesNamesToPaths[name] = []);
^
TypeError: directoriesNamesToPaths.propertyIsEnumerable is not a function
at handleDirectory (file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3664:33)
at handleDirent (file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3730:11)
at handleDirents (file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3739:11)
at file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3760:13
at Object.then (file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3601:9)
at file:///Users/standard8/dev/test-repo/node_modules/prettier/internal/experimental-cli.mjs:3758:20
at node:fs:178:23
at node:internal/util:569:20
at getDirents (node:internal/fs/utils:278:7)
at FSReqCallback.oncomplete (node:fs:1530:7)
It looks like there might also be an issue with symlinks, though I wasn't able to replicate that.
Does that problem not happen if you don't have a file named "propertyIsEnumerable"? It sounds to me like you may be running the CLI in an environment where plain objects have a null prototype. If that's not the case I've no clue how this may be happening 🤔 it can be fixed, but it'd be useful to be able to repro it.
Activity
fisker commentedon Jun 23, 2025
Transferred from prettier repo.
fabiospampinato commentedon Jun 23, 2025
Does that problem not happen if you don't have a file named "propertyIsEnumerable"? It sounds to me like you may be running the CLI in an environment where plain objects have a null prototype. If that's not the case I've no clue how this may be happening 🤔 it can be fixed, but it'd be useful to be able to repro it.
fisker commentedon Jun 23, 2025
I think it's caused by the next call after
prettier-cli/src/utils.ts
Line 248 in 4b1a66a
been executed, it will override
targetFilesNamesToPaths.propertyIsEnumerableto an array.fisker commentedon Jun 23, 2025
Change to
Object.property.propertyIsEnumerable.call()should fix it.fabiospampinato commentedon Jun 23, 2025
Oh of course 🤦♂️ I'll get it fixed, thanks 👍