Fix lint errors

This commit is contained in:
Ben Zörb 2020-05-20 07:28:30 +02:00
parent 5606d6439d
commit 05ce30aee6
No known key found for this signature in database
GPG Key ID: B5022087DA9E02FF
2 changed files with 6 additions and 5 deletions

7
cli.js
View File

@ -104,10 +104,11 @@ cli.flags = Object.entries(cli.flags).reduce((res, [key, val]) => {
res.ignore = (val || []).map(ignore => { res.ignore = (val || []).map(ignore => {
// Check regex // Check regex
const match = ignore.match(/^\/(.*)\/([igmy]+)?$/); const {groups} = /^\/(?<expression>.*)\/(?<flags>[igmy]+)?$/.exec(ignore) || {};
const {expression, flags} = groups || {};
if (match) { if (groups) {
return new RegExp(escapeRegExp(match[1]), match[2]); return new RegExp(escapeRegExp(expression), flags);
} }
return ignore; return ignore;

View File

@ -106,10 +106,10 @@ class Dom {
} }
if (this.noscriptPosition === 'head') { if (this.noscriptPosition === 'head') {
return result.replace(/^([\s\t]*)(<\/\s*head>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); return result.replace(/^([\s\t]*)(<\/\s*head>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); // eslint-disable-line prefer-named-capture-group
} }
return result.replace(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); return result.replace(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); // eslint-disable-line prefer-named-capture-group
} }
createStyleNode(css, referenceIndent = this.headIndent.indent) { createStyleNode(css, referenceIndent = this.headIndent.indent) {