diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 6fc15b1b0..e974d020a 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -84,7 +84,6 @@ module.exports = { 'unicorn/no-useless-undefined': 'off', 'unicorn/prefer-module': 'off', 'unicorn/prefer-number-properties': 'off', - 'unicorn/prefer-regexp-test': 'off', 'unicorn/prefer-spread': 'off', 'unicorn/prefer-string-slice': 'off', 'unicorn/prefer-ternary': 'off', diff --git a/src/events/http/HttpServer.js b/src/events/http/HttpServer.js index dd90c822c..3f69628a1 100644 --- a/src/events/http/HttpServer.js +++ b/src/events/http/HttpServer.js @@ -640,7 +640,7 @@ export default class HttpServer { for (const [key, value] of entries(endpoint.responses)) { if ( key !== 'default' && - errorMessage.match(`^${value.selectionPattern || key}$`) + `^${value.selectionPattern || key}$`.test(errorMessage) ) { responseName = key break @@ -699,7 +699,7 @@ export default class HttpServer { log.notice() } } else { - headerValue = value.match(/^'.*'$/) ? value.slice(1, -1) : value // See #34 + headerValue = /^'.*'$/.test(value) ? value.slice(1, -1) : value // See #34 } // Applies the header; if (headerValue === '') { diff --git a/src/utils/checkGoVersion.js b/src/utils/checkGoVersion.js index 97f363653..0457e5852 100644 --- a/src/utils/checkGoVersion.js +++ b/src/utils/checkGoVersion.js @@ -5,7 +5,7 @@ export default async function checkGoVersion() { try { const { stdout } = await execa('go', ['version']) - if (stdout.match(/go1.\d+/g)) { + if (/go1.\d+/g.test(stdout)) { goVersion = '1.x' } } catch { diff --git a/src/utils/splitHandlerPathAndName.js b/src/utils/splitHandlerPathAndName.js index 413a2df59..8cf410476 100644 --- a/src/utils/splitHandlerPathAndName.js +++ b/src/utils/splitHandlerPathAndName.js @@ -8,7 +8,7 @@ export default function splitHandlerPathAndName(handler) { // filename: source // path: ./src/somefolder/source // name: LambdaFunctions::Handler.process - if (handler.match(/::/)) { + if (/::/.test(handler)) { const prepathDelimiter = handler.lastIndexOf('/') const prepath = handler.substr(0, prepathDelimiter + 1) // include '/' for path const postpath = handler.substr(prepathDelimiter + 1)