Giter Club home page Giter Club logo

Comments (5)

nfcampos avatar nfcampos commented on May 18, 2024

I'm guessing this does not do what we want?
https://github.com/babel/babel/blob/master/packages/babel-types/src/react.js#L5

Also, I'm not really familiar with developing babel plugins but if it were possible to inspect the prototype of an object it would be quite trivial to identify react components no?

from babel-plugin-react-transform.

gaearon avatar gaearon commented on May 18, 2024

@nfcampos

I don’t think we use that function.
No, we can’t inspect the prototype because this is compile time, not run time.
I think the bug, if there is one, is somewhere here:

return !!find(patterns, pattern => {
return (
t.isIdentifier(path.node, { name: pattern }) ||
path.matchesPattern(pattern)
);

from babel-plugin-react-transform.

gaearon avatar gaearon commented on May 18, 2024

Or, rather, the problem is most likely that these two lines should end with || rather than &&:

!matchesPatterns(path.get('superClass'), this.superClasses) &&

!matchesPatterns(path.get('callee'), this.factoryMethods) &&

Please feel free to submit a fix, add tests for it, and I’ll be happy to merge.

from babel-plugin-react-transform.

gaearon avatar gaearon commented on May 18, 2024

Closing as duplicate of #84. (This one is earlier but the other one describes the problem more accurately).

from babel-plugin-react-transform.

gaearon avatar gaearon commented on May 18, 2024

Should be fixed in 2.0.1.

from babel-plugin-react-transform.

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.