Skip to content

Commit 52c6e44

Browse files
committed
eslint
1 parent 8f69378 commit 52c6e44

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

nodes/persistent-value.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
const node = this; // Store access to node configuration itself
174174

175175
valueSelectField.on('change', async function() {
176+
// eslint-disable-next-line no-invalid-this
176177
const selected = $(this).find('option:selected');
177178

178179
// Ignore re-population change
@@ -242,6 +243,7 @@
242243

243244
// Initially change triggered by editor loaded, later with every user interaction.
244245
valuesConfigField.on('change', async function() {
246+
// eslint-disable-next-line no-invalid-this
245247
const selectedConfigId = $(this).val();
246248

247249
if (selectedConfigId !== '_ADD_') { // Skip if "add new config" is selected
@@ -308,25 +310,29 @@
308310

309311
// dynamicControl property
310312
dynamicControlField.on('change', function() {
313+
// eslint-disable-next-line no-invalid-this
311314
this.checked ? dynamicControlDetails.show() : dynamicControlDetails.hide();
312315
});
313316
dynamicCommandMsgPropertyField.typedInput({types: [{label: 'msg.', value: 'str'}]});
314317
dynamicValueMsgPropertyField.typedInput({types: [{label: 'msg.', value: 'str'}]});
315318

316319
// output Previous Value property
317320
outputPreviousValueField.on('change', function() {
321+
// eslint-disable-next-line no-invalid-this
318322
this.checked ? outputPreviousValueDetails.show() : outputPreviousValueDetails.hide();
319323
});
320324
outputPreviousValueMsgPropertyField.typedInput({types: [{label: 'msg.', value: 'str'}]});
321325

322326
// collectValues property
323327
collectValuesField.on('change', function() {
328+
// eslint-disable-next-line no-invalid-this
324329
this.checked ? collectValuesDetails.show() : collectValuesDetails.hide();
325330
});
326331
collectValuesMsgPropertyField.typedInput({types: [{label: 'msg.', value: 'str'}]});
327332

328333
// block if property
329334
blockIfEnableField.on('change', function() {
335+
// eslint-disable-next-line no-invalid-this
330336
this.checked ? blockIfDetails.show() : blockIfDetails.hide();
331337
});
332338

@@ -337,6 +343,7 @@
337343

338344
// output MetaData property
339345
outputMetaDataField.on('change', function() {
346+
// eslint-disable-next-line no-invalid-this
340347
this.checked ? outputMetaDataDetails.show() : outputMetaDataDetails.hide();
341348
});
342349
outputMetaDataMsgPropertyField.typedInput({types: [{label: 'msg.', value: 'str'}]});
@@ -699,4 +706,4 @@ <h3>References</h3>
699706
<ul>
700707
<li>Node-RED doc <a href="https://nodered.org/docs/user-guide/context">Working with context</a></li>
701708
</ul>
702-
</script>
709+
</script>

nodes/persistent-value.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,9 @@ module.exports = function(RED) {
372372

373373
// ---- Node main -------------------------------------------------------------------------------
374374
RED.nodes.registerType('persistent value', function(nodeConfig) {
375-
RED.nodes.createNode(this, nodeConfig);
375+
// eslint-disable-next-line no-invalid-this
376376
const node = this;
377+
RED.nodes.createNode(node, nodeConfig);
377378

378379
// ---- Get node settings and referenced config properties ----
379380

nodes/persistent-values-config.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
height -= 20;
289289
$('#node-config-input-values-container').editableList('height', height);
290290
},
291-
});
291+
});
292292
})();
293293

294294
</script>

nodes/persistent-values-config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ module.exports = function(RED) {
77

88
// ---- Node main -------------------------------------------------------------------------------
99
RED.nodes.registerType('persistent values config', function(config) {
10-
RED.nodes.createNode(this, config);
10+
// eslint-disable-next-line no-invalid-this
11+
const node = this;
12+
RED.nodes.createNode(node, config);
1113

12-
this.name = config.name;
13-
this.values = config.values;
14+
node.name = config.name;
15+
node.values = config.values;
1416

1517
// Store config in global configs object for HTTP query API.
16-
configs[this.id] = {name: config.name, values: config.values};
18+
configs[node.id] = {name: config.name, values: config.values};
1719
});
1820

1921
// https://stackoverflow.com/questions/37265230/node-red-get-configuration-node-value-in-admin-ui

resources/logger.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
console.error(`[${LoggerNodeName}] ${message}`);
1919
}
2020
};
21+
// eslint-disable-next-line no-invalid-this
2122
})(/* istanbul ignore next */ typeof exports === 'undefined' ? this['logger'] = {} : exports);

test/logger_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ describe('logger utility', function() {
3737
// ==== Mocks =====
3838
class NodeMock {
3939
constructor() {}
40-
warn(warn_message, msg = undefined) {}
41-
error(error_message, msg = undefined) {}
40+
warn(warnMessage, msg = undefined) {}
41+
error(errorMessage, msg = undefined) {}
4242
}
4343

4444
// Mock for a Node-RED node supporting logging

test/persistent_values_config_spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,11 @@ describe('persistent values config backend node', function() {
321321
helper.request()
322322
.get(httpPathGenerateUUID)
323323
.expect(function(res) {
324-
const resp_uuid = res._body;
325-
uuid.validate(resp_uuid).should.be.true;
324+
const respUuid = res._body;
325+
uuid.validate(respUuid).should.be.true;
326326
})
327327
.expect(200)
328328
.end(done);
329329
});
330330
});
331-
332331
});

0 commit comments

Comments
 (0)