- tsconfig: noImplicitAny:true + jsx:react-jsx + target:ES2018 + skipLibCheck - 新增 eslint.config.mjs (flat config v9, no-explicit-any:error) - 新增 .prettierrc + lint/format/typecheck 脚本 - prod: pure_funcs 添加 console.warn 防泄漏 - config: 生产环境强制清空 DEV_USER/DEV_PASS - .env.production: 清空硬编码 tenant_id - @types/node + @noble/ciphers 依赖
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import js from '@eslint/js';
|
|
import ts from '@typescript-eslint/eslint-plugin';
|
|
import tsParser from '@typescript-eslint/parser';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
|
|
export default [
|
|
{ ignores: ['dist/', 'dist-h5/', 'lib/', 'node_modules/', 'config/'] },
|
|
{
|
|
files: ['src/**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
parserOptions: {
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
ecmaFeatures: { jsx: true },
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': ts,
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
rules: {
|
|
...js.configs.recommended.rules,
|
|
...ts.configs.recommended.rules,
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
},
|
|
},
|
|
];
|