Skip to content

Issue finding/writing files with brackets ([]). #6854

@zjr

Description

@zjr

Environments:

  • Prettier Version: 1.18.2
  • Running Prettier via: CLI, CLI via Editor Tool (WebStorm File Watcher)
  • Runtime: Node v12.13.0
  • Operating System: macOS

Steps to reproduce:

prettier --write src/pages/posts/[id].jsx

Expected behavior:
It's expected to find, parse, update & write the file, as a prettier does.

Actual behavior:

[error] No matching files. Patterns tried: src/pages/posts/[id].jsx !**/node_modules/** !./node_modules/** !**/.{git,svn,hg}/** !./.{git,svn,hg}/**

There is another issue previously opened about this (#6344), I am opening this one because the other is closed & locked so can't be commented on.

It was said in the above referenced issue that this was probably an issue for lint-staged instead of prettier but I feel a bit differently about that given that this—at least to my imagination—affects tooling of many kinds. I could escape the file path like this: "src/pages/posts/\[id\].jsx" to get prettier to work, but that isn't really possible for any tools that insert an arbitrary file path into the CLI command. In my case I'm using a File Watcher in WebStorm… this is really just using the CLI with whatever the current file path is.

Metadata

Metadata

Assignees

Labels

area:cliIssues with Prettier's Command Line Interfacelocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions