Skip to content

Commit 97295e2

Browse files
committed
Update code style: arrow-parens "always"
1 parent 95d2a66 commit 97295e2

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
],
214214
"arrow-parens": [
215215
"error",
216-
"as-needed"
216+
"always"
217217
],
218218
"arrow-body-style": [
219219
"error",

JavaScript/2-scopes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
'use strict';
22

33
const cities = ['Athens', 'Roma', 'London', 'Beijing', 'Kiev', 'Riga'];
4-
const f = s => s.length;
4+
const f = (s) => s.length;
55

66
function f1() {
77
const cities = ['Athens', 'Roma'];
8-
const f = s => s.toUpperCase();
8+
const f = (s) => s.toUpperCase();
99
console.dir({ cities });
1010
console.dir(cities.map(f));
1111

1212
{
13-
const f = s => s.toLowerCase();
13+
const f = (s) => s.toLowerCase();
1414
console.dir({ cities });
1515
console.dir(cities.map(f));
1616
}

JavaScript/3-abstraction.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

33
const power = Math.pow;
4-
const square = x => power(x, 2);
5-
const cube = x => power(x, 3);
4+
const square = (x) => power(x, 2);
5+
const cube = (x) => power(x, 3);
66

77
console.log(power(10, 2));
88
console.log(square(10));

JavaScript/4-introspection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ console.dir({
2525
});
2626

2727
console.log('Anonymous function: ' + function(x) { return x; }.name);
28-
console.log('Anonymous lambda: ' + (x => x).name);
28+
console.log('Anonymous lambda: ' + ((x) => x).name);
2929

3030
console.log('toString: ');
3131
console.dir({

JavaScript/6-rest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const f1 = (...args) => {
77
f1(1, 2, 3);
88

99
const f2 = (...args) => {
10-
args.forEach(arg => {
10+
args.forEach((arg) => {
1111
const type = typeof arg;
1212
console.log('Type: ' + type);
1313
if (type === 'object') {

JavaScript/d-decompose.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const ALL_TYPES = merge(SCALAR_TYPES, OBJECT_TYPES, META_TYPES);
3636
const FUNC_TERMS = [') {', ') => {', ') => ('];
3737
const NAMED_LINES = ['Example:', 'Returns:', 'Hint:', 'Result:'];
3838

39-
const indexing = s => term => s.indexOf(term);
39+
const indexing = (s) => (term) => s.indexOf(term);
4040

41-
const last = arr => arr[arr.length - 1];
41+
const last = (arr) => arr[arr.length - 1];
4242

4343
const parseLines = (
4444
// Parse signature lines
@@ -50,12 +50,12 @@ const parseLines = (
5050
lines.pop();
5151
signature.title = (lines.shift() || '').replace('//', '').trim();
5252
lines = lines.map(
53-
d => d.trim().replace(/^(.*) \/\//, '$1:').replace(',:', ':')
53+
(d) => d.trim().replace(/^(.*) \/\//, '$1:').replace(',:', ':')
5454
);
5555
for (let line of lines) {
5656
if (line.startsWith('//')) {
5757
line = line.replace(/^\/\/ /, '').trim();
58-
if (NAMED_LINES.find(s => line.startsWith(s))) {
58+
if (NAMED_LINES.find((s) => line.startsWith(s))) {
5959
const [name, comment] = section(line, ': ');
6060
signature.comments.push({ name, comment });
6161
} else if (signature.parameters.length === 0) {
@@ -70,7 +70,7 @@ const parseLines = (
7070
} else {
7171
const [name, text] = section(line, ': ');
7272
let [type, comment] = section(text, ', ');
73-
if (!ALL_TYPES.find(s => type.startsWith(s))) {
73+
if (!ALL_TYPES.find((s) => type.startsWith(s))) {
7474
comment = type;
7575
type = '';
7676
}
@@ -90,7 +90,7 @@ const parseSignature = (
9090
};
9191
let s = fn.toString();
9292
let pos = FUNC_TERMS.map(indexing(s))
93-
.filter(k => k !== -1)
93+
.filter((k) => k !== -1)
9494
.reduce((prev, cur) => (prev < cur ? prev : cur), s.length);
9595
if (pos !== -1) {
9696
s = s.substring(0, pos);
@@ -140,7 +140,7 @@ const badIntrospect = (
140140
};
141141
let s = fn.toString();
142142
let pos = FUNC_TERMS.map(indexing(s))
143-
.filter(k => k !== -1)
143+
.filter((k) => k !== -1)
144144
.reduce((prev, cur) => (prev < cur ? prev : cur), s.length);
145145
if (pos !== -1) {
146146
s = s.substring(0, pos);
@@ -150,12 +150,12 @@ const badIntrospect = (
150150
lines.pop();
151151
signature.title = (lines.shift() || '').replace('//', '').trim();
152152
lines = lines.map(
153-
d => d.trim().replace(/^(.*) \/\//, '$1:').replace(',:', ':')
153+
(d) => d.trim().replace(/^(.*) \/\//, '$1:').replace(',:', ':')
154154
);
155155
for (let line of lines) {
156156
if (line.startsWith('//')) {
157157
line = line.replace(/^\/\/ /, '').trim();
158-
if (NAMED_LINES.find(s => line.startsWith(s))) {
158+
if (NAMED_LINES.find((s) => line.startsWith(s))) {
159159
const [name, comment] = section(line, ': ');
160160
signature.comments.push({ name, comment });
161161
} else if (signature.parameters.length === 0) {
@@ -170,7 +170,7 @@ const badIntrospect = (
170170
} else {
171171
const [name, text] = section(line, ': ');
172172
let [type, comment] = section(text, ', ');
173-
if (!ALL_TYPES.find(s => type.startsWith(s))) {
173+
if (!ALL_TYPES.find((s) => type.startsWith(s))) {
174174
comment = type;
175175
type = '';
176176
}

0 commit comments

Comments
 (0)