chore: 统一代码风格并配置ESLint和Prettier
配置ESLint和Prettier规则 添加前端和后端的忽略文件 统一代码格式和缩进 修复代码风格问题
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# 构建输出
|
||||
dist/
|
||||
build/
|
||||
|
||||
# 依赖
|
||||
node_modules/
|
||||
|
||||
# 日志
|
||||
logs/
|
||||
*.log
|
||||
|
||||
# 数据库
|
||||
*.db
|
||||
*.sqlite
|
||||
|
||||
# 上传文件
|
||||
uploads/
|
||||
|
||||
# 其他
|
||||
.DS_Store
|
||||
@@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
es2021: true,
|
||||
jest: true
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:prettier/recommended'
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module'
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
||||
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
|
||||
'no-undef': 'error',
|
||||
'no-unreachable': 'error',
|
||||
'no-unused-expressions': 'error',
|
||||
'eqeqeq': ['error', 'always'],
|
||||
'curly': ['error', 'all'],
|
||||
'no-var': 'error',
|
||||
'prefer-const': 'error'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "es5",
|
||||
"printWidth": 100,
|
||||
"bracketSpacing": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
Generated
+2631
-3
File diff suppressed because it is too large
Load Diff
+12
-1
@@ -7,7 +7,11 @@
|
||||
"dev": "nodemon server.js",
|
||||
"create-indexes": "node create_indexes.js",
|
||||
"check-indexes": "node create_indexes.js check",
|
||||
"drop-indexes": "node create_indexes.js drop"
|
||||
"drop-indexes": "node create_indexes.js drop",
|
||||
"lint": "eslint . --ext js --report-unused-disable-directives --max-warnings 0",
|
||||
"lint:fix": "eslint . --ext js --fix",
|
||||
"format": "prettier --write \"**/*.js\"",
|
||||
"format:check": "prettier --check \"**/*.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.13.4",
|
||||
@@ -31,8 +35,15 @@
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.0",
|
||||
"jest": "^30.2.0",
|
||||
"nodemon": "^3.0.1",
|
||||
"prettier": "^3.8.1",
|
||||
"supertest": "^7.1.4"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user