prettier / prettier/prettier-cli
Prettier experimental CLI fails when the repository contains a file or directory named `propertyIsEnumerable`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 43
- Forks
- 10
- Avg merge
- 18m
- Merged PRs (30d)
- 1
Description
Environments:
- Prettier Version: 3.6.0
- Running Prettier via: CLI
- Runtime: Node v24.1.0
- Operating System: macOS
- Prettier plugins (if any): None
Steps to reproduce:
- 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with npx prettier --experimental-cli --check . in a repository containing a file or directory named propertyIsEnumerable. Start by tracing the reported handleDirectory path in internal/experimental-cli.mjs; done means the experimental CLI completes without throwing while handling that name, with a regression test covering the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100