Skip to content

Commit 05b8fb7

Browse files
hiroppyevilebottnawi
authored andcommitted
style: add curly rule to eslint (#1761)
1 parent dcd2434 commit 05b8fb7

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"sourceType": "script"
99
},
1010
"rules": {
11+
"curly": "error",
1112
"consistent-return": "off",
1213
"no-param-reassign": "off",
1314
"no-underscore-dangle": "off",

client-src/default/index.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,19 @@ const onSocketMsg = {
8686
invalid() {
8787
log.info('[WDS] App updated. Recompiling...');
8888
// fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
89-
if (useWarningOverlay || useErrorOverlay) overlay.clear();
89+
if (useWarningOverlay || useErrorOverlay) {
90+
overlay.clear();
91+
}
9092
sendMsg('Invalid');
9193
},
9294
hash(hash) {
9395
currentHash = hash;
9496
},
9597
'still-ok': function stillOk() {
9698
log.info('[WDS] Nothing changed.');
97-
if (useWarningOverlay || useErrorOverlay) overlay.clear();
99+
if (useWarningOverlay || useErrorOverlay) {
100+
overlay.clear();
101+
}
98102
sendMsg('StillOk');
99103
},
100104
'log-level': function logLevel(level) {
@@ -135,13 +139,19 @@ const onSocketMsg = {
135139
}
136140
},
137141
'progress-update': function progressUpdate(data) {
138-
if (useProgress) log.info(`[WDS] ${data.percent}% - ${data.msg}.`);
142+
if (useProgress) {
143+
log.info(`[WDS] ${data.percent}% - ${data.msg}.`);
144+
}
139145
sendMsg('Progress', data);
140146
},
141147
ok() {
142148
sendMsg('Ok');
143-
if (useWarningOverlay || useErrorOverlay) overlay.clear();
144-
if (initial) return (initial = false); // eslint-disable-line no-return-assign
149+
if (useWarningOverlay || useErrorOverlay) {
150+
overlay.clear();
151+
}
152+
if (initial) {
153+
return (initial = false);
154+
} // eslint-disable-line no-return-assign
145155
reloadApp();
146156
},
147157
'content-changed': function contentChanged() {
@@ -155,9 +165,13 @@ const onSocketMsg = {
155165
for (let i = 0; i < strippedWarnings.length; i++) {
156166
log.warn(strippedWarnings[i]);
157167
}
158-
if (useWarningOverlay) overlay.showMessage(warnings);
168+
if (useWarningOverlay) {
169+
overlay.showMessage(warnings);
170+
}
159171

160-
if (initial) return (initial = false); // eslint-disable-line no-return-assign
172+
if (initial) {
173+
return (initial = false);
174+
} // eslint-disable-line no-return-assign
161175
reloadApp();
162176
},
163177
errors(errors) {
@@ -167,7 +181,9 @@ const onSocketMsg = {
167181
for (let i = 0; i < strippedErrors.length; i++) {
168182
log.error(strippedErrors[i]);
169183
}
170-
if (useErrorOverlay) overlay.showMessage(errors);
184+
if (useErrorOverlay) {
185+
overlay.showMessage(errors);
186+
}
171187
initial = false;
172188
},
173189
error(error) {

client-src/live/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ $(() => {
4141
borderColor: '#96b5b4',
4242
});
4343
$errors.hide();
44-
if (!hot) iframe.hide();
44+
if (!hot) {
45+
iframe.hide();
46+
}
4547
},
4648
hash(hash) {
4749
currentHash = hash;
@@ -53,7 +55,9 @@ $(() => {
5355
borderColor: '',
5456
});
5557
$errors.hide();
56-
if (!hot) iframe.show();
58+
if (!hot) {
59+
iframe.show();
60+
}
5761
},
5862
ok() {
5963
okness.text('');
@@ -118,7 +122,9 @@ $(() => {
118122
});
119123
try {
120124
let old = `${iframe[0].contentWindow.location}`;
121-
if (old.indexOf('about') === 0) old = null;
125+
if (old.indexOf('about') === 0) {
126+
old = null;
127+
}
122128
iframe.attr('src', old || contentPage + window.location.hash);
123129
if (old) {
124130
iframe[0].contentWindow.location.reload();

0 commit comments

Comments
 (0)