Skip to content
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

Nested whitelisting is broken while used in .prettierignore #67

Closed
tryshchenko opened this issue Jun 18, 2019 · 4 comments
Closed

Nested whitelisting is broken while used in .prettierignore #67

tryshchenko opened this issue Jun 18, 2019 · 4 comments

Comments

@tryshchenko
Copy link

tryshchenko commented Jun 18, 2019

"prettier": "1.18.2"
"pretty-quick": "1.11.1"

Hi everyone,

We're using pretty-quick and got a following issue.
We have two different codebases:

/src/a/
/src/b/

and many folders with different helpers, tests, mocks in folders above /src/

I want to use pretty-qucik only on /src/b/

I followed the .gitignore guildlines for negating rules and come up with something like this:

/*
!/src/b/

But it hasn't worked. I also tried

!src/b, !/src/b/, !/src/b/**/*.js, !/*/b/*

and many others, but it fails.
But if I try to exclude folder from the root without going into nested folders it works.

/*
!/src/

This works.

Could you specify if nested exclusions are supposed to be supported?

@azz
Copy link
Member

azz commented Jun 19, 2019

Hmm that's strange. Have you tried using --pattern?

@jantimon
Copy link
Collaborator

jantimon commented Jul 19, 2019

The entire .prettyignore handling is done inside the createIgnorer.js:

https://github.com/azz/pretty-quick/blob/34e29bdf78cb00ca4c362fc1f6761983d9c8e299/src/createIgnorer.js#L5-L15

Where ignore is the npm ignore package

So this code is all done by node-ignore - maybe we can create an issue there?

@michael13491
Copy link

hi @tryshchenko,

I think I just raised a similar issue to this #95

Have you tried negating rules like this:

/*
!/src
/src/*
!/src/b

As explained in gitignore pattern format:

It is not possible to re-include a file if a parent directory of that file is excluded.

So the rules above will re-include the parent directory (src) before re-include the child /src/b

@azz
Copy link
Member

azz commented Nov 23, 2019

As mentioned above this is all handled in ignore, there's not much I can do here.

@azz azz closed this as completed Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants