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

refactor: extract options-normalizer/validator #5020

Merged
merged 3 commits into from Aug 31, 2018

Conversation

Projects
None yet
3 participants
@ikatyang
Member

ikatyang commented Aug 28, 2018

  • Uses vnopts
  • This way it should be easier to support language-specific options (#4798 (comment)) and map the common options to language-specific options using forward, e.g. singleQuote: true -> "javascript/singleQuote": "js", singleQuote: false -> "javascript/singleQuote": "none".
  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • I’ve read the contributing guidelines.
@@ -46,7 +46,7 @@ exports[`throw error with invalid config option (int) (stdout) 1`] = `""`;
exports[`throw error with invalid config option (int) (write) 1`] = `Array []`;
exports[`throw error with invalid config option (trailingComma) (stderr) 1`] = `
"[error] Invalid \`\\"trailingComma\\"\` value. Expected \\"all\\", \\"es5\\" or \\"none\\", but received \`\\"wow\\"\`.
"[error] Invalid trailingComma value. Expected \\"all\\", \\"es5\\" or \\"none\\", but received \\"wow\\".

This comment has been minimized.

@ikatyang
@@ -10,7 +10,7 @@ exports[`boolean flags do not swallow the next argument (stdout) 1`] = `
exports[`boolean flags do not swallow the next argument (write) 1`] = `Array []`;
exports[`deprecated option values are warned (stderr) 1`] = `
"[warn] \`--trailing-comma\` without an argument is deprecated. Prettier now treats it as \`--trailing-comma=es5\`.
"[warn] --trailing-comma without an argument is deprecated, now treats it as --trailing-comma=es5.

This comment has been minimized.

@suchipi

suchipi Aug 28, 2018

Member

"now treats it" without a subject isn't valid; maybe we should say "this is treated as"? It's passive voice but... I think it's clearer

This comment has been minimized.

@ikatyang

ikatyang Aug 29, 2018

Member

How about we now treat it as ...?

This comment has been minimized.

@suchipi

suchipi Aug 29, 2018

Member

perfect 👍

This comment has been minimized.

@hawkrives

hawkrives Aug 31, 2018

Contributor

May I do a drive-by interjection about comma splices? That should be "... deprecated; we now treat it as", rather than separated by a semicolon.

@hawkrives

This comment has been minimized.

Contributor

hawkrives commented Aug 31, 2018

Thanks @ikatyang!

@ikatyang ikatyang merged commit 49e2f77 into prettier:master Aug 31, 2018

10 checks passed

ci/circleci: build_prod Your tests passed on CircleCI!
Details
ci/circleci: checkout_code Your tests passed on CircleCI!
Details
ci/circleci: test_prod_node4 Your tests passed on CircleCI!
Details
ci/circleci: test_prod_node9 Your tests passed on CircleCI!
Details
ci/circleci: test_prod_standalone Your tests passed on CircleCI!
Details
codecov/patch 98.18% of diff hit (target 80%)
Details
codecov/project 96.55% (+0.07%) compared to 8779937
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@ikatyang ikatyang deleted the ikatyang:refactor/vnopts branch Aug 31, 2018

@ikatyang ikatyang added this to the 1.15 milestone Oct 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment