diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..7095e7fb0e983b91fb878d3fe87e30da16fd9aec --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*] +indent_size = 2 +end_of_line = lf +insert_final_newline = true diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000000000000000000000000000000..c6a6b19ee7ff2ae70a6dda9ca0d6ef148196e8cb --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +auto-imports.d.ts +components.d.ts +env.d.ts +pnpm-lock.yaml +*.md +iconfont.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000000000000000000000000000000000..52626cc8c00109d009016613fff37cd117ee16d9 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,121 @@ +const INLINE_ELEMENTS = [ + "a", + "abbr", + "audio", + "b", + "bdi", + "bdo", + "canvas", + "cite", + "code", + "data", + "del", + "dfn", + "em", + "i", + "iframe", + "ins", + "kbd", + "label", + "map", + "mark", + "noscript", + "object", + "output", + "picture", + "q", + "ruby", + "s", + "samp", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "time", + "u", + "var", + "video", +]; + +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + node: true, + }, + parser: "vue-eslint-parser", + extends: [ + "plugin:vue/vue3-recommended", + "eslint:recommended", + ], + parserOptions: { + ecmaVersion: 2021, + }, + rules: { + "quote-props": ["error", "as-needed"], + "import/prefer-default-export": "off", + "no-param-reassign": "off", + "space-before-function-paren": ["error", "never"], + "no-unused-vars": "off", + "no-undef": "off", // auto import + "prefer-rest-params": "off", + "vue/script-setup-uses-vars": "off", + "@typescript-eslint/no-unused-vars": "off", + // "@typescript-eslint/no-explicit-any": "off", + // "@typescript-eslint/no-var-requires": "off", + "no-empty-function": "off", + "no-non-null-assertion": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + quotes: [2, "double"], + semi: [2, "always"], + "vue/html-closing-bracket-newline": [ + 2, + { + singleline: "never", + multiline: "never", + }, + ], + "vue/singleline-html-element-content-newline": "off", + "vue/max-attributes-per-line": [ + 2, + { + singleline: 3, + multiline: 1, + }, + ], + "vue/html-self-closing": [ + "error", + { + html: { + normal: "never", + void: "always", + }, + svg: "always", + math: "always", + }, + ], + "vue/no-unused-vars": [ + "error", + { + ignorePattern: "^[_scope]", + }, + ], + "vue/no-setup-props-destructure": "off", + "vue/no-mutating-props": "off", + "eslint no-empty": "off", + "vue/multiline-html-element-content-newline": [ + "error", + { + ignoreWhenEmpty: true, + ignores: ["el-button", ...INLINE_ELEMENTS], + allowEmptyLines: false, + }, + ], + }, +}; diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000000000000000000000000000000000..a2414270955b0a818f87ba6d354dff12e1c28a79 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +node_modules +dist +pnpm-lock.yaml +auto-imports.d.ts +components.d.ts diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000000000000000000000000000000000..88c01176f27e9071ccb5783e6a9415da64c3a646 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "$schema": "http://json.schemastore.org/prettierrc", + "semi": true, + "singleQuote": false +} diff --git a/package.json b/package.json index b9297b0fbe4eb12cb4b74589a3e6a2181401804a..cb3bcec59ae055174649c579e8deaae63c767cd8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "lint": "eslint --ext .js,vue --ignore-pattern '!.*ignore' .", + "lint:fix": "pnpm lint --fix" }, "dependencies": { "@element-plus/icons-vue": "^2.0.10", @@ -22,6 +24,9 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^4.0.0", + "eslint": "^8.34.0", + "eslint-define-config": "^1.15.0", + "eslint-plugin-vue": "^9.9.0", "sass": "^1.58.2", "vite": "^4.1.1" } diff --git a/src/App.vue b/src/App.vue index 5aabe202d88b326857092d41ed83e7f0946398e9..52d5f5f9e5be6b975c7c2f915142f8c53201ac4e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -121,7 +121,7 @@ const { title: cardTitle, icon: cardIcon } = toRefs(card);
序号
- +{{ $index + 1 }}
@@ -39,13 +44,16 @@
- + -
-
排名
- -
-
+
{{ header.label }}
+{{ header.label }}
- -