babel-plugin-transform-react-remove-prop-types
Advanced tools
Comparing version 0.4.18 to 0.4.19
@@ -287,2 +287,7 @@ "use strict"; | ||
VariableDeclarator: function VariableDeclarator(path) { | ||
// Only consider the top level scope. | ||
if (path.scope.block.type !== 'Program') { | ||
return; | ||
} | ||
if (['ObjectPattern', 'ArrayPattern'].includes(path.node.id.type)) { | ||
@@ -311,4 +316,4 @@ // Object or Array destructuring, so we will want to capture all | ||
var hasRemainingReferencePaths = referencePaths.some(function (referencePath) { | ||
var found = referencePath.find(function (p) { | ||
return removedPaths.has(p); | ||
var found = referencePath.find(function (path2) { | ||
return removedPaths.has(path2); | ||
}); | ||
@@ -315,0 +320,0 @@ return !found; |
@@ -6,11 +6,10 @@ "use strict"; | ||
}); | ||
exports.default = _default; | ||
exports.default = isAnnotatedForRemoval; | ||
// weak | ||
function _default(node) { | ||
function isAnnotatedForRemoval(node) { | ||
var comments = node.trailingComments || []; | ||
return !!comments.find(function (_ref) { | ||
return Boolean(comments.find(function (_ref) { | ||
var value = _ref.value; | ||
return value.trim() === 'remove-proptypes'; | ||
}); | ||
})); | ||
} |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = isStatelessComponent; | ||
// weak | ||
var traversed = Symbol('traversed'); | ||
@@ -10,0 +9,0 @@ |
@@ -8,4 +8,2 @@ "use strict"; | ||
// weak | ||
/* eslint-disable no-param-reassign */ | ||
@@ -12,0 +10,0 @@ function isInside(scope, regex) { |
{ | ||
"name": "babel-plugin-transform-react-remove-prop-types", | ||
"version": "0.4.18", | ||
"version": "0.4.19", | ||
"description": "Remove unnecessary React propTypes from the production build", | ||
@@ -11,6 +11,5 @@ "main": "lib/index.js", | ||
"prettier": "find . -name \"*.js\" | grep -v -f .eslintignore | xargs prettier --write", | ||
"test": "npm run lint && npm run test:unit && npm run flow", | ||
"test": "npm run lint && npm run test:unit", | ||
"prebuild": "rm -rf lib/", | ||
"build": "babel src --out-dir lib", | ||
"flow": "flow", | ||
"version": "npm run build && pkgfiles" | ||
@@ -57,3 +56,2 @@ }, | ||
"eslint-plugin-react": "^7.4.0", | ||
"flow-bin": "^0.59.0", | ||
"mocha": "^4.0.1", | ||
@@ -60,0 +58,0 @@ "path-exists": "^3.0.0", |
@@ -10,3 +10,3 @@ # babel-plugin-transform-react-remove-prop-types | ||
[![Dependencies](https://img.shields.io/david/oliviertassinari/babel-plugin-transform-react-remove-prop-types.svg)](https://david-dm.org/oliviertassinari/babel-plugin-transform-react-remove-prop-types) | ||
[![DevDependencies](https://img.shields.io/david/dev/oliviertassinari/babel-plugin-transform-react-remove-prop-types.svg)](https://david-dm.org/oliviertassinari/babel-plugin-transform-react-remove-prop-types#info=devDependencies&view=list) | ||
[![DevDependencies](https://img.shields.io/david/dev/oliviertassinari/babel-plugin-transform-react-remove-prop-types.svg)](https://david-dm.org/oliviertassinari/babel-plugin-transform-react-remove-prop-types?type=dev) | ||
@@ -13,0 +13,0 @@ ## Installation |
@@ -1,2 +0,1 @@ | ||
// @flow weak | ||
/* eslint-disable global-require, import/no-dynamic-require */ | ||
@@ -291,2 +290,7 @@ | ||
VariableDeclarator(path) { | ||
// Only consider the top level scope. | ||
if (path.scope.block.type !== 'Program') { | ||
return | ||
} | ||
if (['ObjectPattern', 'ArrayPattern'].includes(path.node.id.type)) { | ||
@@ -313,3 +317,3 @@ // Object or Array destructuring, so we will want to capture all | ||
const hasRemainingReferencePaths = referencePaths.some(referencePath => { | ||
const found = referencePath.find(p => removedPaths.has(p)) | ||
const found = referencePath.find(path2 => removedPaths.has(path2)) | ||
return !found | ||
@@ -316,0 +320,0 @@ }) |
@@ -1,7 +0,5 @@ | ||
// @flow weak | ||
export default function(node) { | ||
export default function isAnnotatedForRemoval(node) { | ||
const comments = node.trailingComments || [] | ||
return !!comments.find(({ value }) => value.trim() === 'remove-proptypes') | ||
return Boolean(comments.find(({ value }) => value.trim() === 'remove-proptypes')) | ||
} |
@@ -1,3 +0,1 @@ | ||
// @flow weak | ||
const traversed = Symbol('traversed') | ||
@@ -4,0 +2,0 @@ |
@@ -1,2 +0,1 @@ | ||
// @flow weak | ||
/* eslint-disable no-param-reassign */ | ||
@@ -3,0 +2,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
45528
26
995