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

Fix/consider option version #348

Merged
merged 18 commits into from
Oct 10, 2023

Conversation

victorsptt
Copy link
Contributor

Before submitting a pull request, please make sure the following is done...

  1. Fork the repo and create your branch from master.
  2. If you've added code that should be tested, do a sanity check on vim8 and neovim
  3. If you've changed APIs, update the README and documentation ./doc/prettier.txt

Please use the simple form below as a guideline for describing your pull request.

Thanks for contributing to vim-prettier


Summary

  • Made the plugin consider the addition and deprecation versions of each option in relation to the version of the Prettier npm package being used when composing the CLI command so that only compatible CLI flags are used.
  • Fixes Deprecated / Unknown options when using Prettier v3 #346.

Test Plan

Tested the plugin in Vim 8.2, Vim 9.0, and Neovim 0.9. Wrote unit tests for some functions.

Split the function that returns the visual selection range into two parts that
return the start and the end of the range respectively, and use them in the
CLI-command composer. This is part of a plan to use a general object with
details about flags to compose the CLI command.
Added a new function to get the command part of the --stdin-filepath flag. This
is part of a plan to compose the CLI command from an object with flag details.
Added a new function to return the CLI command part for the --loglevel flag.
This is part of a plan to compose the CLI command from a general object with
flag details.
Added a new function to return the CLI command part for the --stdin flag. This
is part of a plan use an object with flag details to compose the CLI command.
Added general mapper functions that map flag names to parts of a CLI command.
They are part a plan to use an object with flag details to compose the CLI
command.
Adapted flag-mapper functions to use the same parameters. This is part of a
plan to expose a common interface from planned objects with flags, to make code
flexible to future changes, and to compose the CLI command from a general
object with flag details.
Added a global variable for the bracketSameLine option. It is set to the
user's defined value and uses the Prettier default as reserve. This is
part of a plan to compose the CLI command from an object with details
about the flags
Changed the function to make it reusable across versions of the CLI
flag. This is part of a plan to compose the CLI command from an object
with details about the flags.
Added an object with details about Prettier CLI flags. This is part of a
plan to compose the flags of the CLI command from a general object with
flag details.
Added two helper functions to get the version of the Prettier CLI as a
string. This is part of a plan to compose the CLI command from an object
with flag details.
Added 2 functions that compare versions strings according to semantic
version. This is part of a plan to compose the flags of the CLI command
from an object with flag details.
Added unit tests for version-comparison functions.
Added a function to filter flags that are uncompatible with a supplied
version. This is part of a plan to compose the flags of the CLI command
from an object with flag details.
Added a function that selects the flags that are compatible with
the version of the Prettier CLI being used. This is part of a plan to
compose the flags of the CLI command from an object with flag details.
Added Vim foldings to sections of the code in config.vim to improve file
navigation.
Considered the addition and deprecation versions of each Prettier option
contained in the object with details about the CLI flags when composing
the CLI command.
Removed TODO comment that reminded to compose the flags of the CLI
command from a list using list methods. The task is completed.
Wrote a comment describing the global variable that overwrites the
"bracketSameLine" option.
@mitermayer
Copy link
Member

Awesome! Thank you! Assuming it all works happy to merge and do a new release!

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

Successfully merging this pull request may close these issues.

Deprecated / Unknown options when using Prettier v3
2 participants