Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: add code style (#242)

Joel091beffae79b
diff --git a/.gitignore b/.gitignore
index 50f682499e2..6324233829b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,7 +130,6 @@ dmypy.json
.idea/'
.DS_Store
-.vscode
# Intellij IDEA Files
.idea/
diff --git a/web/.eslintignore b/web/.eslintignore
new file mode 100644
index 00000000000..8a8bc38d805
--- /dev/null
+++ b/web/.eslintignore
@@ -0,0 +1,7 @@
+/**/node_modules/*
+node_modules/
+
+dist/
+build/
+out/
+.next/
\ No newline at end of file
diff --git a/web/.eslintrc.json b/web/.eslintrc.json
index db813b0b253..9d8ea2cc8d8 100644
--- a/web/.eslintrc.json
+++ b/web/.eslintrc.json
@@ -23,6 +23,6 @@
]
}
],
- "react-hooks/exhaustive-deps": "warning"
+ "react-hooks/exhaustive-deps": "warn"
}
-}
+}
\ No newline at end of file
diff --git a/web/.husky/pre-commit b/web/.husky/pre-commit
new file mode 100755
index 00000000000..7a8fabf9e89
--- /dev/null
+++ b/web/.husky/pre-commit
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+cd ./web && npx lint-staged
diff --git a/web/.vscode/settings.json b/web/.vscode/settings.json
new file mode 100644
index 00000000000..0b5ecc7e772
--- /dev/null
+++ b/web/.vscode/settings.json
@@ -0,0 +1,23 @@
+{
+ "prettier.enable": false,
+ "editor.formatOnSave": true,
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": true
+ },
+ "eslint.format.enable": true,
+ "[python]": {
+ "editor.formatOnType": true
+ },
+ "[html]": {
+ "editor.defaultFormatter": "vscode.html-language-features"
+ },
+ "[typescriptreact]": {
+ "editor.defaultFormatter": "vscode.typescript-language-features"
+ },
+ "[javascriptreact]": {
+ "editor.defaultFormatter": "vscode.typescript-language-features"
+ },
+ "[jsonc]": {
+ "editor.defaultFormatter": "vscode.json-language-features"
+ }
+}
\ No newline at end of file
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/layout.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/layout.tsx
index b70959ea79a..7164a00be09 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/layout.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/layout.tsx
@@ -7,9 +7,9 @@ export type IAppDetail = {
const AppDetail: FC<IAppDetail> = ({ children }) => {
return (
- <>
- {children}
- </>
+ <>
+ {children}
+ </>
)
}
diff --git a/web/package.json b/web/package.json
index 76158c7730e..89d44ed2b69 100644
--- a/web/package.json
+++ b/web/package.json
@@ -7,7 +7,9 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
- "fix": "next lint --fix"
+ "fix": "next lint --fix",
+ "eslint-fix": "eslint --fix",
+ "prepare": "cd ../ && husky install ./web/.husky"
},
"dependencies": {
"@emoji-mart/data": "^1.1.2",
@@ -78,8 +80,18 @@
"@types/qs": "^6.9.7",
"autoprefixer": "^10.4.14",
"eslint-plugin-react-hooks": "^4.6.0",
+ "husky": "^8.0.3",
+ "lint-staged": "^13.2.2",
"miragejs": "^0.1.47",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.7"
+ },
+ "lint-staged": {
+ "**/*.js?(x)": [
+ "eslint --fix"
+ ],
+ "**/*.ts?(x)": [
+ "eslint --fix"
+ ]
}
-}
+}
\ No newline at end of file