Skip to content

Commit

Permalink
chore(lint): fix unicorn/prefer-regexp-test
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jan 2, 2023
1 parent 8ffbe09 commit 5b39e60
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 === '') {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/checkGoVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/splitHandlerPathAndName.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5b39e60

Please sign in to comment.