babel-plugin-transform-react-remove-prop-types
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -117,6 +117,18 @@ 'use strict'; | ||
function isPathReactClass(path) { | ||
if (path.matchesPattern('React.Component') || path.matchesPattern('React.PureComponent')) { | ||
return true; | ||
} | ||
if (path.node && (path.node.name === 'Component' || path.node.name === 'PureComponent')) { | ||
return true; | ||
} | ||
return false; | ||
} // weak | ||
function isReactClass(superClass, scope) { | ||
var answer = false; | ||
if (superClass.matchesPattern('React.Component') || superClass.node.name === 'Component') { | ||
if (isPathReactClass(superClass)) { | ||
answer = true; | ||
@@ -129,3 +141,3 @@ } else if (superClass.node.name) { | ||
if (superClass.matchesPattern('React.Component') || superClass.node && superClass.node.name === 'Component') { | ||
if (isPathReactClass(superClass)) { | ||
answer = true; | ||
@@ -136,3 +148,3 @@ } | ||
return answer; | ||
} // weak | ||
} | ||
@@ -139,0 +151,0 @@ function remove(path, options) { |
{ | ||
"name": "babel-plugin-transform-react-remove-prop-types", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "Remove unnecessary React propTypes from the production build", | ||
@@ -45,3 +45,3 @@ "main": "lib/index.js", | ||
"flow": "^0.2.3", | ||
"flow-bin": "^0.29.0", | ||
"flow-bin": "^0.30.0", | ||
"glob": "^7.0.5", | ||
@@ -48,0 +48,0 @@ "istanbul": "^0.4.2", |
@@ -115,4 +115,5 @@ # babel-plugin-transform-react-remove-prop-types | ||
This mode is quite useful for lib authors. | ||
However, we do not support the old `React.createClass` syntax nor the | ||
name less classes yet. | ||
However, there is some limitation. | ||
We do not support the old `React.createClass` syntax nor the | ||
name less classes yet. In those cases, we keep the `propTypes`. | ||
@@ -119,0 +120,0 @@ ## License |
@@ -5,7 +5,22 @@ // @flow weak | ||
function isPathReactClass(path) { | ||
if (path.matchesPattern('React.Component') || | ||
path.matchesPattern('React.PureComponent')) { | ||
return true; | ||
} | ||
if ((path.node && ( | ||
path.node.name === 'Component' || | ||
path.node.name === 'PureComponent' | ||
))) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function isReactClass(superClass, scope) { | ||
let answer = false; | ||
if (superClass.matchesPattern('React.Component') || | ||
(superClass.node.name === 'Component')) { | ||
if (isPathReactClass(superClass)) { | ||
answer = true; | ||
@@ -17,4 +32,3 @@ } else if (superClass.node.name) { // Check for inheritance | ||
if (superClass.matchesPattern('React.Component') || | ||
(superClass.node && superClass.node.name === 'Component')) { | ||
if (isPathReactClass(superClass)) { | ||
answer = true; | ||
@@ -21,0 +35,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26360
630
122