babel/packages/babel-plugin-transform-react-jsx-self
Rin Tepis 224a35c5c6
Don't insert __self: this within constructors of derived classes (#13552)
* Don't insert `__self: this` prior to `super()` calls (#13550)

`__self: this` is inserted for debugging purposes. However, it will cause a runtime error if it is inserted prior to a `super()` call in a constructor. This commit will prevent `__self: this` from inserted when there is a following `super()` call.

* Prevent adding `__self` within a constructor that has `super()` altogether.

* Fix 2 typos in the comments.

* Add an additional test case for constructors that do not have a `super()` call.

* Detect `super()` call by testing whether the class has a superclass.

* Update method name and corresponding comments

* Add an additional test for the case where the derived class do not have a `super()` call.

* Apply the same changes to babel-plugin-transform-react-jsx
2021-07-26 13:32:29 -04:00
..
2017-03-25 21:46:16 -04:00
2021-06-09 23:03:30 +00:00

@babel/plugin-transform-react-jsx-self

Add a __self prop to all JSX Elements

See our website @babel/plugin-transform-react-jsx-self for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-react-jsx-self

or using yarn:

yarn add @babel/plugin-transform-react-jsx-self --dev