1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-04-30 22:29:01 +08:00

chore: eslint 替换为 @antfu/eslint-config,集成 lint-staged 和 simple-git-hooks

This commit is contained in:
zclzone 2024-06-06 17:26:55 +08:00
parent 004ef366f2
commit 98f9d5893a
8 changed files with 5261 additions and 2679 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -1,4 +0,0 @@
node_modules
dist
public
package.json

View File

@ -1,3 +0,0 @@
/node_modules/**
/dist/*
/public/*

View File

@ -1,7 +0,0 @@
{
"printWidth": 100,
"singleQuote": true,
"semi": false,
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "ignore"
}

44
.vscode/settings.json vendored
View File

@ -1,25 +1,27 @@
{
"files.eol": "\n",
"files.associations": {
"*.env.*": "dotenv",
"*.svg": "html",
"*.css": "scss"
// Enable the ESlint flat config support
// (remove this if your ESLint extension above v3.0.5)
"eslint.experimental.useFlatConfig": true,
"prettier.enable": false,
"editor.formatOnSave": false,
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"editor.formatOnSave": false,
"[html][css][less][scss][sass][yaml][yml][jsonc][json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["javascript", "typescript", "javascriptreact", "typescriptreact", "vue"],
"eslint.options": {
"overrideConfigFile": "package.json"
}
// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc"
]
}

28
eslint.config.js Normal file
View File

@ -0,0 +1,28 @@
import antfu from '@antfu/eslint-config'
export default antfu({
unocss: true,
formatters: true,
stylistic: true,
rules: {
'n/prefer-global/process': 'off',
'no-undef': 'error',
'no-fallthrough': 'off',
'vue/block-order': 'off',
},
languageOptions: {
globals: {
h: 'readonly',
provide: 'readonly',
inject: 'readonly',
markRaw: 'readonly',
defineAsyncComponent: 'readonly',
nextTick: 'readonly',
useRoute: 'readonly',
useRouter: 'readonly',
Message: 'readonly',
Modal: 'readonly',
NProgress: 'readonly',
},
},
})

View File

@ -1,18 +1,20 @@
{
"name": "vue-naive-admin",
"private": true,
"version": "2.0.0",
"type": "module",
"version": "2.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint:fix": "eslint --fix --ext .js,.vue ."
"lint:fix": "eslint --fix",
"postinstall": "npx simple-git-hooks",
"up": "taze major -I"
},
"dependencies": {
"@arco-design/color": "^0.4.0",
"@vueuse/core": "^10.9.0",
"axios": "^1.6.8",
"@vueuse/core": "^10.10.0",
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"echarts": "^5.5.0",
"lodash-es": "^4.17.21",
@ -20,39 +22,40 @@
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"vue": "^3.4.27",
"vue-echarts": "^6.7.2",
"vue-echarts": "^6.7.3",
"vue-router": "^4.3.2",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@iconify/json": "^2.2.210",
"@iconify/utils": "^2.1.23",
"@unocss/eslint-config": "^0.58.9",
"@unocss/preset-rem-to-px": "^0.59.4",
"@vitejs/plugin-vue": "^5.0.4",
"@antfu/eslint-config": "^2.20.0",
"@iconify/json": "^2.2.216",
"@iconify/utils": "^2.1.24",
"@unocss/eslint-config": "^0.60.4",
"@unocss/eslint-plugin": "^0.60.4",
"@unocss/preset-rem-to-px": "^0.60.4",
"@vitejs/plugin-vue": "^5.0.5",
"@zclzone/eslint-config": "^0.0.5",
"eslint": "^9.4.0",
"eslint-plugin-format": "^0.1.1",
"esno": "^4.7.0",
"fs-extra": "^11.2.0",
"glob": "^10.3.15",
"glob": "^10.4.1",
"lint-staged": "^15.2.5",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.1",
"unocss": "^0.59.4",
"sass": "^1.77.4",
"simple-git-hooks": "^2.11.1",
"taze": "^0.13.8",
"unocss": "^0.60.4",
"unplugin-auto-import": "^0.17.6",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.2.11",
"unplugin-vue-components": "^0.27.0",
"vite": "^5.2.12",
"vite-plugin-router-warn": "^1.0.0",
"vite-plugin-vue-devtools": "^7.2.0"
"vite-plugin-vue-devtools": "^7.2.1"
},
"eslintConfig": {
"extends": [
"@zclzone",
"@unocss",
".eslint-global-variables.json"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
}
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}

7674
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff