Skip to content

Commit

Permalink
chore: bump eslint-plugin-unicorn, fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Sep 20, 2023
1 parent 4167b01 commit 5cb0a82
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 38 deletions.
44 changes: 17 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -111,7 +111,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unicorn": "^46.0.1",
"eslint-plugin-unicorn": "^48.0.1",
"git-list-updated": "^1.2.1",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
Expand Down
6 changes: 3 additions & 3 deletions src/ServerlessOffline.js
Expand Up @@ -259,13 +259,13 @@ export default class ServerlessOffline {

// Parse CORS options
this.#options.corsAllowHeaders = this.#options.corsAllowHeaders
.replace(/\s/g, '')
.replaceAll(/\s/g, '')
.split(',')
this.#options.corsAllowOrigin = this.#options.corsAllowOrigin
.replace(/\s/g, '')
.replaceAll(/\s/g, '')
.split(',')
this.#options.corsExposedHeaders = this.#options.corsExposedHeaders
.replace(/\s/g, '')
.replaceAll(/\s/g, '')
.split(',')

this.#options.corsConfig = {
Expand Down
2 changes: 1 addition & 1 deletion src/events/authMatchPolicyResource.js
Expand Up @@ -61,7 +61,7 @@ export default function authMatchPolicyResource(policyResource, resource) {
// for the requested resource and the resource defined in the policy
// Need to create a regex replacing ? with one character and * with any number of characters
const regExp = new RegExp(
parsedPolicyResource.path.replace(/\*/g, '.*').replace(/\?/g, '.'),
parsedPolicyResource.path.replaceAll('*', '.*').replaceAll('?', '.'),
)

return regExp.test(parsedResource.path)
Expand Down
2 changes: 1 addition & 1 deletion src/events/http/Endpoint.js
Expand Up @@ -17,7 +17,7 @@ const defaultResponseTemplate = readFileSync(

function getResponseContentType(fep) {
if (fep.response && fep.response.headers['Content-Type']) {
return fep.response.headers['Content-Type'].replace(/'/gm, '')
return fep.response.headers['Content-Type'].replaceAll(/'/gm, '')
}

return 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion src/events/http/javaHelpers.js
Expand Up @@ -21,7 +21,7 @@ function javaMatches(value) {
}

function javaReplaceAll(oldValue, newValue) {
return this.replace(new RegExp(oldValue, 'gm'), newValue)
return this.replaceAll(new RegExp(oldValue, 'gm'), newValue)
}

function javaReplaceFirst(oldValue, newValue) {
Expand Down
4 changes: 2 additions & 2 deletions src/events/http/lambda-events/VelocityContext.js
Expand Up @@ -14,7 +14,7 @@ const { assign, entries, fromEntries } = Object

function escapeJavaScript(x) {
if (typeof x === 'string') {
return jsEscapeString(x).replace(/\\n/g, '\n') // See #26,
return jsEscapeString(x).replaceAll('\\n', '\n') // See #26,
}

if (isPlainObject(x)) {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default class VelocityContext {
Buffer.from(x.toString(), 'binary').toString('base64'),
escapeJavaScript,
parseJson: parse,
urlDecode: (x) => decodeURIComponent(x.replace(/\+/g, ' ')),
urlDecode: (x) => decodeURIComponent(x.replaceAll('+', ' ')),
urlEncode: encodeURI,
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/events/schedule/ScheduleEvent.js
Expand Up @@ -16,7 +16,7 @@ export default class ScheduleEvent {
source = 'aws.events'

// format of aws displaying the time, e.g.: 2020-02-09T14:13:57Z
time = new Date().toISOString().replace(/\.(.*)(?=Z)/g, '')
time = new Date().toISOString().replaceAll(/\.(.*)(?=Z)/g, '')

version = '0'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/generateHapiPath.js
Expand Up @@ -15,7 +15,7 @@ export default function generateHapiPath(path, options, serverless) {
hapiPath = hapiPath.slice(0, -1)
}

hapiPath = hapiPath.replace(/\+}/g, '*}')
hapiPath = hapiPath.replaceAll('+}', '*}')

return hapiPath
}
Expand Down

0 comments on commit 5cb0a82

Please sign in to comment.