Skip to content

Commit 4c82160

Browse files
authored
chore(biome): Add useRegexLiterals rule (#10010)
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.
1 parent 16c4dbe commit 4c82160

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

biome.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
"noControlCharactersInRegex": "error"
2323
},
2424
"nursery": {
25-
"noUnusedImports": "error"
25+
"noUnusedImports": "error",
26+
"useRegexLiterals": "error"
2627
},
2728
"performance": {
2829
"all": true,
2930
"noAccumulatingSpread": "error",
3031
"noDelete": "off"
3132
}
3233
},
33-
"ignore": [".vscode/*", "**/*.json"]
34+
"ignore": [".vscode/*", "**/*.json", ".next/**/*", ".svelte-kit/**/*"]
3435
},
3536
"files": {
3637
"ignoreUnknown": true

packages/serverless/test/google-cloud-http.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('GoogleCloudHttp tracing', () => {
4949
'{"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"}}',
5050
);
5151
nock('https://bigquery.googleapis.com')
52-
.get(new RegExp('^/bigquery/v2/projects/project-id/queries/.+$'))
52+
.get(/^\/bigquery\/v2\/projects\/project-id\/queries\/.+$/)
5353
.query(true)
5454
.reply(
5555
200,
@@ -67,7 +67,7 @@ describe('GoogleCloudHttp tracing', () => {
6767
expect(SentryNode.fakeTransaction.startChild).toBeCalledWith({
6868
op: 'http.client.bigquery',
6969
origin: 'auto.http.serverless',
70-
description: expect.stringMatching(new RegExp('^GET /queries/.+')),
70+
description: expect.stringMatching(/^GET \/queries\/.+/),
7171
});
7272
});
7373
});

0 commit comments

Comments
 (0)