Remark fails when used in combination with lint-staged package for multiple .md files with error:
Error: Cannot write multiple files to single output: [path-to-local-repo]\1.md
at done ([path-to-node-modules]\unified-engine\lib\file-pipeline\copy.js:63:9)
at onstatfile ([path-to-node-modules]\unified-engine\lib\file-pipeline\copy.js:46:7)
at FSReqCallback.oncomplete (fs.js:159:5)
When running outside the coomit hook (npm run md:fix), remark works as expected.
npm i to install packagesgit add .git commit -m testminimal reproduction: https://github.com/jpohancenik/remark-lint-issue
Remark should write fixes to output files without throwing error.
Remark fails with error message Cannot write multiple files to single output
You can fix this if you add -- to the end of your script, like so: remark . -o --.
This feature, which many other commands also support, says to not parse further values (which lint-staged passes) as arguments, but instead as files!
Thank you, works like a charm!
Most helpful comment
You can fix this if you add
--to the end of your script, like so:remark . -o --.This feature, which many other commands also support, says to not parse further values (which lint-staged passes) as arguments, but instead as files!