Skip to content

Commit

Permalink
chore(biome): Add useRegexLiterals rule (#10010)
Browse files Browse the repository at this point in the history
Add the
[useRegexLiterals](https://biomejs.dev/linter/rules/use-regex-literals/)
rule to our biome config which will flag unnecessary usage of the
`RegExp` constructor where a static regex could be used instead.
  • Loading branch information
Lms24 authored and anonrig committed Jan 3, 2024
1 parent 0fda0f3 commit 6f3f053
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
"noControlCharactersInRegex": "error"
},
"nursery": {
"noUnusedImports": "error"
"noUnusedImports": "error",
"useRegexLiterals": "error"
},
"performance": {
"all": true,
"noAccumulatingSpread": "error",
"noDelete": "off"
}
},
"ignore": [".vscode/*", "**/*.json"]
"ignore": [".vscode/*", "**/*.json", ".next/**/*", ".svelte-kit/**/*"]
},
"files": {
"ignoreUnknown": true
Expand Down
4 changes: 2 additions & 2 deletions packages/serverless/test/google-cloud-http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('GoogleCloudHttp tracing', () => {
'{"kind":"bigquery#job","configuration":{"query":{"query":"SELECT true AS foo","destinationTable":{"projectId":"project-id","datasetId":"_7b1eed9bef45ab5fb7345c3d6f662cd767e5ab3e","tableId":"anon101ee25adad33d4f09179679ae9144ad436a210e"},"writeDisposition":"WRITE_TRUNCATE","priority":"INTERACTIVE","useLegacySql":false},"jobType":"QUERY"},"jobReference":{"projectId":"project-id","jobId":"8874c5d5-9cfe-4daa-8390-b0504b97b429","location":"US"},"statistics":{"creationTime":"1603072686488","startTime":"1603072686756","query":{"statementType":"SELECT"}},"status":{"state":"RUNNING"}}',
);
nock('https://bigquery.googleapis.com')
.get(new RegExp('^/bigquery/v2/projects/project-id/queries/.+$'))
.get(/^\/bigquery\/v2\/projects\/project-id\/queries\/.+$/)
.query(true)
.reply(
200,
Expand All @@ -67,7 +67,7 @@ describe('GoogleCloudHttp tracing', () => {
expect(SentryNode.fakeTransaction.startChild).toBeCalledWith({
op: 'http.client.bigquery',
origin: 'auto.http.serverless',
description: expect.stringMatching(new RegExp('^GET /queries/.+')),
description: expect.stringMatching(/^GET \/queries\/.+/),
});
});
});
Expand Down

0 comments on commit 6f3f053

Please sign in to comment.