@dhis2/prop-types
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -5,3 +5,3 @@ "use strict"; | ||
var _arrayWithLength = require("../arrayWithLength"); | ||
var _arrayWithLength = require("../arrayWithLength.js"); | ||
@@ -8,0 +8,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -5,3 +5,3 @@ "use strict"; | ||
var _conditional = require("../conditional"); | ||
var _conditional = require("../conditional.js"); | ||
@@ -8,0 +8,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
"use strict"; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _instanceOfComponent = require("../instanceOfComponent.js"); | ||
var _instanceOfComponent = require("../instanceOfComponent"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -10,0 +10,0 @@ |
@@ -5,3 +5,3 @@ "use strict"; | ||
var _mutuallyExclusive = require("../mutuallyExclusive"); | ||
var _mutuallyExclusive = require("../mutuallyExclusive.js"); | ||
@@ -8,0 +8,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -5,3 +5,3 @@ "use strict"; | ||
var _requiredIf = require("../requiredIf"); | ||
var _requiredIf = require("../requiredIf.js"); | ||
@@ -8,0 +8,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -39,3 +39,3 @@ "use strict"; | ||
var _conditional = require("./conditional"); | ||
var _conditional = require("./conditional.js"); | ||
@@ -42,0 +42,0 @@ var _instanceOfComponent = require("./instanceOfComponent.js"); |
import propTypes from 'prop-types'; | ||
import { arrayWithLength } from '../arrayWithLength'; | ||
import { arrayWithLength } from '../arrayWithLength.js'; | ||
@@ -4,0 +4,0 @@ const toWarning = message => `Warning: Failed prop type: ${message}`; |
import propTypes from 'prop-types'; | ||
import { conditional } from '../conditional'; | ||
import { conditional } from '../conditional.js'; | ||
describe('conditional', () => { | ||
@@ -4,0 +4,0 @@ const propType = { |
@@ -1,5 +0,5 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
import propTypes from 'prop-types'; // eslint-disable-next-line no-unused-vars | ||
import React from 'react'; | ||
import propTypes from 'prop-types'; | ||
import { instanceOfComponent } from '../instanceOfComponent'; | ||
import { instanceOfComponent } from '../instanceOfComponent.js'; | ||
@@ -6,0 +6,0 @@ const toWarning = message => `Warning: Failed prop type: ${message}`; |
import propTypes from 'prop-types'; | ||
import { mutuallyExclusive } from '../mutuallyExclusive'; | ||
import { mutuallyExclusive } from '../mutuallyExclusive.js'; | ||
@@ -4,0 +4,0 @@ const toWarning = message => `Warning: Failed prop type: ${message}`; |
import propTypes from 'prop-types'; | ||
import { requiredIf } from '../requiredIf'; | ||
import { requiredIf } from '../requiredIf.js'; | ||
@@ -4,0 +4,0 @@ const toWarning = message => `Warning: Failed prop type: ${message}`; |
export { arrayWithLength } from './arrayWithLength.js'; | ||
export { conditional } from './conditional'; | ||
export { conditional } from './conditional.js'; | ||
export { instanceOfComponent } from './instanceOfComponent.js'; | ||
export { mutuallyExclusive } from './mutuallyExclusive.js'; | ||
export { requiredIf } from './requiredIf.js'; |
@@ -0,1 +1,8 @@ | ||
# [3.1.0](https://github.com/dhis2/prop-types/compare/v3.0.0...v3.1.0) (2022-05-24) | ||
### Features | ||
* add deprecated prop decorator ([#286](https://github.com/dhis2/prop-types/issues/286)) ([cdeea37](https://github.com/dhis2/prop-types/commit/cdeea3787de1e9d145a71ed9a1875a58c09cee9c)) | ||
# [3.0.0](https://github.com/dhis2/prop-types/compare/v2.0.4...v3.0.0) (2021-09-30) | ||
@@ -2,0 +9,0 @@ |
@@ -12,3 +12,3 @@ import PropTypes from '@dhis2/prop-types' | ||
arr: PropTypes.arrayWithLength(1, 2, PropTypes.number), | ||
cond: PropTypes.conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
cond: PropTypes.conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
multiple: PropTypes.bool, | ||
@@ -19,3 +19,3 @@ success: statusProp, | ||
child: PropTypes.instanceOfComponent(Child), | ||
errorMsg: PropTypes.requiredIf(props => props.error, PropTypes.string), | ||
errorMsg: PropTypes.requiredIf((props) => props.error, PropTypes.string), | ||
} |
@@ -13,3 +13,3 @@ import { arrayWithLength, conditional, instanceOfComponent, mutuallyExclusive, requiredIf } from '@dhis2/prop-types' | ||
arr: arrayWithLength(1, 2, PropTypes.number), | ||
cond: conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
cond: conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
multiple: PropTypes.bool, | ||
@@ -20,3 +20,3 @@ success: statusProp, | ||
child: instanceOfComponent(Child), | ||
errorMsg: requiredIf(props => props.error, PropTypes.string), | ||
errorMsg: requiredIf((props) => props.error, PropTypes.string), | ||
} |
@@ -11,3 +11,3 @@ import PropTypes from '@dhis2/prop-types' | ||
arr: PropTypes.arrayWithLength(1, 2, PropTypes.number), | ||
cond: PropTypes.conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
cond: PropTypes.conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
multiple: PropTypes.bool, | ||
@@ -18,3 +18,3 @@ success: statusProp, | ||
child: PropTypes.instanceOfComponent(Child), | ||
errorMsg: PropTypes.requiredIf(props => props.error, PropTypes.string), | ||
errorMsg: PropTypes.requiredIf((props) => props.error, PropTypes.string), | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -12,3 +12,3 @@ import { arrayWithLength, conditional, instanceOfComponent, mutuallyExclusive, requiredIf } from '@dhis2/prop-types' | ||
arr: arrayWithLength(1, 2, PropTypes.number), | ||
cond: conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
cond: conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)), | ||
multiple: PropTypes.bool, | ||
@@ -19,3 +19,3 @@ success: statusProp, | ||
child: instanceOfComponent(Child), | ||
errorMsg: requiredIf(props => props.error, PropTypes.string), | ||
errorMsg: requiredIf((props) => props.error, PropTypes.string), | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -0,3 +1,3 @@ | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
import React from 'react' | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
@@ -4,0 +4,0 @@ const MyComponent = () => {} |
@@ -0,3 +1,3 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
@@ -4,0 +4,0 @@ const MyComponent = () => {} |
@@ -0,3 +1,3 @@ | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
import React from 'react' | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
@@ -4,0 +4,0 @@ const specialProp = shape({ |
@@ -0,3 +1,3 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
@@ -4,0 +4,0 @@ const specialProp = PropTypes.shape({ |
@@ -12,3 +12,3 @@ import PropTypes from '@dhis2/prop-types' | ||
arr: PropTypes.arrayWithLength(1, 2, PropTypes.number).isRequired, | ||
cond: PropTypes.conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
cond: PropTypes.conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
multiple: PropTypes.bool.isRequired, | ||
@@ -19,3 +19,3 @@ success: statusProp.isRequired, | ||
child: PropTypes.instanceOfComponent(Child).isRequired, | ||
errorMsg: PropTypes.requiredIf(props => props.error, PropTypes.string).isRequired, | ||
errorMsg: PropTypes.requiredIf((props) => props.error, PropTypes.string).isRequired, | ||
} |
@@ -13,3 +13,3 @@ import { arrayWithLength, conditional, instanceOfComponent, mutuallyExclusive, requiredIf } from '@dhis2/prop-types' | ||
arr: arrayWithLength(1, 2, PropTypes.number).isRequired, | ||
cond: conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
cond: conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
multiple: PropTypes.bool.isRequired, | ||
@@ -20,3 +20,3 @@ success: statusProp.isRequired, | ||
child: instanceOfComponent(Child).isRequired, | ||
errorMsg: requiredIf(props => props.error, PropTypes.string).isRequired, | ||
errorMsg: requiredIf((props) => props.error, PropTypes.string).isRequired, | ||
} |
@@ -11,3 +11,3 @@ import PropTypes from '@dhis2/prop-types' | ||
arr: PropTypes.arrayWithLength(1, 2, PropTypes.number).isRequired, | ||
cond: PropTypes.conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
cond: PropTypes.conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
multiple: PropTypes.bool.isRequired, | ||
@@ -18,3 +18,3 @@ success: statusProp, | ||
child: PropTypes.instanceOfComponent(Child).isRequired, | ||
errorMsg: PropTypes.requiredIf(props => props.error, PropTypes.string).isRequired, | ||
errorMsg: PropTypes.requiredIf((props) => props.error, PropTypes.string).isRequired, | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -12,3 +12,3 @@ import { arrayWithLength, conditional, instanceOfComponent, mutuallyExclusive, requiredIf } from '@dhis2/prop-types' | ||
arr: arrayWithLength(1, 2, PropTypes.number).isRequired, | ||
cond: conditional(props => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
cond: conditional((props) => (props.multiple ? PropTypes.arrayOf(PropTypes.number) : PropTypes.number)).isRequired, | ||
multiple: PropTypes.bool.isRequired, | ||
@@ -19,3 +19,3 @@ success: statusProp, | ||
child: instanceOfComponent(Child).isRequired, | ||
errorMsg: requiredIf(props => props.error, PropTypes.string).isRequired, | ||
errorMsg: requiredIf((props) => props.error, PropTypes.string).isRequired, | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -0,3 +1,3 @@ | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
import React from 'react' | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
@@ -4,0 +4,0 @@ const MyComponent = () => {} |
@@ -0,3 +1,3 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
@@ -4,0 +4,0 @@ const MyComponent = () => {} |
@@ -0,3 +1,3 @@ | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
import React from 'react' | ||
import { any, array, arrayOf, bool, element, elementType, exact, func, instanceOf, node, number, object, objectOf, oneOf, oneOfType, shape, string, symbol } from 'prop-types' | ||
@@ -4,0 +4,0 @@ const specialProp = shape({ |
@@ -0,3 +1,3 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
@@ -4,0 +4,0 @@ const specialProp = PropTypes.shape({ |
@@ -102,3 +102,3 @@ const PROP_TYPES_PACKAGE = 'prop-types' | ||
(acc, node) => { | ||
node.specifiers.forEach(specifierNode => { | ||
node.specifiers.forEach((specifierNode) => { | ||
if ( | ||
@@ -120,5 +120,5 @@ specifierNode.type === | ||
setPropTypeNames() { | ||
const matcherFn = node => | ||
const matcherFn = (node) => | ||
this.importedMemberNames.defaults.some( | ||
name => name === node.object.name | ||
(name) => name === node.object.name | ||
) | ||
@@ -133,3 +133,3 @@ const propTypesUsedFromDefaultImports = [ | ||
...this.getMemberExpressionsInGlobalScope().nodes(), | ||
].map(node => node.property.name) | ||
].map((node) => node.property.name) | ||
@@ -205,3 +205,3 @@ // Use a Set to dedupe | ||
.nodes() | ||
.findIndex(node => node.source.value > packageName) | ||
.findIndex((node) => node.source.value > packageName) | ||
@@ -236,3 +236,3 @@ this.j(imports.at(insertionIndex).get()).insertBefore(importString) | ||
getMemberExpressionsInGlobalScope() { | ||
return this.root.find(this.j.MemberExpression).filter(nodePath => { | ||
return this.root.find(this.j.MemberExpression).filter((nodePath) => { | ||
const { node, scope } = nodePath | ||
@@ -249,3 +249,3 @@ | ||
getIdentifiersInGlobalScope() { | ||
return this.root.find(this.j.Identifier).filter(nodePath => { | ||
return this.root.find(this.j.Identifier).filter((nodePath) => { | ||
const { node, scope, parentPath } = nodePath | ||
@@ -443,5 +443,4 @@ const isParentMemberExpression = | ||
argNode.elements.forEach((argNodeEl, argElIndex) => { | ||
argNode.elements[argElIndex] = this.transformNode( | ||
argNodeEl | ||
) | ||
argNode.elements[argElIndex] = | ||
this.transformNode(argNodeEl) | ||
}) | ||
@@ -456,7 +455,7 @@ } | ||
isImportedDefault(name) { | ||
return this.importedMemberNames.defaults.some(n => n === name) | ||
return this.importedMemberNames.defaults.some((n) => n === name) | ||
} | ||
isNamedImport(name) { | ||
return this.importedMemberNames.named.some(n => n === name) | ||
return this.importedMemberNames.named.some((n) => n === name) | ||
} | ||
@@ -463,0 +462,0 @@ |
{ | ||
"name": "@dhis2/prop-types", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"main": "./build/cjs/index.js", | ||
@@ -18,5 +18,8 @@ "module": "./build/es/index.js", | ||
"build": "d2-app-scripts build", | ||
"format": "yarn format:js && yarn format:text", | ||
"format:js": "d2-style check js", | ||
"format:text": "d2-style check text", | ||
"lint": "yarn lint:js && yarn lint:text", | ||
"lint:js": "d2-style js check", | ||
"lint:text": "d2-style text check" | ||
"lint:js": "d2-style check js", | ||
"lint:text": "d2-style check text" | ||
}, | ||
@@ -28,3 +31,3 @@ "peerDependencies": { | ||
"@dhis2/cli-app-scripts": "^7.6.6", | ||
"@dhis2/cli-style": "7.2.1", | ||
"@dhis2/cli-style": "^10.4.1", | ||
"jscodeshift": "^0.13.0", | ||
@@ -31,0 +34,0 @@ "jsdoc-to-markdown": "^6.0.1", |
@@ -58,3 +58,3 @@ # DHIS2 propTypes | ||
const LotsOfLists = props => <div {...props}>Does nothing</div> | ||
const LotsOfLists = (props) => <div {...props}>Does nothing</div> | ||
@@ -217,3 +217,3 @@ LotsOfLists.propTypes = { | ||
someBool: propTypes.bool, | ||
someString: requiredIf(props => props.someBool, propTypes.string), | ||
someString: requiredIf((props) => props.someBool, propTypes.string), | ||
} | ||
@@ -220,0 +220,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
127833
48
2691