I use 'lint-staged' which checks lint errors before commit. If I want to commit a css which is ignored by '.stylelintignore', the error 'Error: No files matching the pattern ...' occurs and I can't commit it. Is there a way to turn off the error?
What stylelint configuration is needed to reproduce the bug?
.stylelintignore
test.css
$ git status
Changes to be committed:
new file: test.css
Which version of stylelint are you using?
11.1.1
How are you running stylelint: CLI, PostCSS plugin, Node.js API?
npx stylelint test.css
Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?
No
What did you expect to happen?
No errors.
What actually happened (e.g. what warnings or errors did you get)?
Error: No files matching the pattern "test.css" were found.
at /Users/k/Projects/alina/node_modules/stylelint/lib/standalone.js:196:12
at processTicksAndRejections (internal/process/task_queues.js:93:5)
@nonelove Stylelint works the same way as eslint works in such case. As workaround you can use git commit --no-verify for ignored files
you can try to use --allow-empty-input flag https://github.com/stylelint/stylelint/blob/master/docs/user-guide/cli.md#--allow-empty-input---aei
Closed, as it's not related to stylelint.
--allow-empty-input flag works well! Thanks!
Most helpful comment
@nonelove
Stylelint works the same way as eslint works in such case. As workaround you can usegit commit --no-verifyfor ignored filesyou can try to use
--allow-empty-inputflag https://github.com/stylelint/stylelint/blob/master/docs/user-guide/cli.md#--allow-empty-input---aei