From 370c5ea711d6cead3a7ffb40deddbfc327eaaa8b Mon Sep 17 00:00:00 2001 From: Chris P Date: Mon, 15 Apr 2019 17:02:47 -0400 Subject: [PATCH] use `exact` instead of `shape` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `shape` doesn’t raise exceptions if an invalid key was supplied, but `exact` does. --- src/components/Checklist.react.js | 2 +- src/components/Dropdown.react.js | 2 +- src/components/Graph.react.js | 8 ++++---- src/components/RadioItems.react.js | 2 +- src/components/RangeSlider.react.js | 2 +- src/components/Slider.react.js | 2 +- src/components/Tabs.react.js | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/Checklist.react.js b/src/components/Checklist.react.js index 8b2c48de0..eaa759540 100644 --- a/src/components/Checklist.react.js +++ b/src/components/Checklist.react.js @@ -82,7 +82,7 @@ Checklist.propTypes = { * An array of options */ options: PropTypes.arrayOf( - PropTypes.shape({ + PropTypes.exact({ /** * The checkbox's label */ diff --git a/src/components/Dropdown.react.js b/src/components/Dropdown.react.js index 528e571c1..dfe530188 100644 --- a/src/components/Dropdown.react.js +++ b/src/components/Dropdown.react.js @@ -114,7 +114,7 @@ Dropdown.propTypes = { * An array of options */ options: PropTypes.arrayOf( - PropTypes.shape({ + PropTypes.exact({ /** * The dropdown's label */ diff --git a/src/components/Graph.react.js b/src/components/Graph.react.js index cbc95e3de..246958811 100644 --- a/src/components/Graph.react.js +++ b/src/components/Graph.react.js @@ -339,7 +339,7 @@ const graphPropTypes = { * `config` is set separately by the `config` property, * and `frames` is not supported. */ - figure: PropTypes.shape({ + figure: PropTypes.exact({ data: PropTypes.arrayOf(PropTypes.object), layout: PropTypes.object, }), @@ -371,7 +371,7 @@ const graphPropTypes = { * See https://plot.ly/javascript/configuration-options/ * for more info. */ - config: PropTypes.shape({ + config: PropTypes.exact({ /** * No interactivity, for export or image generation */ @@ -391,7 +391,7 @@ const graphPropTypes = { /** * A set of editable properties */ - edits: PropTypes.shape({ + edits: PropTypes.exact({ /** * annotationPosition: the main anchor of the annotation, which is the * text (if no arrow) or the arrow (which drags the whole thing leaving @@ -539,7 +539,7 @@ const graphPropTypes = { /** * Modifications to how the toImage modebar button works */ - toImageButtonOptions: PropTypes.shape({ + toImageButtonOptions: PropTypes.exact({ /** * The file format to create */ diff --git a/src/components/RadioItems.react.js b/src/components/RadioItems.react.js index 5ff147081..06c4df703 100644 --- a/src/components/RadioItems.react.js +++ b/src/components/RadioItems.react.js @@ -81,7 +81,7 @@ RadioItems.propTypes = { * An array of options */ options: PropTypes.arrayOf( - PropTypes.shape({ + PropTypes.exact({ /** * The radio item's label */ diff --git a/src/components/RangeSlider.react.js b/src/components/RangeSlider.react.js index bca8a1f7e..9afbedb3e 100644 --- a/src/components/RangeSlider.react.js +++ b/src/components/RangeSlider.react.js @@ -77,7 +77,7 @@ RangeSlider.propTypes = { marks: PropTypes.objectOf( PropTypes.oneOfType([ PropTypes.string, - PropTypes.shape({ + PropTypes.exact({ label: PropTypes.string, style: PropTypes.object, }), diff --git a/src/components/Slider.react.js b/src/components/Slider.react.js index 5b21019ca..f644fd860 100644 --- a/src/components/Slider.react.js +++ b/src/components/Slider.react.js @@ -77,7 +77,7 @@ Slider.propTypes = { marks: PropTypes.objectOf( PropTypes.oneOfType([ PropTypes.string, - PropTypes.shape({ + PropTypes.exact({ label: PropTypes.string, style: PropTypes.object, }), diff --git a/src/components/Tabs.react.js b/src/components/Tabs.react.js index 252a2bc73..439ce8322 100644 --- a/src/components/Tabs.react.js +++ b/src/components/Tabs.react.js @@ -416,7 +416,7 @@ Tabs.propTypes = { * background: '#f9f9f9' * } */ - colors: PropTypes.shape({ + colors: PropTypes.exact({ border: PropTypes.string, primary: PropTypes.string, background: PropTypes.string,