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

Do not require plugins to set 'since' field #4038

Merged
merged 2 commits into from
Feb 24, 2018
Merged

Conversation

azz
Copy link
Member

@azz azz commented Feb 24, 2018

Fixes the issue raised in prettier/plugin-php#55

@@ -81,10 +81,9 @@ function inferParser(filepath, plugins) {
pluginsLoaded: true
}).languages.find(
language =>
typeof language.since === "string" &&
Copy link
Member

Choose a reason for hiding this comment

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

language.since !== null? We should omit unreleased languages here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

return semver.gte(version, language.since);
}
return true;
})
Copy link
Member

Choose a reason for hiding this comment

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

How about

language.since
  ? semver.gte(version, language.since)
  : language.since !== null

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I originally had a ternary but it looked messy/hard to reason about so I switched it to if/else.

@azz azz merged commit a066812 into prettier:master Feb 24, 2018
@azz azz deleted the plugin-since branch February 24, 2018 08:00
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants