From 7ca2a47033f5894c23b128e41ff59dbdee3cf94c Mon Sep 17 00:00:00 2001 From: Jenna Badanowski <29607818+jbadan@users.noreply.github.com> Date: Mon, 14 Jan 2019 13:25:43 -0800 Subject: [PATCH] fix: enable eslint rule brace style (#180) --- .eslintrc | 2 +- src/Calendar/Calendar.js | 36 ++++++++-------------- src/documentation/Playground/Playground.js | 3 +- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/.eslintrc b/.eslintrc index bca85003c..83c2fcb53 100644 --- a/.eslintrc +++ b/.eslintrc @@ -18,7 +18,7 @@ plugins: - react rules: - #brace-style: 2 + brace-style: 2 camelcase: 2 comma-dangle: [2, 'never'] comma-spacing: 2 diff --git a/src/Calendar/Calendar.js b/src/Calendar/Calendar.js index c0262a0be..f52458700 100644 --- a/src/Calendar/Calendar.js +++ b/src/Calendar/Calendar.js @@ -72,12 +72,10 @@ export class Calendar extends Component { //updates the calendar if the date from date picker is correct return ({arrSelectedDates: updatedPropsParent.customDate, selectedDate: new Date(0, 0, 0)}); } - } - else if (updatedPropsParent.customDate !== previousStates.currentDateDisplayed) { + } else if (updatedPropsParent.customDate !== previousStates.currentDateDisplayed) { if (updatedPropsParent.customDate === undefined || updatedPropsParent.customDate === '') { return null; - } - else if (updatedPropsParent.customDate === 'undefined') { + } else if (updatedPropsParent.customDate === 'undefined') { if (previousStates.selectedDate.getFullYear() !== 1899 && previousStates.dateClick) { return ({dateClick: false}); } @@ -85,8 +83,7 @@ export class Calendar extends Component { if (!previousStates.dateClick) { return ({currentDateDisplayed: new Date(), selectedDate: new Date(0, 0, 0)}); } - } - else { + } else { //Updates the calendar if the date from date picker is correct return ({currentDateDisplayed: updatedPropsParent.customDate, selectedDate: updatedPropsParent.customDate, dateClick: false}); } @@ -164,8 +161,7 @@ export class Calendar extends Component { }, function() { this.returnDateSelected(date); }); - } - else { + } else { this.setState({ currentDateDisplayed: date, dateClick: true @@ -184,8 +180,7 @@ export class Calendar extends Component { }, function() { this.returnDateSelected(date); }); - } - else { + } else { this.setState({ currentDateDisplayed: date, dateClick: true @@ -199,8 +194,7 @@ export class Calendar extends Component { let shortenedNameMonth = ''; if (element.length > 3) { shortenedNameMonth = element.substring(0, 3) + '.'; - } - else { + } else { shortenedNameMonth = element.substring(0, 3); } @@ -244,8 +238,7 @@ export class Calendar extends Component { let copyDate = this.state.currentYear; copyDate.setFullYear(copyDate.getFullYear() + 12); this.setState({currentYear: copyDate, dateClick: true}); - } - else { + } else { let copyDate = this.state.currentDateDisplayed; let selectedDate = new Date(this.state.selectedDate.getFullYear(), this.state.selectedDate.getMonth(), this.state.selectedDate.getDate(), 0, 0, 0, 0); copyDate.setMonth(copyDate.getMonth() + 1); @@ -261,8 +254,7 @@ export class Calendar extends Component { let copyDate = this.state.currentYear; copyDate.setFullYear(copyDate.getFullYear() - 12); this.setState({currentYear: copyDate, dateClick: true}); - } - else { + } else { let copyDate = this.state.currentDateDisplayed; let selectedDate = new Date(this.state.selectedDate.getFullYear(), this.state.selectedDate.getMonth(), this.state.selectedDate.getDate(), 0, 0, 0, 0); copyDate.setMonth(copyDate.getMonth() - 1); @@ -281,14 +273,12 @@ export class Calendar extends Component { if (selectedDates.length === 2) { selectedDates = []; selectedDates.push(day); - } - else if (selectedDates[0] !== undefined && day.getTime() <= selectedDates[0].getTime()) { + } else if (selectedDates[0] !== undefined && day.getTime() <= selectedDates[0].getTime()) { let newArr = []; newArr.push(day); newArr.push(selectedDates[0]); selectedDates = newArr; - } - else { + } else { selectedDates.push(day); } } @@ -300,8 +290,7 @@ export class Calendar extends Component { }, function() { if (isRangeEnabled) { this.returnDateSelected(selectedDates); - } - else { + } else { this.returnDateSelected(day); } }); @@ -415,8 +404,7 @@ export class Calendar extends Component { if (this.props.onChange !== undefined) { if (this.props.enableRangeSelection === true) { this.props.onChange(dates); - } - else { + } else { this.props.onChange(dates); } } diff --git a/src/documentation/Playground/Playground.js b/src/documentation/Playground/Playground.js index cb29d48be..c47db5cf3 100644 --- a/src/documentation/Playground/Playground.js +++ b/src/documentation/Playground/Playground.js @@ -40,9 +40,8 @@ export class Playground extends Component { this.setState({ childs: childsProperties }); - } //Used for badge and label. - else if (event.target.name === 'component') { + } else if (event.target.name === 'component') { let childsProperties = Object.assign({}, this.state.childs); childsProperties[event.target.name] = event.target.value; this.setState({