Skip to content

Commit 6a3bd4c

Browse files
committed
lint
1 parent 01eef5a commit 6a3bd4c

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

js/network/socketiyo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"type": "module",
88
"main": "./source/socketiyo.js",
99
"scripts": {
10-
"lint-fix": "eslint --ignore-path .gitignore --fix source",
11-
"lint": "eslint --ignore-path .gitignore source"
10+
"lint-fix": "eslint --ignore-path ../../../.gitignore --fix source",
11+
"lint": "eslint --ignore-path ../../../.gitignore source"
1212
},
1313
"dependencies": {
1414
"event-e3": "^8.0.2",

js/network/socketiyo/source/socketiyo.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,31 +158,31 @@ const attachWebSocketServer = (options) => {
158158
};
159159

160160
const listen = (socket, message) => {
161-
let error = validateLength(message, maxLength);
162-
if (error) {
163-
facade.emit(VALIDATE_MESSAGE_ERROR, error);
161+
const validationError = validateLength(message, maxLength);
162+
if (validationError) {
163+
facade.emit(VALIDATE_MESSAGE_ERROR, validationError);
164164
return;
165165
}
166166

167167
let parsed;
168168
try {
169169
parsed = unpackData(message);
170-
} catch (error) {
171-
facade.emit(MESSAGE_FORMAT_ERROR, { error, message });
170+
} catch (parseError) {
171+
facade.emit(MESSAGE_FORMAT_ERROR, { error: parseError, message });
172172
return;
173173
}
174174

175-
error = validateFormat(parsed);
176-
if (error) {
177-
facade.emit(MESSAGE_FORMAT_ERROR, { error, parsed });
175+
const formatError = validateFormat(parsed);
176+
if (formatError) {
177+
facade.emit(MESSAGE_FORMAT_ERROR, { error: formatError, parsed });
178178
return;
179179
}
180180

181181
const { channel, data, action } = parsed;
182182

183-
error = validateChannel(channel, maxChannelLength);
184-
if (error) {
185-
facade.emit(VALIDATE_CHANNEL_ERROR, error);
183+
const validChannelError = validateChannel(channel, maxChannelLength);
184+
if (validChannelError) {
185+
facade.emit(VALIDATE_CHANNEL_ERROR, validChannelError);
186186
return;
187187
}
188188
if (action === SUBSCRIBE_CHANNEL_ACTION) {

js/network/socketiyo/source/validate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { bytesLengthFromString } from "utilsac";
66

77
const validateFormat = parsedMessage => {
88
if (!isObject(parsedMessage)) {
9-
return 'message should be an object';
9+
return `message should be an object`;
1010
}
1111
if (!Object.prototype.hasOwnProperty.call(parsedMessage, `channel`)) {
12-
return 'message should have a channel';
12+
return `message should have a channel`;
1313
}
1414
if (!Object.prototype.hasOwnProperty.call(parsedMessage, `data`) &&
1515
!Object.prototype.hasOwnProperty.call(parsedMessage, `action`)) {
16-
return 'message should have data or action';
16+
return `message should have data or action`;
1717
}
1818
};
1919

0 commit comments

Comments
 (0)