Skip to content

Commit

Permalink
Merge pull request #3008 from Hacker0x01/prettier-2
Browse files Browse the repository at this point in the history
Run prettier all on JS
  • Loading branch information
martijnrusschen authored May 29, 2021
2 parents dfac0f0 + d00376b commit 18302eb
Show file tree
Hide file tree
Showing 112 changed files with 532 additions and 470 deletions.
4 changes: 2 additions & 2 deletions .babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const { NODE_ENV } = process.env;
const presets = [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-flow"
"@babel/preset-flow",
];
const plugins = [
"@babel/plugin-transform-react-jsx",
"@babel/plugin-proposal-class-properties"
"@babel/plugin-proposal-class-properties",
];

if (NODE_ENV === "production") {
Expand Down
6 changes: 3 additions & 3 deletions docs-site/src/components/Example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
import DatePicker, {
registerLocale,
CalendarContainer
CalendarContainer,
} from "react-datepicker";
import * as DateFNS from "date-fns/esm";
import fi from "date-fns/locale/fi";
Expand All @@ -16,7 +16,7 @@ import editIcon from "./edit-regular.svg";

export default class CodeExampleComponent extends React.Component {
static propTypes = {
example: PropTypes.object.isRequired
example: PropTypes.object.isRequired,
};
componentDidMount() {
registerLocale("fi", fi);
Expand Down Expand Up @@ -45,7 +45,7 @@ export default class CodeExampleComponent extends React.Component {
...DateFNS,
range,
fi,
forwardRef
forwardRef,
}}
theme={prismGitHubTheme}
>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/calendarContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
calendarContainer={MyContainer}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/children.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
() => {
const [startDate, setStartDate] = useState(new Date());
return (
<DatePicker selected={startDate} onChange={date => setStartDate(date)}>
<DatePicker selected={startDate} onChange={(date) => setStartDate(date)}>
<div style={{ color: "red" }}>Don't forget to check the weather!</div>
</DatePicker>
);
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/clearInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
isClearable
placeholderText="I have been cleared!"
/>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/closeOnScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<DatePicker
closeOnScroll={true}
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
/>
);
};
4 changes: 2 additions & 2 deletions docs-site/src/examples/closeOnScrollCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
const [startDate, setStartDate] = useState(new Date());
return (
<DatePicker
closeOnScroll={e => e.target === document}
closeOnScroll={(e) => e.target === document}
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
/>
);
};
2 changes: 1 addition & 1 deletion docs-site/src/examples/customCalendarClassName.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
calendarClassName="rasta-stripes"
/>
);
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/customClassName.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
className="red-border"
/>
);
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/customDateFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<DatePicker
dateFormat="yyyy/MM/dd"
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
/>
);
};
4 changes: 2 additions & 2 deletions docs-site/src/examples/customDayClassName.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
dayClassName={date =>
onChange={(date) => setStartDate(date)}
dayClassName={(date) =>
getDate(date) < Math.random() * 31 ? "random" : undefined
}
/>
Expand Down
14 changes: 6 additions & 8 deletions docs-site/src/examples/customInput.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
() => {
const [startDate, setStartDate] = useState(new Date());
const ExampleCustomInput = forwardRef(
({ value, onClick }, ref) => (
<button className="example-custom-input" onClick={onClick} ref={ref}>
{value}
</button>
),
);
const ExampleCustomInput = forwardRef(({ value, onClick }, ref) => (
<button className="example-custom-input" onClick={onClick} ref={ref}>
{value}
</button>
));
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
customInput={<ExampleCustomInput />}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/customTimeClassName.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
() => {
const [startDate, setStartDate] = useState(new Date());

let handleColor = time => {
let handleColor = (time) => {
return time.getHours() > 12 ? "text-success" : "text-error";
};

return (
<DatePicker
showTimeSelect
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
timeClassName={handleColor}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/customTimeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
const ExampleCustomTimeInput = ({ date, value, onChange }) => (
<input
value={value}
onChange={e => onChange(e.target.value)}
onChange={(e) => onChange(e.target.value)}
style={{ border: "solid 1px pink" }}
/>
);
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
showTimeInput
customTimeInput={<ExampleCustomTimeInput />}
/>
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/dateRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<>
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
selectsStart
startDate={startDate}
endDate={endDate}
/>
<DatePicker
selected={endDate}
onChange={date => setEndDate(date)}
onChange={(date) => setEndDate(date)}
selectsEnd
startDate={startDate}
endDate={endDate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
minDate={new Date()}
maxDate={addMonths(new Date(), 5)}
showDisabledMonthNavigation
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/default.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
() => {
const [startDate, setStartDate] = useState(new Date());
return (
<DatePicker selected={startDate} onChange={date => setStartDate(date)} />
<DatePicker selected={startDate} onChange={(date) => setStartDate(date)} />
);
};
2 changes: 1 addition & 1 deletion docs-site/src/examples/disabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
disabled
placeholderText="This is disabled"
/>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/disabledKeyboardNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
disabledKeyboardNavigation
placeholderText="This has disabled keyboard navigation"
/>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/dontCloseOnSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
shouldCloseOnSelect={false}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/excludeDates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
excludeDates={[new Date(), subDays(new Date(), 1)]}
placeholderText="Select a date other than today or yesterday"
/>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/excludeTimePeriod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
showTimeSelect
minTime={setHours(setMinutes(new Date(), 0), 17)}
maxTime={setHours(setMinutes(new Date(), 30), 20)}
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/excludeTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
showTimeSelect
excludeTimes={[
setHours(setMinutes(new Date(), 0), 17),
setHours(setMinutes(new Date(), 30), 18),
setHours(setMinutes(new Date(), 30), 19),
setHours(setMinutes(new Date(), 30), 17)
setHours(setMinutes(new Date(), 30), 17),
]}
dateFormat="MMMM d, yyyy h:mm aa"
/>
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/filterDates.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
() => {
const [startDate, setStartDate] = useState(null);
const isWeekday = date => {
const isWeekday = (date) => {
const day = getDay(date);
return day !== 0 && day !== 6;
};
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
filterDate={isWeekday}
placeholderText="Select a weekday"
/>
Expand Down
6 changes: 3 additions & 3 deletions docs-site/src/examples/filterTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
const [startDate, setStartDate] = useState(
setHours(setMinutes(new Date(), 0), 9)
);
const filterPassedTime = time => {
const filterPassedTime = (time) => {
const currentDate = new Date();
const selectedDate = new Date(time);

return currentDate.getTime() < selectedDate.getTime();
}
};
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
showTimeSelect
filterTime={filterPassedTime}
dateFormat="MMMM d, yyyy h:mm aa"
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/fixedCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
fixedHeight
/>
);
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/highlightDates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
highlightDates={[subDays(new Date(), 7), addDays(new Date(), 7)]}
placeholderText="This highlights a week ago and a week from today"
/>
Expand Down
12 changes: 6 additions & 6 deletions docs-site/src/examples/highlightDatesRanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
subDays(new Date(), 4),
subDays(new Date(), 3),
subDays(new Date(), 2),
subDays(new Date(), 1)
]
subDays(new Date(), 1),
],
},
{
"react-datepicker__day--highlighted-custom-2": [
addDays(new Date(), 1),
addDays(new Date(), 2),
addDays(new Date(), 3),
addDays(new Date(), 4)
]
}
addDays(new Date(), 4),
],
},
];
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
highlightDates={highlightWithRanges}
placeholderText="This highlight two ranges with custom classes"
/>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/includeDates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
includeDates={[new Date(), addDays(new Date(), 1)]}
placeholderText="This only includes today and tomorrow"
/>
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/includeTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
return (
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
onChange={(date) => setStartDate(date)}
showTimeSelect
includeTimes={[
setHours(setMinutes(new Date(), 0), 17),
setHours(setMinutes(new Date(), 30), 18),
setHours(setMinutes(new Date(), 30), 19),
setHours(setMinutes(new Date(), 30), 17)
setHours(setMinutes(new Date(), 30), 17),
]}
dateFormat="MMMM d, yyyy h:mm aa"
/>
Expand Down
Loading

0 comments on commit 18302eb

Please sign in to comment.