Просмотр исходного кода

Re-apply part of 00ec57a, npm script changes omitted

cte 10 месяцев назад
Родитель
Сommit
5c55515959

+ 1 - 2
.eslintrc.json

@@ -17,8 +17,7 @@
 		"@typescript-eslint/semi": "off",
 		"eqeqeq": "warn",
 		"no-throw-literal": "warn",
-		"semi": "off",
-		"react-hooks/exhaustive-deps": "off"
+		"semi": "off"
 	},
 	"ignorePatterns": ["out", "dist", "**/*.d.ts"]
 }

+ 1 - 1
.gitignore

@@ -1,6 +1,6 @@
 dist
 out
-out-integration
+out-*
 node_modules
 coverage/
 

+ 0 - 4
.husky/pre-commit

@@ -6,7 +6,3 @@ if [ "$branch" = "main" ]; then
 fi
 
 npx lint-staged
-
-npm run compile
-npm run lint
-npm run check-types

+ 3 - 2
.husky/pre-push

@@ -7,11 +7,12 @@ fi
 
 npm run compile
 
-# Check for new changesets
+# Check for new changesets.
 NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
 echo "Changeset files: $NEW_CHANGESETS"
+
 if [ "$NEW_CHANGESETS" == "0" ]; then
   echo "-------------------------------------------------------------------------------------"
   echo "Changes detected. Please run 'npm run changeset' to create a changeset if applicable."
   echo "-------------------------------------------------------------------------------------"
-fi
+fi

+ 1 - 1
.vscode/launch.json

@@ -13,7 +13,7 @@
 			"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
 			"sourceMaps": true,
 			"outFiles": ["${workspaceFolder}/dist/**/*.js"],
-			"preLaunchTask": "debug-mode",
+			"preLaunchTask": "${defaultBuildTask}",
 			"env": {
 				"NODE_ENV": "development",
 				"VSCODE_DEBUG_MODE": "true"

+ 6 - 45
.vscode/tasks.json

@@ -3,42 +3,15 @@
 {
 	"version": "2.0.0",
 	"tasks": [
-		{
-			"label": "compile",
-			"type": "npm",
-			"script": "compile",
-			"group": {
-				"kind": "build",
-				"isDefault": true
-			},
-			"presentation": {
-				"reveal": "silent",
-				"panel": "shared"
-			},
-			"problemMatcher": ["$tsc", "$eslint-stylish"]
-		},
 		{
 			"label": "watch",
-			"dependsOn": ["npm: build:webview", "npm: watch:tsc", "npm: watch:esbuild"],
+			"dependsOn": ["npm: dev", "npm: watch:tsc", "npm: watch:esbuild"],
 			"presentation": {
 				"reveal": "never"
 			},
 			"group": {
 				"kind": "build",
-				"isDefault": false
-			}
-		},
-		{
-			"label": "debug-mode",
-			"dependsOn": ["compile", "npm: dev"],
-			"group": {
-				"kind": "build",
-				"isDefault": false
-			},
-			"dependsOrder": "parallel",
-			"presentation": {
-				"reveal": "always",
-				"panel": "new"
+				"isDefault": true
 			}
 		},
 		{
@@ -59,20 +32,8 @@
 			},
 			"isBackground": true,
 			"presentation": {
-				"group": "watch",
-				"reveal": "never"
-			}
-		},
-		{
-			"label": "npm: build:webview",
-			"type": "npm",
-			"script": "build:webview",
-			"group": "build",
-			"problemMatcher": [],
-			"isBackground": true,
-			"presentation": {
-				"group": "watch",
-				"reveal": "never"
+				"group": "webview-ui",
+				"reveal": "always"
 			}
 		},
 		{
@@ -84,7 +45,7 @@
 			"isBackground": true,
 			"presentation": {
 				"group": "watch",
-				"reveal": "never"
+				"reveal": "always"
 			}
 		},
 		{
@@ -96,7 +57,7 @@
 			"isBackground": true,
 			"presentation": {
 				"group": "watch",
-				"reveal": "never"
+				"reveal": "always"
 			}
 		}
 	]

+ 2 - 0
.vscodeignore

@@ -1,4 +1,6 @@
 # Default
+.github/**
+.husky/**
 .vscode/**
 .vscode-test/**
 out/**

+ 18 - 0
package-lock.json

@@ -56,6 +56,7 @@
 				"@changesets/cli": "^2.27.10",
 				"@changesets/types": "^6.0.0",
 				"@dotenvx/dotenvx": "^1.34.0",
+				"@types/debug": "^4.1.12",
 				"@types/diff": "^5.2.1",
 				"@types/diff-match-patch": "^1.0.36",
 				"@types/jest": "^29.5.14",
@@ -5895,6 +5896,16 @@
 			"resolved": "https://registry.npmjs.org/@types/clone-deep/-/clone-deep-4.0.4.tgz",
 			"integrity": "sha512-vXh6JuuaAha6sqEbJueYdh5zNBPPgG1OYumuz2UvLvriN6ABHDSW8ludREGWJb1MLIzbwZn4q4zUbUCerJTJfA=="
 		},
+		"node_modules/@types/debug": {
+			"version": "4.1.12",
+			"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
+			"integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
+			"dev": true,
+			"license": "MIT",
+			"dependencies": {
+				"@types/ms": "*"
+			}
+		},
 		"node_modules/@types/diff": {
 			"version": "5.2.3",
 			"resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.3.tgz",
@@ -5957,6 +5968,13 @@
 			"integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==",
 			"dev": true
 		},
+		"node_modules/@types/ms": {
+			"version": "2.1.0",
+			"resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
+			"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
+			"dev": true,
+			"license": "MIT"
+		},
 		"node_modules/@types/node": {
 			"version": "20.17.9",
 			"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.9.tgz",

+ 30 - 27
package.json

@@ -289,31 +289,6 @@
 		"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
 		"watch-tests": "tsc -p . -w --outDir out"
 	},
-	"devDependencies": {
-		"@changesets/cli": "^2.27.10",
-		"@changesets/types": "^6.0.0",
-		"@dotenvx/dotenvx": "^1.34.0",
-		"@types/diff": "^5.2.1",
-		"@types/diff-match-patch": "^1.0.36",
-		"@types/jest": "^29.5.14",
-		"@types/mocha": "^10.0.7",
-		"@types/node": "20.x",
-		"@types/string-similarity": "^4.0.2",
-		"@typescript-eslint/eslint-plugin": "^7.14.1",
-		"@typescript-eslint/parser": "^7.11.0",
-		"@vscode/test-cli": "^0.0.9",
-		"@vscode/test-electron": "^2.4.0",
-		"esbuild": "^0.24.0",
-		"eslint": "^8.57.0",
-		"husky": "^9.1.7",
-		"jest": "^29.7.0",
-		"jest-simple-dot-reporter": "^1.0.5",
-		"lint-staged": "^15.2.11",
-		"npm-run-all": "^4.1.5",
-		"prettier": "^3.4.2",
-		"ts-jest": "^29.2.5",
-		"typescript": "^5.4.5"
-	},
 	"dependencies": {
 		"@anthropic-ai/bedrock-sdk": "^0.10.2",
 		"@anthropic-ai/sdk": "^0.26.0",
@@ -359,13 +334,41 @@
 		"web-tree-sitter": "^0.22.6",
 		"zod": "^3.23.8"
 	},
+	"devDependencies": {
+		"@changesets/cli": "^2.27.10",
+		"@changesets/types": "^6.0.0",
+		"@dotenvx/dotenvx": "^1.34.0",
+		"@types/debug": "^4.1.12",
+		"@types/diff": "^5.2.1",
+		"@types/diff-match-patch": "^1.0.36",
+		"@types/jest": "^29.5.14",
+		"@types/mocha": "^10.0.7",
+		"@types/node": "20.x",
+		"@types/string-similarity": "^4.0.2",
+		"@typescript-eslint/eslint-plugin": "^7.14.1",
+		"@typescript-eslint/parser": "^7.11.0",
+		"@vscode/test-cli": "^0.0.9",
+		"@vscode/test-electron": "^2.4.0",
+		"esbuild": "^0.24.0",
+		"eslint": "^8.57.0",
+		"husky": "^9.1.7",
+		"jest": "^29.7.0",
+		"jest-simple-dot-reporter": "^1.0.5",
+		"lint-staged": "^15.2.11",
+		"npm-run-all": "^4.1.5",
+		"prettier": "^3.4.2",
+		"ts-jest": "^29.2.5",
+		"typescript": "^5.4.5"
+	},
 	"lint-staged": {
 		"*.{js,jsx,ts,tsx,json,css,md}": [
 			"prettier --write"
 		],
 		"src/**/*.{ts,tsx}": [
-			"prettier --write",
-			"npx eslint -c .eslintrc.json --fix"
+			"npx eslint -c .eslintrc.json --max-warnings=0 --fix"
+		],
+		"webview-ui/**/*.{ts,tsx}": [
+			"npx eslint -c webview-ui/.eslintrc.json --max-warnings=0 --fix"
 		]
 	}
 }

+ 3 - 0
webview-ui/.eslintrc.json

@@ -0,0 +1,3 @@
+{
+	"extends": "react-app"
+}

Разница между файлами не показана из-за своего большого размера
+ 3915 - 1354
webview-ui/package-lock.json


+ 4 - 2
webview-ui/package.json

@@ -4,11 +4,12 @@
 	"private": true,
 	"type": "module",
 	"scripts": {
+		"lint": "eslint src --ext ts,tsx",
+		"check-types": "tsc --noEmit",
+		"test": "jest",
 		"dev": "vite",
 		"build": "tsc -b && vite build",
 		"preview": "vite preview",
-		"lint": "eslint src --ext ts,tsx",
-		"test": "jest",
 		"storybook": "storybook dev -p 6006",
 		"build-storybook": "storybook build"
 	},
@@ -58,6 +59,7 @@
 		"@typescript-eslint/parser": "^6.21.0",
 		"@vitejs/plugin-react": "^4.3.4",
 		"eslint": "^8.57.0",
+		"eslint-config-react-app": "^7.0.1",
 		"eslint-plugin-react": "^7.33.2",
 		"eslint-plugin-react-hooks": "^4.6.0",
 		"eslint-plugin-storybook": "^0.11.2",

+ 1 - 0
webview-ui/src/components/chat/ChatTextArea.tsx

@@ -238,6 +238,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
 					}, 0)
 				}
 			},
+			// eslint-disable-next-line react-hooks/exhaustive-deps
 			[setInputValue, cursorPosition],
 		)
 

+ 1 - 0
webview-ui/src/components/prompts/PromptsView.tsx

@@ -192,6 +192,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
 		setNewModeRoleDefinition("")
 		setNewModeCustomInstructions("")
 		setNewModeGroups(availableGroups)
+		// eslint-disable-next-line react-hooks/exhaustive-deps
 	}, [newModeName, newModeSlug, newModeRoleDefinition, newModeCustomInstructions, newModeGroups, updateCustomMode])
 
 	const isNameOrSlugTaken = useCallback(

Некоторые файлы не были показаны из-за большого количества измененных файлов