Respect Prettier ignore files in parent directories#1887
Respect Prettier ignore files in parent directories#1887
Conversation
🦋 Changeset detectedLatest commit: 90b7b6c The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
I had to add this so our src/cli/adapter/prettier.test.ts cases behave, as they were falling back to the root 😅
Line 11 in 7bef2a2
|
Do we have a gap here where, if we have multiple .prettierignores, context of where you run now matters?
|
|
@AaronMoat I think we pick one file in both cases, which aligns with https://redirect.github.com/prettier/prettier/issues/4081. Maybe I should add comments to this effect though! |
| const relativeFilepaths = await crawlDirectory(directory, [ | ||
| '.gitignore', | ||
| '.prettierignore', | ||
| // TODO: should these bottom out at the project root? |
| ]); | ||
|
|
||
| const ignoreFilenames = ignoreFilepaths.flatMap((filepath) => | ||
| filepath ? path.relative(cwd, filepath) : [], |
There was a problem hiding this comment.
Is it possible for file path to be empty?
| ) => { | ||
| const ignoreFileFilter = await createInclusionFilter( | ||
| ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)), | ||
| const ignoreFilenamesByPrefix = Object.groupBy( |
|
@72636c does this mean we're removing support for having multiple prettierignore files, or am I misunderstanding still? |
No description provided.