babel-upgrade icon indicating copy to clipboard operation
babel-upgrade copied to clipboard

Need logging to explain changes to the plugins spec

Open hzoo opened this issue 7 years ago • 7 comments

Basically people are going to complain because the output from babel after updating may be larger than before because the defaults are spec behavior.

  • If they use the plugin explicitly, we can opt-into "loose" for them
  • If they don't, we just need to warn that the default is "spec" or "loose", etc.

Example: -template-literals - default was previously "spec" -> 'a' + b -> "a".concat(b)

hzoo avatar Feb 20 '18 04:02 hzoo

wait, the default for that isn’t spec anymore??

ljharb avatar Feb 20 '18 04:02 ljharb

Sorry if it doesn't make sense. The v7 default was what was previously spec

hzoo avatar Feb 20 '18 04:02 hzoo

Maybe I’m missing context. I’d hope that v7 had more things default to “spec” than in v6; but maybe this issue is about the more generic approach of how to adapt to changing defaults?

ljharb avatar Feb 20 '18 04:02 ljharb

I'm saying what you are saying, in v7 more things are spec, but that might be unexpected to certain lib authors that didn't want to opt-in to that when they were using loose before.

hzoo avatar Feb 20 '18 04:02 hzoo

Makes sense, thanks for clarifying :-)

ljharb avatar Feb 20 '18 05:02 ljharb

@hzoo i can take a swing at this. thinking about how to most clearly word these notifications

🤔🤔🤔 maybe something like:

-template-literals is now spec-compliant by default. For previous behavior use the loose flag (https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-template-literals#loose)

i don't like "For previous behavior" -- not sure how to articulate that bit

noahlemen avatar Feb 26 '18 19:02 noahlemen

@hzoo are there any plugins other than the following that are hit here?

  • plugin-proposal-class-properties
  • plugin-transform-template-literals

i haven't yet dug into the code on these to understand completely, but it looks like there were some behavior changes around adding a loose option on there -- but this is a bit of a different case since these didn't have spec previously:

  • plugin-proposal-object-rest-spread
  • plugin-transform-parameters

should we provide some sort of logging on these also?

also -- any thoughts on how this should factor in for users who have loose/spec set on a preset instead of on the standalone plugin? perhaps that's a little bigger than this issue, i need to think more about what might make sense there

edit: oh, that's what you were referring to when you said "explicitly", i get it now 👍

noahlemen avatar Mar 02 '18 16:03 noahlemen