Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-react-remove-prop-types

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-react-remove-prop-types - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

18

lib/index.js

@@ -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) {

4

package.json
{
"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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc