Skip to content

Commit 9743e83

Browse files
committed
Change eslint rule arrow-parens to always
1 parent 984a8ba commit 9743e83

File tree

10 files changed

+23
-20
lines changed

10 files changed

+23
-20
lines changed

.eslintrc.json

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

JavaScript/1-HTTP/api/read.js

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

3-
module.exports = async name => {
3+
module.exports = async (name) => {
44
const shape = memory.get(name);
55
if (!shape) return 'Shape is not found';
66
return shape;

JavaScript/1-HTTP/api/render.js

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

3-
module.exports = async name => {
3+
module.exports = async (name) => {
44
const shape = memory.get(name);
55
if (!shape) return 'Shape is not found';
66
const points = [];

JavaScript/1-HTTP/server.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const api = new Map();
99

1010
const apiPath = './api/';
1111

12-
const cacheFile = name => {
12+
const cacheFile = (name) => {
1313
const filePath = apiPath + name;
1414
const key = path.basename(filePath, '.js');
1515
try {
@@ -26,14 +26,14 @@ const cacheFile = name => {
2626
}
2727
};
2828

29-
const cacheFolder = path => {
29+
const cacheFolder = (path) => {
3030
fs.readdir(path, (err, files) => {
3131
if (err) return;
3232
files.forEach(cacheFile);
3333
});
3434
};
3535

36-
const watch = path => {
36+
const watch = (path) => {
3737
fs.watch(path, (event, file) => {
3838
cacheFile(file);
3939
});
@@ -46,9 +46,9 @@ setTimeout(() => {
4646
console.dir({ api });
4747
}, 1000);
4848

49-
const receiveArgs = async req => new Promise(resolve => {
49+
const receiveArgs = async (req) => new Promise((resolve) => {
5050
const body = [];
51-
req.on('data', chunk => {
51+
req.on('data', (chunk) => {
5252
body.push(chunk);
5353
}).on('end', async () => {
5454
const data = body.join('');

JavaScript/1-HTTP/static/client.js

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

3-
const buildAPI = methods => {
3+
const buildAPI = (methods) => {
44
const api = {};
55
for (const method of methods) {
66
api[method] = (...args) => new Promise((resolve, reject) => {
@@ -10,7 +10,7 @@ const buildAPI = methods => {
1010
method: 'POST',
1111
headers: { 'Content-Type': 'application/json' },
1212
body: JSON.stringify(args),
13-
}).then(res => {
13+
}).then((res) => {
1414
const { status } = res;
1515
if (status !== 200) {
1616
reject(new Error(`Status Code: ${status}`));

JavaScript/2-WS/api/read.js

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

3-
module.exports = async name => {
3+
module.exports = async (name) => {
44
const shape = memory.get(name);
55
if (!shape) return 'Shape is not found';
66
return shape;

JavaScript/2-WS/api/render.js

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

3-
module.exports = async name => {
3+
module.exports = async (name) => {
44
const shape = memory.get(name);
55
if (!shape) return 'Shape is not found';
66
const points = [];

JavaScript/2-WS/server.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const api = new Map();
1010

1111
const apiPath = './api/';
1212

13-
const cacheFile = name => {
13+
const cacheFile = (name) => {
1414
const filePath = apiPath + name;
1515
const key = path.basename(filePath, '.js');
1616
try {
@@ -27,14 +27,14 @@ const cacheFile = name => {
2727
}
2828
};
2929

30-
const cacheFolder = path => {
30+
const cacheFolder = (path) => {
3131
fs.readdir(path, (err, files) => {
3232
if (err) return;
3333
files.forEach(cacheFile);
3434
});
3535
};
3636

37-
const watch = path => {
37+
const watch = (path) => {
3838
fs.watch(path, (event, file) => {
3939
cacheFile(file);
4040
});
@@ -62,9 +62,9 @@ const server = http.createServer(async (req, res) => {
6262

6363
const ws = new WebSocket.Server({ server });
6464

65-
ws.on('connection', connection => {
65+
ws.on('connection', (connection) => {
6666
console.log('Connected ' + connection.remoteAddress);
67-
connection.on('message', async message => {
67+
connection.on('message', async (message) => {
6868
console.log('Received: ' + message);
6969
const obj = JSON.parse(message);
7070
const { method, args } = obj;

JavaScript/2-WS/static/client.js

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

33
const socket = new WebSocket('ws://127.0.0.1:8000/');
44

5-
const buildAPI = methods => {
5+
const buildAPI = (methods) => {
66
const api = {};
77
for (const method of methods) {
8-
api[method] = (...args) => new Promise(resolve => {
8+
api[method] = (...args) => new Promise((resolve) => {
99
socket.send(JSON.stringify({ method, args }));
10-
socket.onmessage = event => {
10+
socket.onmessage = (event) => {
1111
const data = JSON.parse(event.data);
1212
resolve(data);
1313
};

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)