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

Require proposal flag for pipeline plugin #8196

Conversation

mAAdhaTTah
Copy link
Contributor

@mAAdhaTTah mAAdhaTTah commented Jun 19, 2018

Q                       A
Fixed Issues? babel/proposals#29
Patch: Bug Fix? No
Major: Breaking Change? Yes
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR No
Any Dependency Changes? No
License MIT

I'm opening this now to get feedback early. I'm not sure if the logic should live in the proposal plugin, the syntax plugin, or the parser? (or all three?)

Is proposal an acceptable flag name?

Also, this breaks the current stage-0 plugin as well, which I don't know if you're going to keep. Is that going to be an issue?

  • Implement validation logic in all required places
  • Update README

@loganfsmyth
Copy link
Member

I think this is a reasonable approach.

api.assertVersion(7);

if (typeof proposal !== "string" || !proposals.includes(proposal)) {
throw new Error("'proposal' must be one of: " + proposals.join(", "));
Copy link
Member

Choose a reason for hiding this comment

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

Yep looks good, wonder if we should introduce a url to show what the options are and why etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also plan on updating the README. Is there any other place where we should include that documentation?

Copy link
Member

Choose a reason for hiding this comment

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

I think the readme is good. We should introduce a new general doc on the page explaining how we want to think about proposals moving forward and how they are implemented though. Kinda like babel/proposals#26 but I didn't get to finishing it, not sure.

@mAAdhaTTah
Copy link
Contributor Author

@loganfsmyth @hzoo This also breaks the stage-0 preset, which would need this configuration. Is that acceptable? If so, I can update the tests to take the config.

@hzoo
Copy link
Member

hzoo commented Jun 19, 2018

Yeah we are going to remove the stage presets because of this issue #7770. Same issues we had with decorators actually. Not really worth the trouble anymore so people should opt-into what they want or make their own preset.

@mAAdhaTTah
Copy link
Contributor Author

Ok cool, I'll make those changes this evening.

@nicolo-ribaudo
Copy link
Member

Even if we are going to deprecate the stage-0 preset, I'd prefer to add a flag which is passed down to this plugin, similarly to what I did with the decoratorsLegacy option.

@mAAdhaTTah
Copy link
Contributor Author

@nicolo-ribaudo Yeah, that the test that's failing, so I'll make sure that works when I fix it.

This is going to be required so we can add support for other proposals,
as well as later set the accepted proposal as the default.

Update stage-0 / -1 plugins with `pipelineProposal` to thread down to
the plugin.
@mAAdhaTTah mAAdhaTTah force-pushed the add-proposal-flag-requirement-to-pipeline branch from 584086b to 940d9b2 Compare June 20, 2018 00:48
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8431/

1 similar comment
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8431/

mAAdhaTTah added a commit to valtech-nyc/website that referenced this pull request Jun 20, 2018
@mAAdhaTTah
Copy link
Contributor Author

Documentation update: babel/website#1700

mAAdhaTTah added a commit to valtech-nyc/website that referenced this pull request Jun 20, 2018
@mAAdhaTTah
Copy link
Contributor Author

I think all the open question have been addressed, so this should be ready to go.

@mAAdhaTTah
Copy link
Contributor Author

Bumping this PR. Would like to get this landed so we can refresh our branch with the incoming pipeline changes.

@nicolo-ribaudo nicolo-ribaudo added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release Spec: Pipeline Operator labels Jun 27, 2018
@nicolo-ribaudo nicolo-ribaudo added this to the Babel 7 RC milestone Jun 27, 2018
@@ -1,7 +1,7 @@
{
"plugins": ["external-helpers", ["proposal-class-properties", {"loose": true}]],
"presets": [
["stage-0", { "decoratorsLegacy": true }],
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }],
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to the PR but I wonder why the stage-0 preset is even necessary to use in this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea, but it did catch that I broke state-0 so maybe that's ok?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it is ok. I often use stage-0 in tests for lazyness 😛

@nicolo-ribaudo nicolo-ribaudo merged commit eac4c5b into babel:master Jun 27, 2018
@nicolo-ribaudo
Copy link
Member

(please update the docs at https://github.com/babel/website/tree/master/docs)

@mAAdhaTTah
Copy link
Contributor Author

@nicolo-ribaudo PR is already here: babel/website#1700

@mAAdhaTTah mAAdhaTTah deleted the add-proposal-flag-requirement-to-pipeline branch June 27, 2018 23:24
mAAdhaTTah added a commit to valtech-nyc/website that referenced this pull request Jun 28, 2018
existentialism pushed a commit to babel/website that referenced this pull request Jul 2, 2018
benjamn added a commit to benjamn/reify that referenced this pull request Jul 11, 2018
taylorzane pushed a commit to taylorzane/reify that referenced this pull request Feb 26, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release Spec: Pipeline Operator
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants