Enable prefer-template ESlint rule

For consistency and to disallow String concatenation in favor of templates.
This commit is contained in:
Baptiste Mathus 2018-09-11 10:32:44 +02:00
parent 10acc9216b
commit e410bd0ed9
5 changed files with 8 additions and 6 deletions

View File

@ -39,6 +39,7 @@
"template-tag-spacing": "error",
"curly": "error",
"brace-style": "error",
"no-trailing-spaces": "error"
"no-trailing-spaces": "error",
"prefer-template": "error"
}
}

View File

@ -121,7 +121,7 @@ class Update {
}
saveUpdateSync(manifest) {
logger.info('Saving a new manifest.. into ' + this.updatePath());
logger.info(`Saving a new manifest.. into ${this.updatePath()}`);
fs.writeFileSync(
this.updatePath(),
JSON.stringify(manifest),
@ -130,7 +130,7 @@ class Update {
}
loadUpdateSync() {
logger.info('Loading a new manifest.. from ' + this.updatePath());
logger.info(`Loading a new manifest.. from ${this.updatePath()}`);
try {
fs.statSync(this.updatePath());
} catch (err) {

View File

@ -39,6 +39,7 @@
"template-tag-spacing": "error",
"curly": "error",
"brace-style": "error",
"no-trailing-spaces": "error"
"no-trailing-spaces": "error",
"prefer-template": "error"
}
}

View File

@ -123,7 +123,7 @@ describe('Error Telemetry service acceptance tests', () => {
})
.then(res => {
assert.ok(res);
assert.equal(res.status, 'OK', 'response.status should be OK but got: ' + res.status);
assert.equal(res.status, 'OK', `response.status should be OK but got: ${res.status}`);
})
.catch(err => assert.fail(err));
});

View File

@ -106,7 +106,7 @@ app.use((err, req, res, next) => {
/* Avoid cluttering the test logs with expected errors and exceptions */
if (process.env.NODE_ENV != 'test') {
logger.error(err.stack);
logger.debug('statusCode: ' + err.statusCode + ' message: ' + err.message);
logger.debug(`statusCode: ${err.statusCode} message: ${err.message}`);
}
res.status(err.statusCode);
res.json({ status: FAILURE, message: err.message });