Skip to content

Commit 5b39e60

Browse files
committed
chore(lint): fix unicorn/prefer-regexp-test
1 parent 8ffbe09 commit 5b39e60

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ module.exports = {
8484
'unicorn/no-useless-undefined': 'off',
8585
'unicorn/prefer-module': 'off',
8686
'unicorn/prefer-number-properties': 'off',
87-
'unicorn/prefer-regexp-test': 'off',
8887
'unicorn/prefer-spread': 'off',
8988
'unicorn/prefer-string-slice': 'off',
9089
'unicorn/prefer-ternary': 'off',

src/events/http/HttpServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ export default class HttpServer {
640640
for (const [key, value] of entries(endpoint.responses)) {
641641
if (
642642
key !== 'default' &&
643-
errorMessage.match(`^${value.selectionPattern || key}$`)
643+
`^${value.selectionPattern || key}$`.test(errorMessage)
644644
) {
645645
responseName = key
646646
break
@@ -699,7 +699,7 @@ export default class HttpServer {
699699
log.notice()
700700
}
701701
} else {
702-
headerValue = value.match(/^'.*'$/) ? value.slice(1, -1) : value // See #34
702+
headerValue = /^'.*'$/.test(value) ? value.slice(1, -1) : value // See #34
703703
}
704704
// Applies the header;
705705
if (headerValue === '') {

src/utils/checkGoVersion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default async function checkGoVersion() {
55

66
try {
77
const { stdout } = await execa('go', ['version'])
8-
if (stdout.match(/go1.\d+/g)) {
8+
if (/go1.\d+/g.test(stdout)) {
99
goVersion = '1.x'
1010
}
1111
} catch {

src/utils/splitHandlerPathAndName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function splitHandlerPathAndName(handler) {
88
// filename: source
99
// path: ./src/somefolder/source
1010
// name: LambdaFunctions::Handler.process
11-
if (handler.match(/::/)) {
11+
if (/::/.test(handler)) {
1212
const prepathDelimiter = handler.lastIndexOf('/')
1313
const prepath = handler.substr(0, prepathDelimiter + 1) // include '/' for path
1414
const postpath = handler.substr(prepathDelimiter + 1)

0 commit comments

Comments
 (0)