DEV: enforces eslint’s curly rule to the codebase (#10720)

eslint --fix is capable of fix it automatically for you, ensure prettier is run after eslint as eslint --fix could leave the code in an invalid prettier state.
This commit is contained in:
Joffrey JAFFEUX
2020-09-22 16:28:28 +02:00
committed by GitHub
parent c86538097d
commit 530d9ab071
179 changed files with 1246 additions and 434 deletions

View File

@ -102,7 +102,9 @@ createWidget("discourse-poll-load-more", {
click() {
const { state } = this;
if (state.loading) return;
if (state.loading) {
return;
}
state.loading = true;
return this.sendWidgetAction("loadMore").finally(
@ -126,7 +128,9 @@ createWidget("discourse-poll-voters", {
fetchVoters() {
const { attrs, state } = this;
if (state.loaded === "loading") return;
if (state.loaded === "loading") {
return;
}
state.loaded = "loading";
return _fetchVoters({
@ -691,7 +695,9 @@ export default createWidget("discourse-poll", {
buildAttributes(attrs) {
let cssClasses = "poll";
if (attrs.poll.chart_type === PIE_CHART_TYPE) cssClasses += " pie";
if (attrs.poll.chart_type === PIE_CHART_TYPE) {
cssClasses += " pie";
}
return {
class: cssClasses,
"data-poll-name": attrs.poll.get("name"),
@ -900,9 +906,15 @@ export default createWidget("discourse-poll", {
toggleOption(option) {
const { attrs } = this;
if (this.isClosed()) return;
if (!this.currentUser) return this.showLogin();
if (!checkUserGroups(this.currentUser, this.attrs.poll)) return;
if (this.isClosed()) {
return;
}
if (!this.currentUser) {
return this.showLogin();
}
if (!checkUserGroups(this.currentUser, this.attrs.poll)) {
return;
}
const { vote } = attrs;
if (!this.isMultiple()) {
@ -916,8 +928,12 @@ export default createWidget("discourse-poll", {
},
castVotes() {
if (!this.canCastVotes()) return;
if (!this.currentUser) return this.showLogin();
if (!this.canCastVotes()) {
return;
}
if (!this.currentUser) {
return this.showLogin();
}
const { attrs, state } = this;