fix: check for supportedExtensions after filtering ignored files #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If there are any staged files in directory containing a
package.json
(it doesn't need to be changed/staged), even if the directory is meant to be ignored, the functionisSupportedExtension()
is run. This can fail if thepackage.json
file has invalid JSON for example (resolveConfig
from prettier actually fails). Moving the filters around so that the ignored files are properly accounted for gets rid of the error.I'm not sure if the unstaged files need to be filtered the same way: https://github.com/azz/pretty-quick/blob/f11faa91d5c570407c37ed77ac04ec0f5e0ef64e/src/index.js#L52-L59
Example repository to test this: https://github.com/ullasholla/pretty-quick-ignore-test
The
templates
directory contain ejs templates and the.json
files are not yet valid JSON files.To test, make a change to
templates/core/config.json
and stage it.Tests are passing locally:
Could you please review and consider merging this?
Thanks!