New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for double brackets in path and lint-staged #7081
Comments
The issue you're facing is related to the use of double brackets in file paths when using lint-staged, husky, and stylelint. This error occurs because the file path with double brackets is not being recognized by the underlying file system. To resolve this issue, you can modify your configuration to escape the double brackets in the file path. Here's the modified configuration for
By escaping the double brackets with backslashes (
With this modification, lint-staged should be able to find and process files with double brackets in their paths without throwing the "No files matching the pattern" error. |
@olivervorasai Thanks for the report, for using the template and for the minimal reproducible repo. It sounds like this is an issue with lint-staged rather than Stylelint. Stylelint can lint the file from the CLI:
|
lint-staged/lint-staged#676 is maybe related. |
And here's the pull request for how Prettier resolved the issue at their end. Shall we do the same? |
This is no longer an issue with these updated dependencies:
|
What minimal example or steps are needed to reproduce the bug?
When using lint-staged + husky + stylelint, files that have double brackets in their path throw the following error:
What minimal configuration is needed to reproduce the bug?
https://github.com/olivervorasai/stylelint-bug
Steps:
npm i
test.css
fileHow did you run Stylelint?
pre-commit via husky and lint-staged
Which Stylelint-related dependencies are you using?
What did you expect to happen?
Stylelint to run without problems.
What actually happened?
Stylelint (or lint-staged) was unable to parse the file path.
Notes
Everything works fine for file paths that have single brackets.
For example:
some/long/path/[id]/test.css
According this comment #4855 (comment) there are several workarounds relating to globs. However, I may be misunderstanding the comment but I am not using a glob in my example.
Context
I use single and double brackets for automatic page routing in web frameworks like Nuxt.
The text was updated successfully, but these errors were encountered: