Skip to content

Commit

Permalink
fix: enable eslint rule brace style (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbadan committed Jan 14, 2019
1 parent 172d672 commit 7ca2a47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins:
- react

rules:
#brace-style: 2
brace-style: 2
camelcase: 2
comma-dangle: [2, 'never']
comma-spacing: 2
Expand Down
36 changes: 12 additions & 24 deletions src/Calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,18 @@ 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});
}
//If date was not clicked then the date is reset
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});
}
Expand Down Expand Up @@ -164,8 +161,7 @@ export class Calendar extends Component {
}, function() {
this.returnDateSelected(date);
});
}
else {
} else {
this.setState({
currentDateDisplayed: date,
dateClick: true
Expand All @@ -184,8 +180,7 @@ export class Calendar extends Component {
}, function() {
this.returnDateSelected(date);
});
}
else {
} else {
this.setState({
currentDateDisplayed: date,
dateClick: true
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
}
}
Expand All @@ -300,8 +290,7 @@ export class Calendar extends Component {
}, function() {
if (isRangeEnabled) {
this.returnDateSelected(selectedDates);
}
else {
} else {
this.returnDateSelected(day);
}
});
Expand Down Expand Up @@ -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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/documentation/Playground/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 7ca2a47

Please sign in to comment.