mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 08:46:58 +08:00
feat: add ESLint and Prettier with pre-commit hook
- Install ESLint 9 with TypeScript and React support - Install Prettier with custom configuration (no semicolons) - Add husky and lint-staged for pre-commit hooks - Configure lint-staged to auto-fix and format on commit - Relax ESLint rules to avoid large-scale code changes - Format all existing code with Prettier (no semicolons) Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
@@ -53,24 +53,32 @@ export default [
|
||||
// React rules
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/prop-types': 'off',
|
||||
// 该规则在 TS 项目中经常与 TS 的类型检查重复,关闭以避免误报
|
||||
'no-undef': 'off',
|
||||
|
||||
// TypeScript rules
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
// 放宽以下规则以避免在不改变功能的情况下大面积改动代码
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['warn', {
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_'
|
||||
}],
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
|
||||
// React Refresh
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true }
|
||||
],
|
||||
'react-refresh/only-export-components': 'off',
|
||||
|
||||
// General rules
|
||||
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
||||
'no-debugger': 'warn'
|
||||
'no-console': 'off',
|
||||
'no-debugger': 'off',
|
||||
|
||||
// 新版 react-hooks 推荐规则在本项目会造成大量误报,关闭以免影响开发体验
|
||||
'react-hooks/set-state-in-effect': 'off',
|
||||
'react-hooks/static-components': 'off',
|
||||
'react-hooks/preserve-manual-memoization': 'off',
|
||||
|
||||
// 某些字符串中包含未转义字符用于展示,关闭以避免不必要的修改
|
||||
'react/no-unescaped-entities': 'off',
|
||||
|
||||
// 可视情况关闭依赖数组校验(如需严格可改为 'warn')
|
||||
'react-hooks/exhaustive-deps': 'off'
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
|
||||
Reference in New Issue
Block a user