Fix: Fixed an issue where ESLint suggestions were not working in VS Code after upgrading to Vite. #12483 (#12484)

### What problem does this PR solve?

Fix: Fixed an issue where ESLint suggestions were not working in VS Code
after upgrading to Vite. #12483

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2026-01-07 14:32:17 +08:00
committed by GitHub
parent 671e719d75
commit a442c9cac6
4 changed files with 1800 additions and 91 deletions

76
web/.eslintrc.cjs Normal file
View File

@ -0,0 +1,76 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
plugins: ['@typescript-eslint', 'react', 'react-refresh', 'check-file'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
env: {
browser: true,
es2021: true,
node: true,
},
rules: {
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
variables: true,
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unescaped-entities': [
'warn',
{
forbid: [
{
char: "'",
alternatives: [''', '''],
},
{
char: '"',
alternatives: ['"', '"'],
},
],
},
],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'no-console': ['warn', { allow: ['warn', 'error'] }],
'check-file/filename-naming-convention': [
'error',
{
'**/*.{jsx,tsx}': '[a-z0-9.-]*',
'**/*.{js,ts}': '[a-z0-9.-]*',
},
],
'check-file/folder-naming-convention': [
'error',
{
'src/**/': 'KEBAB_CASE',
'mocks/*/': 'KEBAB_CASE',
},
],
},
};

View File

@ -1,43 +0,0 @@
// .eslintrc.js
module.exports = {
extends: [require.resolve('umi/eslint'), 'plugin:react-hooks/recommended'],
plugins: ['check-file'],
rules: {
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
variables: true,
},
],
'check-file/filename-naming-convention': [
'error',
{
'**/*.{jsx,tsx}': '[a-z0-9.-]*',
'**/*.{js,ts}': '[a-z0-9.-]*',
},
],
'check-file/folder-naming-convention': [
'error',
{
'src/**/': 'KEBAB_CASE',
'mocks/*/': 'KEBAB_CASE',
},
],
'react/no-unescaped-entities': [
'warn',
{
forbid: [
{
char: "'",
alternatives: [''', '''],
},
{
char: '"',
alternatives: ['"', '"'],
},
],
},
],
},
};

1767
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -154,13 +154,16 @@
"@types/testing-library__jest-dom": "^6.0.0", "@types/testing-library__jest-dom": "^6.0.0",
"@types/uuid": "^9.0.8", "@types/uuid": "^9.0.8",
"@types/webpack-env": "^1.18.4", "@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^8.52.0",
"@typescript-eslint/parser": "^8.52.0",
"@vitejs/plugin-react": "^5.1.2", "@vitejs/plugin-react": "^5.1.2",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.56.0", "eslint": "^8.56.0",
"eslint-plugin-check-file": "^2.8.0", "eslint-plugin-check-file": "^2.8.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5", "eslint-plugin-react-refresh": "^0.4.26",
"eslint-plugin-storybook": "^9.1.4", "eslint-plugin-storybook": "^9.1.4",
"html-loader": "^5.1.0", "html-loader": "^5.1.0",
"husky": "^9.0.11", "husky": "^9.0.11",