feat: add git hooks & eslint
This commit is contained in:
parent
aec1e8a71a
commit
0a6263c240
|
|
@ -0,0 +1,39 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'plugin:vue/vue3-essential',
|
||||
'eslint:recommended',
|
||||
'@vue/typescript/recommended',
|
||||
'@vue/eslint-config-typescript',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
],
|
||||
plugins: ['import'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
},
|
||||
rules: {
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'import/no-named-as-default': 'off',
|
||||
'import/namespace': [2, { allowComputed: true }],
|
||||
'import/no-named-as-default-member': 'off',
|
||||
'import/no-unresolved': [2, { ignore: ['^@'] }],
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
// enUS: all rules docs https://eslint.org/docs/rules/
|
||||
// zhCN: 所有规则文档 https://eslint.bootcss.com/docs/rules/
|
||||
// 基础规则 全部 ES 项目通用
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'quote-props': 'off',
|
||||
// 禁止混合使用不同的操作符 'error','off'
|
||||
'no-mixed-operators': 'off',
|
||||
// 禁止未使用过的变量 default: ['error', { vars: 'local' }]
|
||||
'no-unused-vars': ['off'],
|
||||
// 强制在代码块中开括号前和闭括号后有空格
|
||||
'block-spacing': ['error', 'always'],
|
||||
'object-curly-spacing': ['error', 'always']
|
||||
},
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
node scripts/verifyCommit.js
|
||||
node scripts/verifyCommit.js
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npm run lint
|
||||
|
|
@ -4,7 +4,9 @@
|
|||
"scripts": {
|
||||
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"build:dev": "vue-tsc --noEmit && vite build --mode=development",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"lint": "eslint --fix --ext .js,vue src/",
|
||||
"preview": "vite preview",
|
||||
"plop": "plop"
|
||||
},
|
||||
|
|
@ -24,10 +26,16 @@
|
|||
"@types/node": "^17.0.36",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/store": "^2.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
||||
"@typescript-eslint/parser": "^5.27.1",
|
||||
"@vitejs/plugin-vue": "^2.3.3",
|
||||
"@vue/eslint-config-typescript": "^10.0.0",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"consola": "^2.15.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.17.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-vue": "^9.1.0",
|
||||
"express": "4.17.3",
|
||||
"husky": "^8.0.1",
|
||||
"less": "^4.1.2",
|
||||
|
|
|
|||
Loading…
Reference in New Issue