babel-plugin-transform-react-remove-prop-types
Advanced tools
Comparing version
@@ -107,2 +107,19 @@ 'use strict'; | ||
} | ||
}, | ||
MemberExpression: function MemberExpression(path) { | ||
var node = path.node, | ||
scope = path.scope; | ||
if (node.property.name === 'propTypes') { | ||
var binding = scope.getBinding(node.object.name); | ||
if (!binding) { | ||
return; | ||
} | ||
if (['ImportDefaultSpecifier', 'ImportSpecifier'].indexOf(binding.path.node.type) !== -1) { | ||
throw path.buildCodeFrameError('You are accessing the propTypes from an imported Identifier.\n' + 'It\'s likely to break at runtime. Instead, import the propTypes.\n' + 'For more details, have a look at this issue: https://goo.gl/sHDdUk.'); | ||
} | ||
} | ||
} | ||
@@ -109,0 +126,0 @@ }); |
{ | ||
"name": "babel-plugin-transform-react-remove-prop-types", | ||
"version": "0.2.12", | ||
"version": "0.3.0", | ||
"description": "Remove unnecessary React propTypes from the production build", | ||
@@ -53,4 +53,5 @@ "main": "lib/index.js", | ||
"nodemon": "^1.11.0", | ||
"path-exists": "^3.0.0", | ||
"pkgfiles": "^2.3.2" | ||
} | ||
} |
@@ -219,2 +219,23 @@ // @flow weak | ||
}, | ||
MemberExpression(path) { | ||
const { | ||
node, | ||
scope, | ||
} = path; | ||
if (node.property.name === 'propTypes') { | ||
const binding = scope.getBinding(node.object.name); | ||
if (!binding) { | ||
return; | ||
} | ||
if (['ImportDefaultSpecifier', 'ImportSpecifier'].indexOf(binding.path.node.type) !== -1) { | ||
throw path.buildCodeFrameError( | ||
'You are accessing the propTypes from an imported Identifier.\n' + | ||
'It\'s likely to break at runtime. Instead, import the propTypes.\n' + | ||
'For more details, have a look at this issue: https://goo.gl/sHDdUk.'); | ||
} | ||
} | ||
}, | ||
}); | ||
@@ -221,0 +242,0 @@ }, |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
24096
6.78%533
6.18%21
5%1
Infinity%