diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 0000000..214388f
--- /dev/null
+++ b/.browserslistrc
@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not dead
diff --git a/.eslintrc.js b/.eslintrc.js
index f2900fc..5ed7f6f 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -13,28 +13,50 @@ module.exports = {
jsxPragma: 'React',
ecmaFeatures: {
jsx: true,
+ tsx: true,
},
},
+ plugins: ['@typescript-eslint', 'prettier', 'import'],
extends: [
- 'plugin:vue/vue3-recommended',
+ 'eslint:recommended',
'plugin:@typescript-eslint/recommended',
+ 'plugin:vue/vue3-recommended',
'prettier',
- 'plugin:prettier/recommended',
+ ],
+ overrides: [
+ {
+ files: ['*.ts', '*.tsx', '*.vue'],
+ rules: {
+ 'no-undef': 'off',
+ },
+ },
],
rules: {
- 'vue/script-setup-uses-vars': 'error',
- '@typescript-eslint/ban-ts-ignore': 'off',
- '@typescript-eslint/explicit-function-return-type': 'off',
- '@typescript-eslint/no-explicit-any': 'off',
- '@typescript-eslint/no-var-requires': 'off',
- '@typescript-eslint/no-empty-function': 'off',
- 'vue/custom-event-name-casing': 'off',
- 'no-use-before-define': 'off',
- '@typescript-eslint/no-use-before-define': 'off',
+ // js/ts
+ // 'no-console': ['warn', { allow: ['error'] }],
+ 'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
+ camelcase: ['error', { properties: 'never' }],
+
+ 'no-var': 'error',
+ 'no-empty': ['error', { allowEmptyCatch: true }],
+ 'no-void': 'error',
+ 'prefer-const': ['warn', { destructuring: 'all', ignoreReadBeforeAssign: true }],
+ 'prefer-template': 'error',
+ 'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }],
+ 'block-scoped-var': 'error',
+ 'no-constant-condition': ['error', { checkLoops: false }],
+
+ 'no-redeclare': 'off',
+ '@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
- '@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
+ '@typescript-eslint/no-empty-function': 'off',
+ '@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/no-non-null-assertion': 'off',
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
+ // '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
+ '@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
@@ -49,29 +71,42 @@ module.exports = {
varsIgnorePattern: '^_',
},
],
- 'space-before-function-paren': 'off',
- 'vue/attributes-order': 'off',
- 'vue/one-component-per-file': 'off',
- 'vue/html-closing-bracket-newline': 'off',
- 'vue/max-attributes-per-line': 'off',
- 'vue/multiline-html-element-content-newline': 'off',
- 'vue/singleline-html-element-content-newline': 'off',
- 'vue/attribute-hyphenation': 'off',
+ // vue
+ 'vue/no-v-html': 'off',
'vue/require-default-prop': 'off',
'vue/require-explicit-emits': 'off',
- 'vue/html-self-closing': [
+ 'vue/multi-word-component-names': 'off',
+
+ // prettier
+ 'prettier/prettier': 'error',
+
+ // import
+ 'import/first': 'error',
+ 'import/no-duplicates': 'error',
+ 'import/order': [
'error',
{
- html: {
- void: 'always',
- normal: 'never',
- component: 'always',
- },
- svg: 'always',
- math: 'always',
+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
+
+ pathGroups: [
+ {
+ pattern: 'vue',
+ group: 'external',
+ position: 'before',
+ },
+ {
+ pattern: '@vue/**',
+ group: 'external',
+ position: 'before',
+ },
+ {
+ pattern: 'ant-design-vue',
+ group: 'internal',
+ },
+ ],
+ pathGroupsExcludedImportTypes: ['type'],
},
],
- 'vue/multi-word-component-names': 'off',
},
};
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..d6e52a9
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,6 @@
+* text=auto eol=lf
+*.ts linguist-detectable=false
+*.css linguist-detectable=false
+*.scss linguist-detectable=false
+*.js linguist-detectable=true
+*.vue linguist-detectable=true
diff --git a/.gitignore b/.gitignore
index a4b670d..24d8efc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,7 +17,7 @@ tests/server/static/upload
npm-debug.log*
yarn-debug.log*
yarn-error.log*
-pnpm-debug.log*
+*pnpm-debug.log*
# Editor directories and files
.idea
diff --git a/.husky/lintstagedrc.js b/.husky/lintstagedrc.js
deleted file mode 100644
index 89fe808..0000000
--- a/.husky/lintstagedrc.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = {
- '*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
- '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'],
- 'package.json': ['prettier --write'],
- '*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
- '*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'],
- '*.md': ['prettier --write']
-}
diff --git a/.husky/pre-commit b/.husky/pre-commit
index c7d15f2..35f9242 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -6,5 +6,3 @@
# Format and submit code according to lintstagedrc.js configuration
npm run lint:lint-staged
-
-npm run lint:pretty
diff --git a/.prettierignore b/.prettierignore
index f7e39e6..a2e7ec0 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -3,6 +3,8 @@
.output.js
/node_modules/**
+.yarnrc
+
**/*.svg
**/*.sh
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 0af47de..f7e6b5f 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -1,6 +1,6 @@
{
"recommendations": [
- "octref.vetur",
+ "vue.volar",
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"esbenp.prettier-vscode",
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 5f36eaf..fc029e3 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -88,7 +88,8 @@
},
"[vue]": {
"editor.codeActionsOnSave": {
- "source.fixAll.eslint": false
+ "source.fixAll.eslint": true,
+ "source.fixAll.stylelint": true
}
},
"i18n-ally.localesPaths": ["src/locales/lang"],
diff --git a/.yarnrc b/.yarnrc
index d82a8f2..35966a4 100644
--- a/.yarnrc
+++ b/.yarnrc
@@ -1,8 +1,8 @@
-registry "https://registry.npm.taobao.org"
+registry "https://registry.npmmirror.com"
-sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
+sass_binary_site "https://npmmirror.com/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
-electron_mirror "https://npm.taobao.org/mirrors/electron/"
+electron_mirror "https://npmmirror.com/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
-profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
+profiler_binary_host_mirror "https://npmmirror.com/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"
diff --git a/commitlint.config.js b/commitlint.config.js
index ac977af..5459887 100644
--- a/commitlint.config.js
+++ b/commitlint.config.js
@@ -7,6 +7,7 @@ module.exports = {
'header-max-length': [2, 'always', 108],
'subject-empty': [2, 'never'],
'type-empty': [2, 'never'],
+ 'subject-case': [0],
'type-enum': [
2,
'always',
diff --git a/components.d.ts b/components.d.ts
index 521cd1f..fab20ee 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -1,8 +1,9 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
-// Read more: https://github.com/vuejs/vue-next/pull/3399
+// Read more: https://github.com/vuejs/core/pull/3399
+import '@vue/runtime-core';
-declare module 'vue' {
+declare module '@vue/runtime-core' {
export interface GlobalComponents {
Empty: typeof import('./src/components/empty.vue')['default'];
FieldAreaPicker: typeof import('./src/components/field-area-picker.vue')['default'];
@@ -11,6 +12,8 @@ declare module 'vue' {
FieldPicker: typeof import('./src/components/field-picker.vue')['default'];
ListCard: typeof import('./src/components/list-card.vue')['default'];
PersonSelect: typeof import('./src/components/person-select.vue')['default'];
+ RouterLink: typeof import('vue-router')['RouterLink'];
+ RouterView: typeof import('vue-router')['RouterView'];
SearchPerson: typeof import('./src/components/search-person.vue')['default'];
VanCard: typeof import('vant/es')['Card'];
VanGrid: typeof import('vant/es')['Grid'];
diff --git a/package.json b/package.json
index 5b4e5f0..ca3cabd 100644
--- a/package.json
+++ b/package.json
@@ -3,75 +3,83 @@
"version": "0.0.0",
"homepage": "git@buqiyuan.github.io/vite-vue3-h5",
"scripts": {
+ "serve": "npm run dev",
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"deploy": "gh-pages -d dist",
"format": "prettier --write ./src",
- "lint": "eslint ./src --ext .vue,.js,.ts,.tsx",
- "lint-fix": "eslint --fix ./src --ext .vue,.js,.ts,.tsx",
- "lint:eslint": "eslint \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
- "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
- "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
- "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
- "lint:pretty": "pretty-quick --staged",
+ "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
+ "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
+ "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
+ "lint:lint-staged": "lint-staged",
"prepare": "husky install",
+ "postversion": "git push && git push origin --tags",
+ "reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run dev",
+ "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
"test:gzip": "npx http-server dist --cors --gzip -c-1",
"test:br": "npx http-server dist --cors --brotli -c-1"
},
"dependencies": {
- "@vant/area-data": "^1.2.4",
+ "@vant/area-data": "^1.3.1",
"@vant/touch-emulator": "^1.3.2",
- "@vueuse/core": "^8.3.1",
+ "@vueuse/core": "^8.7.5",
"axios": "^0.27.2",
- "dayjs": "^1.11.1",
- "lodash": "^4.17.21",
+ "dayjs": "^1.11.3",
+ "lodash-es": "^4.17.21",
"pinia": "^2.0.13",
- "qs": "^6.10.3",
- "vant": "^3.4.8",
+ "qs": "^6.11.0",
+ "vant": "^4.0.0-alpha.4",
"vconsole": "^3.14.6",
- "vue": "^3.2.33",
- "vue-router": "^4.0.14"
+ "vue": "^3.2.37",
+ "vue-router": "^4.0.16"
},
"devDependencies": {
- "@commitlint/cli": "^16.2.4",
- "@commitlint/config-conventional": "^16.2.4",
+ "@commitlint/cli": "^17.0.3",
+ "@commitlint/config-conventional": "^17.0.3",
"@types/lodash": "^4.14.182",
- "@types/node": "^17.0.30",
- "@typescript-eslint/eslint-plugin": "^5.21.0",
- "@typescript-eslint/parser": "^5.21.0",
- "@vitejs/plugin-legacy": "^1.8.1",
- "@vitejs/plugin-vue": "^2.3.1",
+ "@types/node": "^18.0.0",
+ "@typescript-eslint/eslint-plugin": "^5.30.0",
+ "@typescript-eslint/parser": "^5.30.0",
+ "@vitejs/plugin-legacy": "^1.8.2",
+ "@vitejs/plugin-vue": "^2.3.3",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/compiler-sfc": "3.2.33",
- "@vue/eslint-config-typescript": "^10.0.0",
+ "@vue/eslint-config-typescript": "^11.0.0",
"commitizen": "^4.2.4",
+ "conventional-changelog-cli": "^2.2.2",
"cz-conventional-changelog": "^3.3.0",
- "cz-customizable": "^6.3.0",
- "eslint": "^8.14.0",
+ "eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
- "eslint-plugin-prettier": "^4.0.0",
- "eslint-plugin-vue": "^8.7.1",
- "gh-pages": "^3.2.3",
- "husky": "^7.0.4",
- "lint-staged": "^12.4.1",
+ "eslint-plugin-import": "^2.26.0",
+ "eslint-plugin-prettier": "^4.1.0",
+ "eslint-plugin-vue": "^9.1.1",
+ "gh-pages": "^4.0.0",
+ "husky": "^8.0.1",
+ "lint-staged": "^13.0.3",
"mockjs": "^1.1.0",
+ "postcss": "^8.4.14",
"postcss-html": "^1.4.1",
- "prettier": "^2.6.2",
- "pretty-quick": "^3.1.3",
- "sass": "^1.51.0",
- "stylelint": "^14.8.1",
+ "postcss-scss": "^4.0.4",
+ "prettier": "^2.7.1",
+ "sass": "^1.53.0",
+ "stylelint": "^14.9.1",
"stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3",
- "stylelint-config-standard": "^25.0.0",
+ "stylelint-config-recommended": "^8.0.0",
+ "stylelint-config-recommended-vue": "^1.4.0",
+ "stylelint-config-standard": "^26.0.0",
"stylelint-order": "^5.0.0",
"stylelint-scss": "^4.2.0",
- "typescript": "^4.6.4",
- "vite": "^2.9.6",
+ "typescript": "^4.7.4",
+ "unplugin-vue-components": "^0.20.1",
+ "unplugin-vue-define-options": "^0.6.1",
+ "vite": "^2.9.13",
+ "vite-plugin-checker": "^0.4.6",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-style-import": "^1.4.1",
- "vue-eslint-parser": "^8.3.0",
- "vue-tsc": "^0.34.11"
+ "vue-eslint-parser": "^9.0.3",
+ "vue-tsc": "^0.38.2"
},
"license": "MIT",
"engines": {
@@ -83,7 +91,7 @@
"prettier --write"
],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
- "prettier --write--parser json"
+ "prettier --write"
],
"package.json": [
"prettier --write"
diff --git a/prettier.config.js b/prettier.config.js
index 51f8d01..d878021 100644
--- a/prettier.config.js
+++ b/prettier.config.js
@@ -7,4 +7,5 @@ module.exports = {
proseWrap: 'never',
htmlWhitespaceSensitivity: 'strict',
endOfLine: 'auto',
+ useTabs: false,
};
diff --git a/src/App.vue b/src/App.vue
index f04c8ca..37298f3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,18 +1,10 @@
-
-
-
+
-
+