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
Prettier breaks when run through lint-staged on files with dollar sign ($) in the name #1397
Comments
This issue is probably related to an old-running problem of lint-staged not escaping the filenames correctly. Looking at your logs it seems something eats the |
Testing for myself, at least ESLint has no problems with a file like Is this an issue with pnpm? |
Based on your logs, does thss command work normally for you without lint-staged in the mix, but just running it directly: pnpm fix:style /home/flc/my/smc/nexus2/third-nexus-client/app/routes/_auth.old.$route.tsx Also to nitpick your configuration, it says your command is this:
Since it includes the
|
having the same issue but with
|
Description
Yesterday I filed this issue to Prettier: File names with dollar sign ($) in the name cannot be processed by Prettier, but then I found out that the issue was only happening when running Prettier through
lint-staged
, if I run the npm script or the command defined in the npm script, it runs ok and doesn't complain about files with dollar sign.So this seems to be an
lint-staged
issue, probably regarding the way lint-staged makes up the list of files to be fed to Prettier, but not sure, as I don't see any changes on file name on the debug log. It's correct up to the final lint-staged output, then runs Prettier and fails. But, again, if I run the same command directly instead of through lint-staged, Prettier doesn't explode.So the issue is in the interaction of both tools.
Debug Logs
Context: there's only one change, a file renamed, no editions on the file.
Pre-commit hook:
lint-staged configured through package.json, running an npm script called
fix:styles
that executes:prettier --experimental-ternaries --write .
The command executed is
git commit
, which in turn launcheslint-staged
as per configurationEnvironment
lint-staged
: 15.2.2prettier
: 3.2.5The text was updated successfully, but these errors were encountered: