Skip to content

Instantly share code, notes, and snippets.

@lencioni
Created August 22, 2018 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lencioni/1b436d365570394ccde659c829ba02c3 to your computer and use it in GitHub Desktop.
Save lencioni/1b436d365570394ccde659c829ba02c3 to your computer and use it in GitHub Desktop.
react-dates propTypes removal diff
diff -bur esm-before/components/CalendarDay.js esm/components/CalendarDay.js
--- esm-before/components/CalendarDay.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/CalendarDay.js 2018-08-22 15:22:02.000000000 -0700
@@ -25,7 +25,7 @@
import { DAY_SIZE } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
day: momentPropTypes.momentObj,
daySize: nonNegativeInteger,
isOutsideDay: PropTypes.bool,
@@ -40,7 +40,7 @@
// internationalization
phrases: PropTypes.shape(getPhrasePropTypes(CalendarDayPhrases))
-}));
+})) : {};;
var defaultProps = {
day: moment(),
@@ -254,7 +254,7 @@
return CalendarDay;
}(React.Component);
-CalendarDay.propTypes = propTypes;
+CalendarDay.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
CalendarDay.defaultProps = defaultProps;
export { CalendarDay as PureCalendarDay };
diff -bur esm-before/components/CalendarMonth.js esm/components/CalendarMonth.js
--- esm-before/components/CalendarMonth.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/CalendarMonth.js 2018-08-22 15:22:03.000000000 -0700
@@ -37,7 +37,7 @@
import { HORIZONTAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
month: momentPropTypes.momentObj,
horizontalMonthPadding: nonNegativeInteger,
isVisible: PropTypes.bool,
@@ -65,7 +65,7 @@
monthFormat: PropTypes.string,
phrases: PropTypes.shape(getPhrasePropTypes(CalendarDayPhrases)),
dayAriaLabelFormat: PropTypes.string
-}));
+})) : {};;
var defaultProps = {
month: moment(),
@@ -306,7 +306,7 @@
return CalendarMonth;
}(React.Component);
-CalendarMonth.propTypes = propTypes;
+CalendarMonth.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
CalendarMonth.defaultProps = defaultProps;
export default withStyles(function (_ref) {
diff -bur esm-before/components/CalendarMonthGrid.js esm/components/CalendarMonthGrid.js
--- esm-before/components/CalendarMonthGrid.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/CalendarMonthGrid.js 2018-08-22 15:22:03.000000000 -0700
@@ -37,7 +37,7 @@
import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
enableOutsideDays: PropTypes.bool,
firstVisibleMonthIndex: PropTypes.number,
horizontalMonthPadding: nonNegativeInteger,
@@ -70,7 +70,7 @@
monthFormat: PropTypes.string,
phrases: PropTypes.shape(getPhrasePropTypes(CalendarDayPhrases)),
dayAriaLabelFormat: PropTypes.string
-}));
+})) : {};;
var defaultProps = {
enableOutsideDays: false,
@@ -443,7 +443,7 @@
return CalendarMonthGrid;
}(React.Component);
-CalendarMonthGrid.propTypes = propTypes;
+CalendarMonthGrid.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
CalendarMonthGrid.defaultProps = defaultProps;
export default withStyles(function (_ref) {
diff -bur esm-before/components/CalendarWeek.js esm/components/CalendarWeek.js
--- esm-before/components/CalendarWeek.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/CalendarWeek.js 2018-08-22 15:22:03.000000000 -0700
@@ -4,9 +4,9 @@
import CalendarDay from './CalendarDay';
import CustomizableCalendarDay from './CustomizableCalendarDay';
-var propTypes = forbidExtraProps({
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps({
children: or([childrenOfType(CalendarDay), childrenOfType(CustomizableCalendarDay)]).isRequired
-});
+}) : {};;
export default function CalendarWeek(_ref) {
var children = _ref.children;
@@ -18,4 +18,4 @@
);
}
-CalendarWeek.propTypes = propTypes;
\ No newline at end of file
+CalendarWeek.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
\ No newline at end of file
diff -bur esm-before/components/CustomizableCalendarDay.js esm/components/CustomizableCalendarDay.js
--- esm-before/components/CustomizableCalendarDay.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/CustomizableCalendarDay.js 2018-08-22 15:22:03.000000000 -0700
@@ -40,7 +40,7 @@
return stylesObj;
}
-var DayStyleShape = PropTypes.shape({
+var DayStyleShape = process.env.NODE_ENV !== "production" ? PropTypes.shape({
background: PropTypes.string,
border: or([PropTypes.string, PropTypes.number]),
color: PropTypes.string,
@@ -50,9 +50,9 @@
border: or([PropTypes.string, PropTypes.number]),
color: PropTypes.string
})
-});
+}) : {};;
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
day: momentPropTypes.momentObj,
daySize: nonNegativeInteger,
isOutsideDay: PropTypes.bool,
@@ -85,7 +85,7 @@
// internationalization
phrases: PropTypes.shape(getPhrasePropTypes(CalendarDayPhrases))
-}));
+})) : {};;
export var defaultStyles = {
border: '1px solid ' + String(color.core.borderLight),
@@ -443,7 +443,7 @@
return CustomizableCalendarDay;
}(React.Component);
-CustomizableCalendarDay.propTypes = propTypes;
+CustomizableCalendarDay.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
CustomizableCalendarDay.defaultProps = defaultProps;
export { CustomizableCalendarDay as PureCustomizableCalendarDay };
diff -bur esm-before/components/DateInput.js esm/components/DateInput.js
--- esm-before/components/DateInput.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DateInput.js 2018-08-22 15:22:03.000000000 -0700
@@ -26,7 +26,7 @@
var FANG_PATH_BOTTOM = 'M0,0 ' + String(FANG_WIDTH_PX) + ',0 ' + FANG_WIDTH_PX / 2 + ',' + String(FANG_HEIGHT_PX) + 'z';
var FANG_STROKE_BOTTOM = 'M0,0 ' + FANG_WIDTH_PX / 2 + ',' + String(FANG_HEIGHT_PX) + ' ' + String(FANG_WIDTH_PX) + ',0';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
id: PropTypes.string.isRequired,
placeholder: PropTypes.string, // also used as label
displayValue: PropTypes.string,
@@ -52,7 +52,7 @@
// accessibility
isFocused: PropTypes.bool // describes actual DOM focus
-}));
+})) : {};;
var defaultProps = {
placeholder: 'Select Date',
@@ -325,7 +325,7 @@
return DateInput;
}(React.Component);
-DateInput.propTypes = propTypes;
+DateInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DateInput.defaultProps = defaultProps;
export default withStyles(function (_ref) {
diff -bur esm-before/components/DateRangePicker.js esm/components/DateRangePicker.js
--- esm-before/components/DateRangePicker.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DateRangePicker.js 2018-08-22 15:22:03.000000000 -0700
@@ -35,7 +35,7 @@
import { START_DATE, END_DATE, HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, ANCHOR_LEFT, ANCHOR_RIGHT, OPEN_DOWN, OPEN_UP, DAY_SIZE, ICON_BEFORE_POSITION, INFO_POSITION_BOTTOM, FANG_HEIGHT_PX, DEFAULT_VERTICAL_SPACING } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, DateRangePickerShape));
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, DateRangePickerShape)) : {};;
var defaultProps = {
// required props for a functional interactive DateRangePicker
@@ -694,7 +694,7 @@
return DateRangePicker;
}(React.Component);
-DateRangePicker.propTypes = propTypes;
+DateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DateRangePicker.defaultProps = defaultProps;
export { DateRangePicker as PureDateRangePicker };
diff -bur esm-before/components/DateRangePickerInput.js esm/components/DateRangePickerInput.js
--- esm-before/components/DateRangePickerInput.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DateRangePickerInput.js 2018-08-22 15:22:03.000000000 -0700
@@ -21,7 +21,7 @@
import { START_DATE, END_DATE, ICON_BEFORE_POSITION, ICON_AFTER_POSITION, OPEN_DOWN } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
startDateId: PropTypes.string,
startDatePlaceholderText: PropTypes.string,
screenReaderMessage: PropTypes.string,
@@ -68,7 +68,7 @@
phrases: PropTypes.shape(getPhrasePropTypes(DateRangePickerInputPhrases)),
isRTL: PropTypes.bool
-}));
+})) : {};;
var defaultProps = {
startDateId: START_DATE,
@@ -284,7 +284,7 @@
);
}
-DateRangePickerInput.propTypes = propTypes;
+DateRangePickerInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DateRangePickerInput.defaultProps = defaultProps;
export default withStyles(function (_ref2) {
diff -bur esm-before/components/DateRangePickerInputController.js esm/components/DateRangePickerInputController.js
--- esm-before/components/DateRangePickerInputController.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DateRangePickerInputController.js 2018-08-22 15:22:03.000000000 -0700
@@ -30,7 +30,7 @@
import { START_DATE, END_DATE, ICON_BEFORE_POSITION, OPEN_DOWN } from '../constants';
-var propTypes = forbidExtraProps({
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps({
startDate: momentPropTypes.momentObj,
startDateId: PropTypes.string,
startDatePlaceholderText: PropTypes.string,
@@ -80,7 +80,7 @@
phrases: PropTypes.shape(getPhrasePropTypes(DateRangePickerInputPhrases)),
isRTL: PropTypes.bool
-});
+}) : {};;
var defaultProps = {
startDate: null,
@@ -433,5 +433,5 @@
export default DateRangePickerInputController;
-DateRangePickerInputController.propTypes = propTypes;
+DateRangePickerInputController.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DateRangePickerInputController.defaultProps = defaultProps;
\ No newline at end of file
diff -bur esm-before/components/DayPicker.js esm/components/DayPicker.js
--- esm-before/components/DayPicker.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DayPicker.js 2018-08-22 15:22:04.000000000 -0700
@@ -49,7 +49,7 @@
var MONTH_SELECTION_TRANSITION = 'month_selection';
var YEAR_SELECTION_TRANSITION = 'year_selection';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
// calendar presentation props
enableOutsideDays: PropTypes.bool,
@@ -104,7 +104,7 @@
weekDayFormat: PropTypes.string,
phrases: PropTypes.shape(getPhrasePropTypes(DayPickerPhrases)),
dayAriaLabelFormat: PropTypes.string
-}));
+})) : {};;
export var defaultProps = {
// calendar presentation props
@@ -1370,7 +1370,7 @@
return DayPicker;
}(React.Component);
-DayPicker.propTypes = propTypes;
+DayPicker.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DayPicker.defaultProps = defaultProps;
export { DayPicker as PureDayPicker };
diff -bur esm-before/components/DayPickerKeyboardShortcuts.js esm/components/DayPickerKeyboardShortcuts.js
--- esm-before/components/DayPickerKeyboardShortcuts.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DayPickerKeyboardShortcuts.js 2018-08-22 15:22:04.000000000 -0700
@@ -25,14 +25,14 @@
export var TOP_RIGHT = 'top-right';
export var BOTTOM_RIGHT = 'bottom-right';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
block: PropTypes.bool,
buttonLocation: PropTypes.oneOf([TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT]),
showKeyboardShortcutsPanel: PropTypes.bool,
openKeyboardShortcutsPanel: PropTypes.func,
closeKeyboardShortcutsPanel: PropTypes.func,
phrases: PropTypes.shape(getPhrasePropTypes(DayPickerKeyboardShortcutsPhrases))
-}));
+})) : {};;
var defaultProps = {
block: false,
@@ -337,7 +337,7 @@
return DayPickerKeyboardShortcuts;
}(React.Component);
-DayPickerKeyboardShortcuts.propTypes = propTypes;
+DayPickerKeyboardShortcuts.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DayPickerKeyboardShortcuts.defaultProps = defaultProps;
export default withStyles(function (_ref3) {
diff -bur esm-before/components/DayPickerNavigation.js esm/components/DayPickerNavigation.js
--- esm-before/components/DayPickerNavigation.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DayPickerNavigation.js 2018-08-22 15:22:04.000000000 -0700
@@ -20,7 +20,7 @@
import { HORIZONTAL_ORIENTATION, VERTICAL_SCROLLABLE } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
navPrev: PropTypes.node,
navNext: PropTypes.node,
orientation: ScrollableOrientationShape,
@@ -32,7 +32,7 @@
phrases: PropTypes.shape(getPhrasePropTypes(DayPickerNavigationPhrases)),
isRTL: PropTypes.bool
-}));
+})) : {};;
var defaultProps = {
navPrev: null,
@@ -154,7 +154,7 @@
);
}
-DayPickerNavigation.propTypes = propTypes;
+DayPickerNavigation.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DayPickerNavigation.defaultProps = defaultProps;
export default withStyles(function (_ref2) {
diff -bur esm-before/components/DayPickerRangeController.js esm/components/DayPickerRangeController.js
--- esm-before/components/DayPickerRangeController.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DayPickerRangeController.js 2018-08-22 15:22:04.000000000 -0700
@@ -47,7 +47,7 @@
import DayPicker from './DayPicker';
-var propTypes = forbidExtraProps({
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps({
startDate: momentPropTypes.momentObj,
endDate: momentPropTypes.momentObj,
onDatesChange: PropTypes.func,
@@ -106,7 +106,7 @@
dayAriaLabelFormat: PropTypes.string,
isRTL: PropTypes.bool
-});
+}) : {};;
var defaultProps = {
startDate: undefined, // TODO: use null
@@ -1428,5 +1428,5 @@
export default DayPickerRangeController;
-DayPickerRangeController.propTypes = propTypes;
+DayPickerRangeController.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DayPickerRangeController.defaultProps = defaultProps;
\ No newline at end of file
diff -bur esm-before/components/DayPickerSingleDateController.js esm/components/DayPickerSingleDateController.js
--- esm-before/components/DayPickerSingleDateController.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/DayPickerSingleDateController.js 2018-08-22 15:22:04.000000000 -0700
@@ -40,7 +40,7 @@
import DayPicker from './DayPicker';
-var propTypes = forbidExtraProps({
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps({
date: momentPropTypes.momentObj,
onDateChange: PropTypes.func,
@@ -93,7 +93,7 @@
dayAriaLabelFormat: PropTypes.string,
isRTL: PropTypes.bool
-});
+}) : {};;
var defaultProps = {
date: undefined, // TODO: use null
@@ -982,5 +982,5 @@
export default DayPickerSingleDateController;
-DayPickerSingleDateController.propTypes = propTypes;
+DayPickerSingleDateController.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DayPickerSingleDateController.defaultProps = defaultProps;
\ No newline at end of file
diff -bur esm-before/components/KeyboardShortcutRow.js esm/components/KeyboardShortcutRow.js
--- esm-before/components/KeyboardShortcutRow.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/KeyboardShortcutRow.js 2018-08-22 15:22:04.000000000 -0700
@@ -6,12 +6,12 @@
import { forbidExtraProps } from 'airbnb-prop-types';
import { css, withStyles, withStylesPropTypes } from 'react-with-styles';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
unicode: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
action: PropTypes.string.isRequired,
block: PropTypes.bool
-}));
+})) : {};;
var defaultProps = {
block: false
@@ -47,7 +47,7 @@
);
}
-KeyboardShortcutRow.propTypes = propTypes;
+KeyboardShortcutRow.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
KeyboardShortcutRow.defaultProps = defaultProps;
export default withStyles(function (_ref2) {
diff -bur esm-before/components/SingleDatePicker.js esm/components/SingleDatePicker.js
--- esm-before/components/SingleDatePicker.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/SingleDatePicker.js 2018-08-22 15:22:05.000000000 -0700
@@ -36,7 +36,7 @@
import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, ANCHOR_LEFT, ANCHOR_RIGHT, OPEN_DOWN, OPEN_UP, DAY_SIZE, ICON_BEFORE_POSITION, INFO_POSITION_BOTTOM, FANG_HEIGHT_PX, DEFAULT_VERTICAL_SPACING } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, SingleDatePickerShape));
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, SingleDatePickerShape)) : {};;
var defaultProps = {
// required props for a functional interactive SingleDatePicker
@@ -728,7 +728,7 @@
return SingleDatePicker;
}(React.Component);
-SingleDatePicker.propTypes = propTypes;
+SingleDatePicker.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
SingleDatePicker.defaultProps = defaultProps;
export { SingleDatePicker as PureSingleDatePicker };
diff -bur esm-before/components/SingleDatePickerInput.js esm/components/SingleDatePickerInput.js
--- esm-before/components/SingleDatePickerInput.js 2018-08-22 15:21:46.000000000 -0700
+++ esm/components/SingleDatePickerInput.js 2018-08-22 15:22:05.000000000 -0700
@@ -18,7 +18,7 @@
import openDirectionShape from '../shapes/OpenDirectionShape';
import { ICON_BEFORE_POSITION, ICON_AFTER_POSITION, OPEN_DOWN } from '../constants';
-var propTypes = forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
+var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectAssign({}, withStylesPropTypes, {
id: PropTypes.string.isRequired,
placeholder: PropTypes.string, // also used as label
displayValue: PropTypes.string,
@@ -52,7 +52,7 @@
// i18n
phrases: PropTypes.shape(getPhrasePropTypes(SingleDatePickerInputPhrases))
-}));
+})) : {};;
var defaultProps = {
placeholder: 'Select Date',
@@ -211,7 +211,7 @@
);
}
-SingleDatePickerInput.propTypes = propTypes;
+SingleDatePickerInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
SingleDatePickerInput.defaultProps = defaultProps;
export default withStyles(function (_ref2) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment