refactor(mp): Phase 0 工程基础 — TS strict + ESLint + Prettier + 安全加固
- 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 依赖
This commit is contained in:
35
apps/miniprogram/eslint.config.mjs
Normal file
35
apps/miniprogram/eslint.config.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
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'] }],
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user