Repository navigation
feat: support array of strings for prettier.ignorePath setting - #4020
Open
Mohit-Gaur75 wants to merge 1 commit into
Open
Mohit-Gaur75 wants to merge 1 commit into
Mohit-Gaur75 wants to merge 1 commit into
Conversation
- Allow prettier.ignorePath to accept either a string or an array of strings in package.json configuration schema - Update ModuleResolverNode and ModuleResolverWeb to resolve array of ignore paths in parallel and filter existing paths - Update PrettierEditService to pass resolved string or string[] ignore paths to Prettier getFileInfo - Add unit tests for resolving array of ignore paths in ModuleResolverNode.test.ts - Update documentation and localization files Fixes prettier#3341
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #3341
Addresses #3894
Prettier CLI and core API natively accept multiple ignore paths via
ignorePath(supportingstring | string[]since Prettier 3.0.0+ / PR prettier/prettier#14332). However, the VS Code extension previously only accepted a single string forprettier.ignorePath, preventing users from specifying multiple ignore files (such as[".prettierignore", ".gitignore"]).This PR adds full support for configuring
prettier.ignorePathas either a string or an array of strings.Changes
package.json): Updatedprettier.ignorePathusinganyOfto accept eitherstringorarrayofstring.src/types.ts): UpdatedIExtensionConfig.ignorePathandModuleResolverInterface.getResolvedIgnorePathto acceptstring | string[]and returnPromise<string | string[] | undefined>.src/ModuleResolverNode.ts,src/ModuleResolverWeb.ts):ModuleResolverNode: Resolves multiple paths in parallel, filters to existing files, and returnsstring[] | undefined.ModuleResolverWeb: Resolves workspace-relative paths for arrays.src/PrettierEditService.ts): UpdatedPrettierEditServiceto forward the resolvedstring | string[]ignore path(s) toprettierInstance.getFileInfo(...)and format logging output for multiple paths.src/test/suite/ModuleResolverNode.test.ts): Added unit tests verifying single string resolution, array resolution with filtering of non-existent files, and undefined fallback when none exist.README.md,package.nls*.json): Updated setting description and README to document array support.Test plan
npm run compilesucceedsnpm run compile:testsucceedsnpm run lintpasses with 0 errorsnpx prettier --check)src/test/suite/ModuleResolverNode.test.tscovering array of ignore paths