feat: add h1 element

This commit is contained in:
LSF 2025-07-10 11:58:13 +08:00
parent d55b8b69cf
commit c220a75bbc
5 changed files with 63 additions and 66 deletions

4
.husky/commit-msg Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm commitlint

View File

@ -1,77 +1,77 @@
import js from "@eslint/js"; import js from '@eslint/js'
import globals from "globals"; import globals from 'globals'
import tseslint from "typescript-eslint"; import tseslint from 'typescript-eslint'
import pluginVue from "eslint-plugin-vue"; import pluginVue from 'eslint-plugin-vue'
import { defineConfig } from "eslint/config"; import { defineConfig } from 'eslint/config'
export default defineConfig([ export default defineConfig([
{ {
ignores: [ ignores: [
"**/dist/**", // 忽略所有 dist 文件夹 '**/dist/**', // 忽略所有 dist 文件夹
"**/node_modules/**" // 忽略所有 node_modules '**/node_modules/**', // 忽略所有 node_modules
] ],
}, },
// 1. 使用 ESLint 官方推荐规则 // 1. 使用 ESLint 官方推荐规则
js.configs.recommended, js.configs.recommended,
// 2. 设置全局变量浏览器、Node.js、ES2021、Jest // 2. 设置全局变量浏览器、Node.js、ES2021、Jest
{ {
files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}"], files: ['**/*.{js,mjs,cjs,ts,mts,cts,vue}'],
languageOptions: { languageOptions: {
globals: { globals: {
...globals.browser, // 浏览器全局变量(如 `window`, `document` ...globals.browser, // 浏览器全局变量(如 `window`, `document`
...globals.es2021, // ES2021 全局变量(如 `Promise`, `Map` ...globals.es2021, // ES2021 全局变量(如 `Promise`, `Map`
...globals.node, // Node.js 全局变量(如 `require`, `process` ...globals.node, // Node.js 全局变量(如 `require`, `process`
...{ jest: "readonly" } // Jest 测试框架全局变量(如 `describe`, `test` ...{ jest: 'readonly' }, // Jest 测试框架全局变量(如 `describe`, `test`
} },
} },
}, },
// 3. 添加 TypeScript 支持(使用 `@typescript-eslint` 推荐规则) // 3. 添加 TypeScript 支持(使用 `@typescript-eslint` 推荐规则)
...tseslint.configs.recommended, ...tseslint.configs.recommended,
// 4. 添加 Vue 3 支持(使用 `eslint-plugin-vue` 基础规则) // 4. 添加 Vue 3 支持(使用 `eslint-plugin-vue` 基础规则)
...pluginVue.configs["flat/essential"], ...pluginVue.configs['flat/essential'],
// 5. 针对 `.vue` 文件的解析配置 // 5. 针对 `.vue` 文件的解析配置
{ {
files: ["**/*.vue"], files: ['**/*.vue'],
languageOptions: { languageOptions: {
parserOptions: { parserOptions: {
ecmaVersion: "latest", // 使用最新的 ECMAScript 版本 ecmaVersion: 'latest', // 使用最新的 ECMAScript 版本
sourceType: "module", // 使用 ES Module 语法 sourceType: 'module', // 使用 ES Module 语法
jsxPragma: "React", // 如果用了 JSX指定 React 作为全局变量 jsxPragma: 'React', // 如果用了 JSX指定 React 作为全局变量
ecmaFeatures: { ecmaFeatures: {
jsx: true // 启用 JSX 支持 jsx: true, // 启用 JSX 支持
} },
} },
} },
}, },
// 6. 自定义规则(覆盖或扩展默认规则) // 6. 自定义规则(覆盖或扩展默认规则)
{ {
rules: { rules: {
// ESLint 基础规则 // ESLint 基础规则
"no-var": "error", // 禁止使用 `var`,必须用 `let` 或 `const` 'no-var': 'error', // 禁止使用 `var`,必须用 `let` 或 `const`
"no-multiple-empty-lines": ["warn", { max: 1 }], // 最多允许 1 个空行 'no-multiple-empty-lines': ['warn', { max: 1 }], // 最多允许 1 个空行
"no-console": process.env.NODE_ENV === "production" ? "error" : "off", // 生产环境禁止 `console` 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', // 生产环境禁止 `console`
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", // 生产环境禁止 `debugger` 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', // 生产环境禁止 `debugger`
"no-unexpected-multiline": "error", // 禁止意外的多行代码 'no-unexpected-multiline': 'error', // 禁止意外的多行代码
"no-useless-escape": "off", // 允许不必要的转义字符(如 `\/` 'no-useless-escape': 'off', // 允许不必要的转义字符(如 `\/`
// TypeScript 规则 // TypeScript 规则
"@typescript-eslint/no-unused-vars": "error", // 禁止未使用的变量 '@typescript-eslint/no-unused-vars': 'error', // 禁止未使用的变量
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止 `@ts-ignore`,推荐用 `@ts-expect-error` '@typescript-eslint/prefer-ts-expect-error': 'error', // 禁止 `@ts-ignore`,推荐用 `@ts-expect-error`
"@typescript-eslint/no-explicit-any": "off", // 允许使用 `any` 类型 '@typescript-eslint/no-explicit-any': 'off', // 允许使用 `any` 类型
"@typescript-eslint/no-non-null-assertion": "off", // 允许 `!` 非空断言 '@typescript-eslint/no-non-null-assertion': 'off', // 允许 `!` 非空断言
"@typescript-eslint/no-namespace": "off", // 允许使用 `namespace` '@typescript-eslint/no-namespace': 'off', // 允许使用 `namespace`
"@typescript-eslint/semi": "off", // 不强制分号 '@typescript-eslint/semi': 'off', // 不强制分号
// Vue 规则 // Vue 规则
"vue/multi-word-component-names": "off", // 允许单单词组件名(如 `Home.vue` 'vue/multi-word-component-names': 'off', // 允许单单词组件名(如 `Home.vue`
"vue/script-setup-uses-vars": "error", // 确保 `<script setup>` 的变量在 `<template>` 里可用 'vue/script-setup-uses-vars': 'error', // 确保 `<script setup>` 的变量在 `<template>` 里可用
"vue/no-mutating-props": "off", // 允许直接修改 `props`(不推荐,但有时需要) 'vue/no-mutating-props': 'off', // 允许直接修改 `props`(不推荐,但有时需要)
"vue/attribute-hyphenation": "off" // 允许非连字符式属性名(如 `:customProp` 'vue/attribute-hyphenation': 'off', // 允许非连字符式属性名(如 `:customProp`
} },
} },
]); ])

12
pnpm-lock.yaml generated
View File

@ -55,8 +55,8 @@ importers:
specifier: ^16.3.0 specifier: ^16.3.0
version: 16.3.0 version: 16.3.0
husky: husky:
specifier: ^9.1.7 specifier: ^8.0.0
version: 9.1.7 version: 8.0.3
postcss: postcss:
specifier: ^8.5.6 specifier: ^8.5.6
version: 8.5.6 version: 8.5.6
@ -1628,9 +1628,9 @@ packages:
htmlparser2@8.0.2: htmlparser2@8.0.2:
resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==} resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}
husky@9.1.7: husky@8.0.3:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==} resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==}
engines: {node: '>=18'} engines: {node: '>=14'}
hasBin: true hasBin: true
ieee754@1.2.1: ieee754@1.2.1:
@ -4302,7 +4302,7 @@ snapshots:
domutils: 3.2.2 domutils: 3.2.2
entities: 4.5.0 entities: 4.5.0
husky@9.1.7: {} husky@8.0.3: {}
ieee754@1.2.1: {} ieee754@1.2.1: {}

View File

@ -1,12 +1,7 @@
<template> <template>
<div> <div>
<h1>我增加l一个新标题</h1>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup></script>
<style scoped></style>
</script>
<style scoped>
</style>

View File

@ -11,5 +11,3 @@ const app = createApp(App)
app.use(ElementPlus) app.use(ElementPlus)
//挂载APP实例到#app元素上 //挂载APP实例到#app元素上
app.mount('#app') app.mount('#app')