Giter Site home page Giter Site logo

Comments (4)

trisys3 avatar trisys3 commented on August 22, 2024 2

I think I am having a similar problem. For me, it looks like a combination of transform-es2015-shorthand-properties and transform-es2015-function-name is causing a situation where if I have the same name for the shorthand function and one of the function parameters, babel adds an underscore to the parameter. This comes up when I need the dependency and the service/controller to have the same name, mostly in UI Router resolves where nested states need to override the parent's resolve or general resolves can use a global service with the same name

The shortest code I could come up with to demonstrate was:

echo 'y = {x(x) {}}' | babel --plugins transform-es2015-shorthand-properties,transform-es2015-parameters

Output:

y = {
    x: function x(_x) {}
};

If I remove either shorthand-properties or function-name, the problem goes away. With just shorthand-properties, I get

y = {
    x: function (x) {}
};

whereas with just function-name I get

y = { x(x) {} };

Investigating the issue drove me to this plugin, which I am thinking about using. The stability is slightly worrying (before 1.0) but I have used less stable modules.

I will also try @shmod's suggestion and blacklist function-name, as I have never needed it and do not foresee a case where I will.

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on August 22, 2024

@stephank Go ahead and open a ticket upstream with Babel. This indeed looks like a bug with transform-es2015-function-name.

Our unit tests already have another (different) conflict with this transform, and I disable it in most cases by creating a modified es2015 preset that does not include that transformation.

Obviously, I do not expect users to need to jump through this hoop in real-world scenarios, so I'm considering this a bug.

from babel-plugin-angularjs-annotate.

stephank avatar stephank commented on August 22, 2024

They didn't outright close it, but did sort of bounce the issue back here: babel/babel#4782

For what it's worth, for us specifically, this is rather low prio. It's fairly easy to work around. :)

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on August 22, 2024

Thanks for taking the time to open the ticket. I'll follow up with the Babel folks.

from babel-plugin-angularjs-annotate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.