Skip to content

Prettier experimental CLI fails when the repository contains a file or directory named propertyIsEnumerable #69

@Standard8

Description

@Standard8

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:

  1. Have a repository where Prettier 3.6 runs correctly.
  2. Create either a file or a directory called propertyIsEnumerable
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions