mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
build: add eslint common rule
This commit is contained in:
parent
586f056868
commit
a5f2812f55
|
@ -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 { fileURLToPath } from 'node:url'
|
||||
import js from '@eslint/js'
|
||||
import { FlatCompat } from '@eslint/eslintrc'
|
||||
import globals from 'globals'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
@ -65,7 +66,12 @@ export default combine(
|
|||
"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
|
||||
compat.extends('next'),
|
||||
{
|
||||
|
@ -89,6 +95,9 @@ export default combine(
|
|||
"react-hooks/exhaustive-deps": "warn",
|
||||
"react/display-name": "off",
|
||||
"curly": "off",
|
||||
"unused-imports/no-unused-vars": "warn",
|
||||
"unused-imports/no-unused-imports": "warn",
|
||||
"no-undef": "error"
|
||||
}
|
||||
},
|
||||
storybook,
|
||||
|
@ -96,7 +105,39 @@ export default combine(
|
|||
{
|
||||
rules: {
|
||||
// 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",
|
||||
"emoji-mart": "^5.5.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"globals": "^15.11.0",
|
||||
"i18next": "^22.4.13",
|
||||
"i18next-resources-to-backend": "^1.1.3",
|
||||
"immer": "^9.0.19",
|
||||
|
@ -110,6 +111,7 @@
|
|||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^3.8.0",
|
||||
"@chromatic-com/storybook": "^1.9.0",
|
||||
"@eslint-react/eslint-plugin": "^1.15.0",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.13.0",
|
||||
"@faker-js/faker": "^7.6.0",
|
||||
|
@ -147,8 +149,10 @@
|
|||
"bing-translate-api": "^4.0.2",
|
||||
"code-inspector-plugin": "^0.13.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^9.10.0",
|
||||
"eslint": "^9.13.0",
|
||||
"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",
|
||||
"husky": "^8.0.3",
|
||||
"jest": "^29.7.0",
|
||||
|
@ -161,10 +165,7 @@
|
|||
"tailwindcss": "^3.4.4",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "4.9.5",
|
||||
"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"
|
||||
"uglify-js": "^3.17.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "~18.2.0",
|
||||
|
|
|
@ -100,6 +100,9 @@ importers:
|
|||
fast-deep-equal:
|
||||
specifier: ^3.1.3
|
||||
version: 3.1.3
|
||||
globals:
|
||||
specifier: ^15.11.0
|
||||
version: 15.11.0
|
||||
i18next:
|
||||
specifier: ^22.4.13
|
||||
version: 22.5.1
|
||||
|
@ -381,7 +384,7 @@ importers:
|
|||
specifier: ^7.0.3
|
||||
version: 7.0.3
|
||||
eslint:
|
||||
specifier: ^9.10.0
|
||||
specifier: ^9.13.0
|
||||
version: 9.13.0(jiti@1.21.6)
|
||||
eslint-config-next:
|
||||
specifier: ^15.0.0-canary.202
|
||||
|
|
Loading…
Reference in New Issue
Block a user