Repository navigation
fix: accept npm: specifiers in the --plugins CLI flag - #1319
Merged
Merged
Conversation
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.
Repro:
dprint check --plugins npm:@dprint/[email protected]failed with "npm:@dprint/[email protected] was specified as a plugin, but it doesn't look like one. Plugins must have a .wasm or .json extension."The check in
validate_plugin_args_when_no_filesexists to catchdprint fmt --plugins <url> <file>where the user forgot--, but it only accepted.wasm/.json(optionally with a checksum suffix), sonpm:specifiers, which don't need an extension, were rejected before ever reachingparse_plugin_source_reference.Change:
npm:now passes the "looks like a plugin" check (extracted into alooks_like_pluginhelper)--pluginshelp text andwebsite/src/config.mdmentionnpm:specifiers--plugins npm:@dprint/[email protected]with no files parses, and one showingnpm:followed by a file-looking arg still gets the "Maybe you meant to add two dashes" hintThe config resolution already goes through
parse_plugin_source_reference, so no further changes were needed fornpm:to work end to end.Verification:
cargo test -p dprintpasses (apart from the pre-existing umask-dependentextract_tarball_preserves_exec_bits_via_env_set_permissions),cargo clippy -p dprintcleanDPRINT_CACHE_DIR=<scratch> ./target/release/dprint output-resolved-config --plugins npm:@dprint/[email protected]downloads the plugin and outputs the json config;dprint check --plugins npm:@dprint/[email protected]now runs the plugin