mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 07:55:53 +08:00
build: add eslint common rule
This commit is contained in:
parent
2094c54951
commit
0ae085b48a
@ -1,8 +1,9 @@
|
|||||||
import { stylistic, typescript, combine, javascript } from '@antfu/eslint-config'
|
import { stylistic, typescript, combine, javascript, GLOB_TESTS, GLOB_JSX, GLOB_TSX } from '@antfu/eslint-config'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import js from '@eslint/js'
|
import js from '@eslint/js'
|
||||||
import { FlatCompat } from '@eslint/eslintrc'
|
import { FlatCompat } from '@eslint/eslintrc'
|
||||||
|
import globals from 'globals'
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = path.dirname(__filename)
|
const __dirname = path.dirname(__filename)
|
||||||
@ -65,7 +66,12 @@ export default combine(
|
|||||||
"ts/no-empty-object-type": "off",
|
"ts/no-empty-object-type": "off",
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// javascript(),
|
javascript({
|
||||||
|
overrides: {
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'no-use-before-define': 'off'
|
||||||
|
}
|
||||||
|
}),
|
||||||
// TODO: remove this when upgrade to nextjs 15
|
// TODO: remove this when upgrade to nextjs 15
|
||||||
compat.extends('next'),
|
compat.extends('next'),
|
||||||
{
|
{
|
||||||
@ -89,6 +95,9 @@ export default combine(
|
|||||||
"react-hooks/exhaustive-deps": "warn",
|
"react-hooks/exhaustive-deps": "warn",
|
||||||
"react/display-name": "off",
|
"react/display-name": "off",
|
||||||
"curly": "off",
|
"curly": "off",
|
||||||
|
"unused-imports/no-unused-vars": "warn",
|
||||||
|
"unused-imports/no-unused-imports": "warn",
|
||||||
|
"no-undef": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
storybook,
|
storybook,
|
||||||
@ -96,7 +105,39 @@ export default combine(
|
|||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// not exist in old version
|
// not exist in old version
|
||||||
"antfu/consistent-list-newline": "off"
|
"antfu/consistent-list-newline": "off",
|
||||||
|
|
||||||
|
// useful, but big change
|
||||||
|
"no-useless-constructor": "off",
|
||||||
|
"no-undef": "warn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// suppress error for `no-undef` rule
|
||||||
|
{
|
||||||
|
files: GLOB_TESTS,
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.es2021,
|
||||||
|
...globals.node,
|
||||||
|
...globals.jest
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
GLOB_JSX,
|
||||||
|
GLOB_TSX,
|
||||||
|
'**/hooks/*'
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.es2025,
|
||||||
|
...globals.node,
|
||||||
|
'React': 'readable',
|
||||||
|
'JSX': 'readable',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
"echarts-for-react": "^3.0.2",
|
"echarts-for-react": "^3.0.2",
|
||||||
"emoji-mart": "^5.5.2",
|
"emoji-mart": "^5.5.2",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
|
"globals": "^15.11.0",
|
||||||
"i18next": "^22.4.13",
|
"i18next": "^22.4.13",
|
||||||
"i18next-resources-to-backend": "^1.1.3",
|
"i18next-resources-to-backend": "^1.1.3",
|
||||||
"immer": "^9.0.19",
|
"immer": "^9.0.19",
|
||||||
@ -110,6 +111,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^3.8.0",
|
"@antfu/eslint-config": "^3.8.0",
|
||||||
"@chromatic-com/storybook": "^1.9.0",
|
"@chromatic-com/storybook": "^1.9.0",
|
||||||
|
"@eslint-react/eslint-plugin": "^1.15.0",
|
||||||
"@eslint/eslintrc": "^3.1.0",
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
"@eslint/js": "^9.13.0",
|
"@eslint/js": "^9.13.0",
|
||||||
"@faker-js/faker": "^7.6.0",
|
"@faker-js/faker": "^7.6.0",
|
||||||
@ -147,8 +149,10 @@
|
|||||||
"bing-translate-api": "^4.0.2",
|
"bing-translate-api": "^4.0.2",
|
||||||
"code-inspector-plugin": "^0.13.0",
|
"code-inspector-plugin": "^0.13.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^9.10.0",
|
"eslint": "^9.13.0",
|
||||||
"eslint-config-next": "^15.0.0-canary.202",
|
"eslint-config-next": "^15.0.0-canary.202",
|
||||||
|
"eslint-plugin-react-hooks": "^5.0.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.12",
|
||||||
"eslint-plugin-storybook": "^0.9.0",
|
"eslint-plugin-storybook": "^0.9.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
@ -161,10 +165,7 @@
|
|||||||
"tailwindcss": "^3.4.4",
|
"tailwindcss": "^3.4.4",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "4.9.5",
|
"typescript": "4.9.5",
|
||||||
"uglify-js": "^3.17.4",
|
"uglify-js": "^3.17.4"
|
||||||
"@eslint-react/eslint-plugin": "^1.15.0",
|
|
||||||
"eslint-plugin-react-hooks": "^5.0.0",
|
|
||||||
"eslint-plugin-react-refresh": "^0.4.12"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@types/react": "~18.2.0",
|
"@types/react": "~18.2.0",
|
||||||
|
5
web/pnpm-lock.yaml
generated
5
web/pnpm-lock.yaml
generated
@ -100,6 +100,9 @@ importers:
|
|||||||
fast-deep-equal:
|
fast-deep-equal:
|
||||||
specifier: ^3.1.3
|
specifier: ^3.1.3
|
||||||
version: 3.1.3
|
version: 3.1.3
|
||||||
|
globals:
|
||||||
|
specifier: ^15.11.0
|
||||||
|
version: 15.11.0
|
||||||
i18next:
|
i18next:
|
||||||
specifier: ^22.4.13
|
specifier: ^22.4.13
|
||||||
version: 22.5.1
|
version: 22.5.1
|
||||||
@ -381,7 +384,7 @@ importers:
|
|||||||
specifier: ^7.0.3
|
specifier: ^7.0.3
|
||||||
version: 7.0.3
|
version: 7.0.3
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^9.10.0
|
specifier: ^9.13.0
|
||||||
version: 9.13.0(jiti@1.21.6)
|
version: 9.13.0(jiti@1.21.6)
|
||||||
eslint-config-next:
|
eslint-config-next:
|
||||||
specifier: ^15.0.0-canary.202
|
specifier: ^15.0.0-canary.202
|
||||||
|
Loading…
x
Reference in New Issue
Block a user