Skip to content

Commit 3a01c17

Browse files
committed
Change eslint rule arrow-parens to always
1 parent 3a10626 commit 3a01c17

14 files changed

Lines changed: 40 additions & 40 deletions

.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/3-functor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const text = (s = '') => ({
4-
line: a => text(`${s}\n${a}`),
4+
line: (a) => text(`${s}\n${a}`),
55
toString: () => s
66
});
77

JavaScript/4-mutable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const text = (s = '', o = {
4-
line: a => (s += '\n' + a, o),
4+
line: (a) => (s += '\n' + a, o),
55
toString: () => s
66
}) => o;
77

JavaScript/5-iterator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const text = (s = '', o = {
4-
line: a => (s += '\n' + a, o),
4+
line: (a) => (s += '\n' + a, o),
55
[Symbol.iterator]: () => ({
66
next() {
77
const res = { value: s, done: this.finished };

JavaScript/6-promise.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class ArrayChain {
1515

1616
fetch(fn) {
1717
return (this
18-
.then(data => fn(null, data))
19-
.catch(err => fn(err))
18+
.then((data) => fn(null, data))
19+
.catch((err) => fn(err))
2020
);
2121
}
2222

2323
_chain(performer, fn, initial) {
24-
this._promise = this._promise.then(array => (
24+
this._promise = this._promise.then((array) => (
2525
new Promise((resolve, reject) => (
2626
performer(array, fn, (err, result) => (
2727
(err ? reject(err) : resolve(result))
@@ -62,5 +62,5 @@ class ArrayChain {
6262
}
6363

6464
module.exports = {
65-
for: array => new ArrayChain(array)
65+
for: (array) => new ArrayChain(array)
6666
};

JavaScript/7-functor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const arrayChain = (array, prev = null) => {
1717

1818
if (!prev) process.nextTick(() => self(null, array));
1919

20-
self.then = fn => (done = fn, self);
21-
self.catch = fn => (fail = fn, self);
22-
self.fetch = fn => (self
23-
.then(data => fn(null, data))
24-
.catch(err => fn(err))
20+
self.then = (fn) => (done = fn, self);
21+
self.catch = (fn) => (fail = fn, self);
22+
self.fetch = (fn) => (self
23+
.then((data) => fn(null, data))
24+
.catch((err) => fn(err))
2525
);
2626

27-
const chain = performer => (fn, initial) => {
27+
const chain = (performer) => (fn, initial) => {
2828
const res = arrayChain(null, self);
2929
next = () => performer(array, fn, res, initial);
3030
return res;

JavaScript/8-prototype.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
const metasync = require('metasync');
44

5-
const async = op => {
5+
const async = (op) => {
66
switch (op) {
7-
case 'map': return metasync.map;
8-
case 'filter': return metasync.filter;
9-
case 'reduce': return metasync.reduce;
10-
case 'each': return metasync.each;
11-
case 'series': return metasync.series;
12-
case 'find': return metasync.find;
7+
case 'map': return metasync.map;
8+
case 'filter': return metasync.filter;
9+
case 'reduce': return metasync.reduce;
10+
case 'each': return metasync.each;
11+
case 'series': return metasync.series;
12+
case 'find': return metasync.find;
1313
}
1414
};
1515

@@ -54,7 +54,7 @@ ArrayChain.prototype.catch = function(fn) {
5454
};
5555

5656
ArrayChain.prototype.fetch = function(fn) {
57-
this.chain.push({ op: 'then', fn: res => fn(null, res) });
57+
this.chain.push({ op: 'then', fn: (res) => fn(null, res) });
5858
this.chain.push({ op: 'catch', fn });
5959
this.execute();
6060
return this;
@@ -91,5 +91,5 @@ ArrayChain.prototype.find = function(fn) {
9191
};
9292

9393
module.exports = {
94-
for: array => new ArrayChain(array)
94+
for: (array) => new ArrayChain(array)
9595
};

JavaScript/9-build.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
const metasync = require('metasync');
44

5-
const async = op => {
5+
const async = (op) => {
66
switch (op) {
7-
case 'map': return metasync.map;
8-
case 'filter': return metasync.filter;
9-
case 'reduce': return metasync.reduce;
10-
case 'each': return metasync.each;
11-
case 'series': return metasync.series;
12-
case 'find': return metasync.find;
7+
case 'map': return metasync.map;
8+
case 'filter': return metasync.filter;
9+
case 'reduce': return metasync.reduce;
10+
case 'each': return metasync.each;
11+
case 'series': return metasync.series;
12+
case 'find': return metasync.find;
1313
}
1414
};
1515

@@ -44,20 +44,20 @@ ArrayChain.prototype.execute = function(err) {
4444
};
4545

4646
['then', 'catch', 'map', 'filter', 'reduce', 'each', 'series', 'find']
47-
.map(op => {
47+
.map((op) => {
4848
ArrayChain.prototype[op] = function(fn) {
4949
this.chain.push({ op, fn });
5050
return this;
5151
};
5252
});
5353

5454
ArrayChain.prototype.fetch = function(fn) {
55-
this.chain.push({ op: 'then', fn: res => fn(null, res) });
55+
this.chain.push({ op: 'then', fn: (res) => fn(null, res) });
5656
this.chain.push({ op: 'catch', fn });
5757
this.execute();
5858
return this;
5959
};
6060

6161
module.exports = {
62-
for: array => new ArrayChain(array)
62+
for: (array) => new ArrayChain(array)
6363
};

JavaScript/a-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ module.exports = (chaining, done) => {
77

88
chaining
99
.for([1, 2, 3, 4])
10-
.filter(item => item % 2 === 0)
11-
.map(item => item * 2)
10+
.filter((item) => item % 2 === 0)
11+
.map((item) => item * 2)
1212
.reduce((a, b) => a + b)
1313
.fetch((err, result) => {
1414
if (err) throw err;

JavaScript/b-compare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const implementations = [
44
'6-promise', '7-functor', '8-prototype', '9-build'
5-
].map(name => `./${name}.js`).map(require);
5+
].map((name) => `./${name}.js`).map(require);
66

77
const test = require('./a-test.js');
88

0 commit comments

Comments
 (0)