mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 20:54:14 +00:00
Step 0 of the planned vue->react migration. React 19, antd 5, i18next
+ react-i18next, typescript 5, and @vitejs/plugin-react 6 are added as
dev/runtime deps alongside the existing vue stack. Both frameworks
coexist in the build until the last entry flips.
* vite.config.js: react() plugin runs next to vue(); new manualChunks
for vendor-react / vendor-antd-react / vendor-icons-react /
vendor-i18next. Existing vue chunks unchanged.
* eslint.config.js: typescript-eslint + eslint-plugin-react-hooks
rules scoped to *.{ts,tsx}; vue config untouched for *.{js,vue}.
* tsconfig.json: strict, jsx: react-jsx, moduleResolution: bundler,
allowJs: true (lets .tsx files import the remaining .js modules
during incremental migration), @/* path alias.
* env.d.ts: Vite client types + window.X_UI_BASE_PATH typing +
SubPageData shape consumed by the subscription page.
Vite stays pinned at 8.0.13 per the existing project policy. No
existing .vue/.js source files touched in this step.
eslint-plugin-react (not -hooks) is not included because its latest
release does not yet support ESLint 10. react-hooks/purity covers
the safety-critical case; revisit when the plugin updates.
86 lines
2.6 KiB
JavaScript
86 lines
2.6 KiB
JavaScript
import js from '@eslint/js';
|
|
import vue from 'eslint-plugin-vue';
|
|
import vueParser from 'vue-eslint-parser';
|
|
import tseslint from 'typescript-eslint';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import globals from 'globals';
|
|
|
|
export default [
|
|
{ ignores: ['node_modules/**', '../web/dist/**'] },
|
|
js.configs.recommended,
|
|
...vue.configs['flat/recommended'],
|
|
{
|
|
files: ['**/*.{js,vue}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
parser: vueParser,
|
|
parserOptions: {
|
|
ecmaFeatures: { jsx: false },
|
|
},
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node,
|
|
},
|
|
},
|
|
rules: {
|
|
'no-unused-vars': ['warn', {
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
caughtErrorsIgnorePattern: '^_',
|
|
}],
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
'no-case-declarations': 'off',
|
|
|
|
// Stylistic rules from vue/recommended that don't match the
|
|
// existing codebase formatting. Disable rather than churn the
|
|
// whole tree to satisfy them.
|
|
'vue/multi-word-component-names': 'off',
|
|
'vue/no-v-html': 'off',
|
|
'vue/html-self-closing': 'off',
|
|
'vue/max-attributes-per-line': 'off',
|
|
'vue/singleline-html-element-content-newline': 'off',
|
|
'vue/multiline-html-element-content-newline': 'off',
|
|
'vue/html-indent': 'off',
|
|
'vue/html-closing-bracket-newline': 'off',
|
|
'vue/attributes-order': 'off',
|
|
'vue/first-attribute-linebreak': 'off',
|
|
'vue/one-component-per-file': 'off',
|
|
'vue/order-in-components': 'off',
|
|
'vue/attribute-hyphenation': 'off',
|
|
'vue/v-on-event-hyphenation': 'off',
|
|
|
|
// Pervasive in form components ported from the Vue 2 codebase
|
|
// (parent passes a reactive object; child mutates it in place).
|
|
// Properly fixing this means rewiring those components to emit
|
|
// updates — a meaningful architectural change, separate task.
|
|
'vue/no-mutating-props': 'off',
|
|
},
|
|
},
|
|
...tseslint.configs.recommended.map((config) => ({
|
|
...config,
|
|
files: ['**/*.{ts,tsx}'],
|
|
})),
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
},
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
caughtErrorsIgnorePattern: '^_',
|
|
}],
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
},
|
|
},
|
|
];
|