Skip to content

Commit f0fb7fd

Browse files
extracold1209entrydev
authored andcommitted
eslint 관련 부족했던 부분 수정
1 parent 1407123 commit f0fb7fd

File tree

4 files changed

+62
-52
lines changed

4 files changed

+62
-52
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/renderer/modal/*
2+
**/renderer/lang/*
3+
*.bundle.js*
4+
*.build.js*

app/src/main/datahandler/handler.js

+53-49
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,82 @@
11
'use strict';
2+
23
function Handler(config) {
3-
this.config = config;
4-
switch (config.entry.protocol) {
5-
case 'bytearray': {
6-
this.sendHandler = require('./bytearray.js').create(config.id, config.entry.bufferSize || config.entry.buffersize);
7-
break;
8-
}
9-
case 'json': {
10-
this.sendHandler = require('./json.js').create(config.id);
11-
break;
12-
}
4+
this.config = config;
5+
switch (config.entry.protocol) {
6+
case 'bytearray': {
7+
this.sendHandler = require('./bytearray.js').create(
8+
config.id,
9+
config.entry.bufferSize || config.entry.buffersize,
10+
);
11+
break;
12+
}
13+
case 'json': {
14+
this.sendHandler = require('./json.js').create(config.id);
15+
break;
16+
}
1317
// case 'dmp': {
1418
// this.sendHandler = require('./dmp.js').create(config.id);
1519
// break;
1620
// }
17-
}
21+
}
1822
}
1923

2024
Handler.prototype.encode = function() {
21-
if (this.sendHandler) {
22-
return this.sendHandler.encode();
23-
}
25+
if (this.sendHandler) {
26+
return this.sendHandler.encode();
27+
}
2428
};
2529

2630
Handler.prototype.decode = function(data, type) {
27-
if (type == 'binary') {
28-
if (data[1] != 0x00) {
29-
if (!this.receiveHandler) {
30-
switch (data[5]) {
31-
case 0x01: {
32-
this.receiveHandler = require('./bytearray.js').create(this.config.id);
33-
break;
34-
}
31+
if (type == 'binary') {
32+
if (data[1] != 0x00) {
33+
if (!this.receiveHandler) {
34+
switch (data[5]) {
35+
case 0x01: {
36+
this.receiveHandler = require('./bytearray.js').create(this.config.id);
37+
break;
38+
}
3539
// case 0x03: {
3640
// this.receiveHandler = require('./dmp.js').create(this.config.id);
3741
// break;
3842
// }
39-
}
40-
}
41-
if (this.receiveHandler) {
42-
this.receiveHandler.decode(data);
43-
}
44-
}
45-
} else if (type == 'utf8') {
46-
if (!this.receiveHandler) {
47-
this.receiveHandler = require('./json.js').create(this.config.id);
48-
}
49-
if (this.receiveHandler) {
50-
this.receiveHandler.decode(data);
51-
}
52-
}
43+
}
44+
}
45+
if (this.receiveHandler) {
46+
this.receiveHandler.decode(data);
47+
}
48+
}
49+
} else if (type == 'utf8') {
50+
if (!this.receiveHandler) {
51+
this.receiveHandler = require('./json.js').create(this.config.id);
52+
}
53+
if (this.receiveHandler) {
54+
this.receiveHandler.decode(data);
55+
}
56+
}
5357
};
5458

5559
Handler.prototype.e = function(arg) {
56-
if (this.receiveHandler) {
57-
return this.receiveHandler.e(arg);
58-
}
59-
return false;
60+
if (this.receiveHandler) {
61+
return this.receiveHandler.e(arg);
62+
}
63+
return false;
6064
};
6165

6266
Handler.prototype.read = function(arg) {
63-
if (this.receiveHandler) {
64-
return this.receiveHandler.read(arg);
65-
}
66-
return 0;
67+
if (this.receiveHandler) {
68+
return this.receiveHandler.read(arg);
69+
}
70+
return 0;
6771
};
6872

6973
Handler.prototype.write = function(arg1, arg2) {
70-
if (this.sendHandler) {
71-
return this.sendHandler.write(arg1, arg2);
72-
}
73-
return false;
74+
if (this.sendHandler) {
75+
return this.sendHandler.write(arg1, arg2);
76+
}
77+
return false;
7478
};
7579

7680
module.exports.create = function(config) {
77-
return new Handler(config);
81+
return new Handler(config);
7882
};

app/src/main/serial/connector.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,11 @@ class SerialConnector extends BaseConnector {
355355
!this.isSending
356356
) {
357357
this.isSending = true;
358-
358+
let resultData = data;
359359
if (this.options.stream === 'string') {
360-
data = Buffer.from(data, 'utf8');
360+
resultData = Buffer.from(data, 'utf8');
361361
}
362-
this.serialPort.write(data, () => {
362+
this.serialPort.write(resultData, () => {
363363
if (this.serialPort) {
364364
this.serialPort.drain(() => {
365365
this.received = true;

app/src/renderer/js/rendererRouter.js

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ class RendererRouter {
122122
const { appName } = this.sharedObject;
123123
const { translator, Modal } = window;
124124
const translate = (str) => translator.translate(str);
125+
126+
// eslint-disable-next-line new-cap
125127
const modal = new Modal.default();
126128

127129
if (appName === 'hardware' && navigator.onLine) {

0 commit comments

Comments
 (0)