From e0f9eeaa79d091dc3d41c8d6b17fcd28eb677b76 Mon Sep 17 00:00:00 2001 From: Sarah Fortune Date: Fri, 30 May 2025 15:21:34 -0700 Subject: [PATCH] Use the webview-ui linter during `npm run lint` (#3938) The webview-ui has an existing eslint config, but it was not being run as part of `npm run lint` command. Start running the webview specific linter (the top level linter doesn't run on tsx files, and webview linter has react specific checks). Fix lint errors in slash-commands file. --- package.json | 2 +- webview-ui/src/utils/slash-commands.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 68e8ad51..470f53dc 100644 --- a/package.json +++ b/package.json @@ -279,7 +279,7 @@ "watch-tests": "tsc -p . -w --outDir out", "pretest": "npm run compile-tests && npm run compile && npm run compile-standalone && npm run lint", "check-types": "npm run protos && tsc --noEmit", - "lint": "eslint src --ext ts && eslint webview-ui/src --ext ts", + "lint": "eslint src --ext ts && eslint webview-ui/src --ext ts && cd webview-ui && npm run lint", "format": "prettier . --check", "format:fix": "prettier . --write", "test": "npm-run-all test:unit test:integration", diff --git a/webview-ui/src/utils/slash-commands.ts b/webview-ui/src/utils/slash-commands.ts index a7f155a0..8ab5f96a 100644 --- a/webview-ui/src/utils/slash-commands.ts +++ b/webview-ui/src/utils/slash-commands.ts @@ -75,9 +75,9 @@ export function getWorkflowCommands( // Regex for detecting slash commands in text // currently doesn't allow whitespace inside of the filename -export const slashCommandRegex = /\/([a-zA-Z0-9_\.-]+)(\s|$)/ +export const slashCommandRegex = /\/([a-zA-Z0-9_.-]+)(\s|$)/ export const slashCommandRegexGlobal = new RegExp(slashCommandRegex.source, "g") -export const slashCommandDeleteRegex = /^\s*\/([a-zA-Z0-9_\.-]+)$/ +export const slashCommandDeleteRegex = /^\s*\/([a-zA-Z0-9_.-]+)$/ /** * Removes a slash command at the cursor position