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 for Prettier 2 #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix for Prettier 2 #15

wants to merge 1 commit into from

Conversation

gakada
Copy link

@gakada gakada commented Jul 1, 2020

@matthargett
Copy link
Contributor

with PR #17 merged, this one can now be closed. thanks for pointing out the plugin-php PR, I think that using their code as a reference for other fixups we need to do will be super helpful!

@suchipi
Copy link
Member

suchipi commented Sep 4, 2020

Dang, sorry @gakada! I totally missed the notification for this PR.

That said, I still think we should merge in this code, since it conditionally handles both prettier 1 and 2.

Could you or @matthargett rebase it and resolve conflicts?

Comment on lines +26 to +29
const prettierVersion = require("prettier").version;

function lookupIfPrettier2(options, prop) {
return parseInt(prettierVersion[0]) > 1 ? options[prop] : options;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way, the version check won’t break on Prettier 10 – Prettier 19:

Suggested change
const prettierVersion = require("prettier").version;
function lookupIfPrettier2(options, prop) {
return parseInt(prettierVersion[0]) > 1 ? options[prop] : options;
const [prettierVersionMajor] = require("prettier").version.split(".", 1);
function lookupIfPrettier2(options, prop) {
return parseInt(prettierVersionMajor) > 1 ? options[prop] : options;

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.

4 participants