Disable no-control-regex rule for the line containing \x1b in regex

Signed-off-by: Cocoa <0xbbc@0xbbc.com>
This commit is contained in:
Cocoa 2020-05-02 15:53:07 +08:00
parent b18846c297
commit 9a29125e72
No known key found for this signature in database
GPG Key ID: 9821F9625A97231D

View File

@ -54,7 +54,9 @@ function fileAppender(file, layout, logSize, numBackups, options, timezoneOffset
const app = function (loggingEvent) {
if (options.removeColor === true) {
/* eslint-disable no-control-regex */
const regex = new RegExp("\x1b[[0-9;]*m", "g");
/* eslint-enable no-control-regex */
for (let i = 0; i < loggingEvent.data.length; i += 1) {
let d = loggingEvent.data[i];
d = d.replace(regex, '');