From f1c142ea3d1055e4e74ef427797425247d3e5373 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 26 Sep 2025 11:56:42 -0500 Subject: [PATCH] lint for missing g flag --- eslint.config.mjs | 1 + .../website/src/components/editor/createProvideTwoslashInlay.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 391214cb6184..433085ceae89 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -322,6 +322,7 @@ export default defineConfig( 'jsdoc/tag-lines': 'off', 'regexp/no-dupe-disjunctions': 'error', + 'regexp/no-missing-g-flag': 'error', 'regexp/no-useless-character-class': 'error', 'regexp/no-useless-flag': 'error', 'regexp/no-useless-lazy': 'error', diff --git a/packages/website/src/components/editor/createProvideTwoslashInlay.ts b/packages/website/src/components/editor/createProvideTwoslashInlay.ts index 7ec378b4aff7..89f3c7bb26ce 100644 --- a/packages/website/src/components/editor/createProvideTwoslashInlay.ts +++ b/packages/website/src/components/editor/createProvideTwoslashInlay.ts @@ -9,7 +9,7 @@ import type { SandboxInstance } from './useSandboxServices'; function findTwoshashQueries(code: string): RegExpExecArray[] { // RegExp that matches '^//?$' - const twoslashQueryRegex = /^(\s*\/\/\s*\^\?)\s*$/m; + const twoslashQueryRegex = /^(\s*\/\/\s*\^\?)\s*$/gm; return [...code.matchAll(twoslashQueryRegex)]; }