Skip to content

Commit 039edbf

Browse files
committed
added curly braces to all conditional statements
1 parent 5aef0f6 commit 039edbf

File tree

26 files changed

+183
-179
lines changed

26 files changed

+183
-179
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"import/no-extraneous-dependencies": "off",
3232
"no-new": "off",
3333
"no-loss-of-precision": "off",
34+
"nonblock-statement-body-position": "error",
3435
"semi": [
3536
1
3637
],

config/webpack.common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ const devServer = require('./webpack.devServer.js');
1111
let config = null;
1212

1313
const plugin = ['@plugins/importPlugin.ts'];
14-
const points = ['./index.ts'];
14+
const points = [];
1515

1616
if (env.isDev) { points.push('webpack/hot/dev-server'); }
1717

18+
points.push('./index.ts');
19+
1820
if (env.isPlugin) {
1921
config = {
2022
plugin,

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"watch": "cross-env NODE_ENV=development webpack --mode development --watch",
1010
"start": "cross-env NODE_ENV=development webpack serve --mode development",
1111
"test": "jest",
12-
"plugin": "cross-env NODE_ENV=plugin webpack --mode production"
12+
"plugin": "cross-env NODE_ENV=plugin webpack --mode production",
13+
"linter": "eslint . --ext .js,.ts"
1314
},
1415
"author": "coder1 <c.o.d.e.r.1@mail.ru>",
1516
"license": "ISC",
@@ -57,4 +58,4 @@
5758
"ts-node": "^10.7.0",
5859
"typescript": "^4.6.3"
5960
}
60-
}
61+
}

src/components/code/CopyCodeButton.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CopyCodeButton {
1919
}
2020

2121
setData(options: RangeSliderOptions) {
22-
if (!this.list) return false;
22+
if (!this.list) { return false; }
2323

2424
const key = Object.keys(options);
2525
const values = Object.values(options);
@@ -69,7 +69,7 @@ class CopyCodeButton {
6969

7070
@boundMethod
7171
private handleCopyClick() {
72-
if (!this.list) return false;
72+
if (!this.list) { return false; }
7373

7474
let text = `$('.demo').${NAME_PLUGIN}({\n`;
7575

src/components/grid/Grid.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ class Grid {
101101
(this.gridRound && this.gridRound.value) ?? '',
102102
);
103103

104-
if (!this.gridRound || !this.step) return false;
104+
if (!this.gridRound || !this.step) { return false; }
105105

106106
this.gridRound.addEventListener('change', this.handleGridRoundChange);
107107
this.step.addEventListener('change', this.handleStepChange);
108108

109-
if (!this.interval || !this.grid) return false;
109+
if (!this.interval || !this.grid) { return false; }
110110

111111
this.interval.addEventListener('change', this.handleIntervalChange);
112112

@@ -132,7 +132,7 @@ class Grid {
132132

133133
@boundMethod
134134
private handleStepChange(event: Event) {
135-
if (!this.interval) return false;
135+
if (!this.interval) { return false; }
136136
const element = event.currentTarget as HTMLInputElement;
137137
this.objRangeSlider.update({
138138
gridNumber: 0,
@@ -144,7 +144,7 @@ class Grid {
144144

145145
@boundMethod
146146
private handleIntervalChange(event: Event) {
147-
if (!this.step) return false;
147+
if (!this.step) { return false; }
148148
const element = event.currentTarget as HTMLInputElement;
149149
this.objRangeSlider.update({
150150
gridNumber: Number(element.value),
@@ -156,7 +156,7 @@ class Grid {
156156

157157
@boundMethod
158158
private handleInputProcessing(event: Event) {
159-
if (!this.fieldValues) return false;
159+
if (!this.fieldValues) { return false; }
160160
const element = event.currentTarget as HTMLInputElement;
161161
const value = element.value.replace(/[^.\d]/g, '');
162162
const REGEXP = /^\d*?[.]?\d*$/;
@@ -182,7 +182,7 @@ class Grid {
182182

183183
@boundMethod
184184
private handleSnapClick(event: Event) {
185-
if (!this.grid) return false;
185+
if (!this.grid) { return false; }
186186
const element = event.currentTarget as HTMLInputElement;
187187

188188
if (this.grid.checked) {

src/components/hints/Hints.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ class Hints {
7474
this.objRangeSlider = rangeSlider;
7575

7676
[this.tipPrefix, this.tipPostfix].forEach((item) => {
77-
if (!item) return;
77+
if (!item) { return; }
7878
item.addEventListener('change', this.handleInputChange);
7979
});
8080

81-
if (!this.tipMinMax || !this.tipFromTo) return false;
81+
if (!this.tipMinMax || !this.tipFromTo) { return false; }
8282

8383
this.tipMinMax.addEventListener('click', this.handleTipMinMaxClick);
8484
this.tipFromTo.addEventListener('click', this.handleTipFromToClick);

src/components/input-data/InputData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InputData {
2626
const objThis = this;
2727
Object.defineProperty(this.input, 'value', {
2828
set(text) {
29-
if (!text && !objThis) return;
29+
if (!text && !objThis) { return; }
3030

3131
const input = objThis.value as HTMLInputElement;
3232

src/components/keyboard-control/KeyboardControl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ class KeyboardControl {
6161
);
6262

6363
[this.keyStepOne, this.keyStepHold].forEach((item) => {
64-
if (!item) return;
64+
if (!item) { return; }
6565
item.addEventListener('change', this.handleDataChange);
6666
item.addEventListener('input', this.handleInputProcessing);
6767
});
6868
}
6969

7070
@boundMethod
7171
private handleDataChange(event: Event) {
72-
if (!this.fieldValues) return false;
72+
if (!this.fieldValues) { return false; }
7373
const element = event.currentTarget as HTMLInputElement;
7474

7575
this.objRangeSlider.update({
@@ -84,7 +84,7 @@ class KeyboardControl {
8484
const value = element.value.replace(/[^-.\d]/g, '');
8585
const REGEXP = /^-?\d*?[.]?\d*$/;
8686

87-
if (!this.fieldValues) return false;
87+
if (!this.fieldValues) { return false; }
8888

8989
if (REGEXP.test(value)) {
9090
this.fieldValues.set(element.name, value);

src/components/miscellaneous/Miscellaneous.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Different {
108108
bindEvent(rangeSlider: any) {
109109
this.objRangeSlider = rangeSlider;
110110

111-
if (!this.reset || !this.select) return false;
111+
if (!this.reset || !this.select) { return false; }
112112

113113
this.reset.addEventListener('click', this.handleResetClick);
114114

@@ -118,12 +118,12 @@ class Different {
118118
});
119119
};
120120

121-
if (!this.disabled || !this.bar) return false;
121+
if (!this.disabled || !this.bar) { return false; }
122122

123123
this.disabled.addEventListener('click', this.handleDisabledClick);
124124
this.bar.addEventListener('click', this.handleBarClick);
125125

126-
if (!this.unsubscribtion || !this.type) return false;
126+
if (!this.unsubscribtion || !this.type) { return false; }
127127

128128
this.unsubscribtion.addEventListener(
129129
'click',

src/components/panel/Panel.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Panel {
6060

6161
const child = element && element.firstElementChild;
6262

63-
if (!child) return false;
63+
if (!child) { return false; }
6464

6565
const rangeSlider = $(child).RangeSliderFox({
6666
...options,
@@ -71,7 +71,7 @@ class Panel {
7171
}).data(NAME_PLUGIN); // will return an object for one item
7272

7373
const bindEvent = <T extends Actions | null>(object: T) => {
74-
if (!object) return false;
74+
if (!object) { return false; }
7575
object.bindEvent(rangeSlider);
7676
return true;
7777
};
@@ -145,7 +145,7 @@ class Panel {
145145
this.objectGrid,
146146
this.objectHints,
147147
].forEach((item) => {
148-
if (!item) return;
148+
if (!item) { return; }
149149
item.setData({ ...data });
150150
});
151151
}
@@ -156,7 +156,7 @@ class Panel {
156156
this.objectCopyCode,
157157
this.objectKeyboardControl,
158158
].forEach((item) => {
159-
if (!item) return;
159+
if (!item) { return; }
160160
item.setData({ ...data });
161161
});
162162
}
@@ -170,7 +170,7 @@ class Panel {
170170
this.objectGrid,
171171
this.objectHints,
172172
].forEach((item) => {
173-
if (!item) return;
173+
if (!item) { return; }
174174
item.setData({ ...data });
175175
});
176176
}
@@ -184,7 +184,7 @@ class Panel {
184184
this.objectGrid,
185185
this.objectHints,
186186
].forEach((item) => {
187-
if (!item) return;
187+
if (!item) { return; }
188188
item.setData({ ...data });
189189
});
190190
}

src/components/select/Select.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Select {
3030
}
3131

3232
getData() {
33-
if (!this.input) return '';
33+
if (!this.input) { return ''; }
3434
return this.input.value;
3535
}
3636

@@ -80,7 +80,7 @@ class Select {
8080
}
8181

8282
private setValueSelect(element: HTMLElement) {
83-
if (!this.button || !this.input) return false;
83+
if (!this.button || !this.input) { return false; }
8484

8585
this.button.innerText = element.innerText;
8686
const value = element.getAttribute('data-value');
@@ -111,7 +111,7 @@ class Select {
111111
}
112112

113113
private toggle(isVisible = false) {
114-
if (!this.options) return false;
114+
if (!this.options) { return false; }
115115

116116
this.toggleModifier(
117117
this.element,
@@ -202,7 +202,7 @@ class Select {
202202
}
203203

204204
private bindEvent() {
205-
if (!this.displayedWrapper || !this.button) return false;
205+
if (!this.displayedWrapper || !this.button) { return false; }
206206

207207
this.displayedWrapper.addEventListener('click', this.handleDisplayedWrapperClick);
208208
this.button.addEventListener('keydown', this.handleDisplayedKeyDown);

src/components/values/Values.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Values {
108108
const value = element.value.replace(/[^-.\d]/g, '');
109109
const REGEXP = /^-?\d*?[.]?\d*$/;
110110

111-
if (!this.fieldValues) return false;
111+
if (!this.fieldValues) { return false; }
112112

113113
if (REGEXP.test(value)) {
114114
this.fieldValues.set(element.name, value);
@@ -122,7 +122,7 @@ class Values {
122122

123123
@boundMethod
124124
private handleInputChange(event: Event) {
125-
if (!this.fieldValues) return false;
125+
if (!this.fieldValues) { return false; }
126126
const element = event.currentTarget as HTMLInputElement;
127127
this.objRangeSlider.update({
128128
[element.name]: Number(this.fieldValues.get(element.name)),

0 commit comments

Comments
 (0)