feat: add h1 element
This commit is contained in:
parent
d55b8b69cf
commit
c220a75bbc
4
.husky/commit-msg
Normal file
4
.husky/commit-msg
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm commitlint
|
100
eslint.config.js
100
eslint.config.js
@ -1,77 +1,77 @@
|
||||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import tseslint from "typescript-eslint";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import { defineConfig } from "eslint/config";
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import pluginVue from 'eslint-plugin-vue'
|
||||
import { defineConfig } from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
ignores: [
|
||||
"**/dist/**", // 忽略所有 dist 文件夹
|
||||
"**/node_modules/**" // 忽略所有 node_modules
|
||||
]
|
||||
'**/dist/**', // 忽略所有 dist 文件夹
|
||||
'**/node_modules/**', // 忽略所有 node_modules
|
||||
],
|
||||
},
|
||||
// 1. 使用 ESLint 官方推荐规则
|
||||
js.configs.recommended,
|
||||
|
||||
|
||||
// 2. 设置全局变量(浏览器、Node.js、ES2021、Jest)
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}"],
|
||||
files: ['**/*.{js,mjs,cjs,ts,mts,cts,vue}'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser, // 浏览器全局变量(如 `window`, `document`)
|
||||
...globals.es2021, // ES2021 全局变量(如 `Promise`, `Map`)
|
||||
...globals.node, // Node.js 全局变量(如 `require`, `process`)
|
||||
...{ jest: "readonly" } // Jest 测试框架全局变量(如 `describe`, `test`)
|
||||
}
|
||||
}
|
||||
...globals.browser, // 浏览器全局变量(如 `window`, `document`)
|
||||
...globals.es2021, // ES2021 全局变量(如 `Promise`, `Map`)
|
||||
...globals.node, // Node.js 全局变量(如 `require`, `process`)
|
||||
...{ jest: 'readonly' }, // Jest 测试框架全局变量(如 `describe`, `test`)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
// 3. 添加 TypeScript 支持(使用 `@typescript-eslint` 推荐规则)
|
||||
...tseslint.configs.recommended,
|
||||
|
||||
|
||||
// 4. 添加 Vue 3 支持(使用 `eslint-plugin-vue` 基础规则)
|
||||
...pluginVue.configs["flat/essential"],
|
||||
|
||||
...pluginVue.configs['flat/essential'],
|
||||
|
||||
// 5. 针对 `.vue` 文件的解析配置
|
||||
{
|
||||
files: ["**/*.vue"],
|
||||
files: ['**/*.vue'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest", // 使用最新的 ECMAScript 版本
|
||||
sourceType: "module", // 使用 ES Module 语法
|
||||
jsxPragma: "React", // 如果用了 JSX,指定 React 作为全局变量
|
||||
ecmaVersion: 'latest', // 使用最新的 ECMAScript 版本
|
||||
sourceType: 'module', // 使用 ES Module 语法
|
||||
jsxPragma: 'React', // 如果用了 JSX,指定 React 作为全局变量
|
||||
ecmaFeatures: {
|
||||
jsx: true // 启用 JSX 支持
|
||||
}
|
||||
}
|
||||
}
|
||||
jsx: true, // 启用 JSX 支持
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
// 6. 自定义规则(覆盖或扩展默认规则)
|
||||
{
|
||||
rules: {
|
||||
// ESLint 基础规则
|
||||
"no-var": "error", // 禁止使用 `var`,必须用 `let` 或 `const`
|
||||
"no-multiple-empty-lines": ["warn", { max: 1 }], // 最多允许 1 个空行
|
||||
"no-console": process.env.NODE_ENV === "production" ? "error" : "off", // 生产环境禁止 `console`
|
||||
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", // 生产环境禁止 `debugger`
|
||||
"no-unexpected-multiline": "error", // 禁止意外的多行代码
|
||||
"no-useless-escape": "off", // 允许不必要的转义字符(如 `\/`)
|
||||
|
||||
'no-var': 'error', // 禁止使用 `var`,必须用 `let` 或 `const`
|
||||
'no-multiple-empty-lines': ['warn', { max: 1 }], // 最多允许 1 个空行
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', // 生产环境禁止 `console`
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', // 生产环境禁止 `debugger`
|
||||
'no-unexpected-multiline': 'error', // 禁止意外的多行代码
|
||||
'no-useless-escape': 'off', // 允许不必要的转义字符(如 `\/`)
|
||||
|
||||
// TypeScript 规则
|
||||
"@typescript-eslint/no-unused-vars": "error", // 禁止未使用的变量
|
||||
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止 `@ts-ignore`,推荐用 `@ts-expect-error`
|
||||
"@typescript-eslint/no-explicit-any": "off", // 允许使用 `any` 类型
|
||||
"@typescript-eslint/no-non-null-assertion": "off", // 允许 `!` 非空断言
|
||||
"@typescript-eslint/no-namespace": "off", // 允许使用 `namespace`
|
||||
"@typescript-eslint/semi": "off", // 不强制分号
|
||||
|
||||
'@typescript-eslint/no-unused-vars': 'error', // 禁止未使用的变量
|
||||
'@typescript-eslint/prefer-ts-expect-error': 'error', // 禁止 `@ts-ignore`,推荐用 `@ts-expect-error`
|
||||
'@typescript-eslint/no-explicit-any': 'off', // 允许使用 `any` 类型
|
||||
'@typescript-eslint/no-non-null-assertion': 'off', // 允许 `!` 非空断言
|
||||
'@typescript-eslint/no-namespace': 'off', // 允许使用 `namespace`
|
||||
'@typescript-eslint/semi': 'off', // 不强制分号
|
||||
|
||||
// Vue 规则
|
||||
"vue/multi-word-component-names": "off", // 允许单单词组件名(如 `Home.vue`)
|
||||
"vue/script-setup-uses-vars": "error", // 确保 `<script setup>` 的变量在 `<template>` 里可用
|
||||
"vue/no-mutating-props": "off", // 允许直接修改 `props`(不推荐,但有时需要)
|
||||
"vue/attribute-hyphenation": "off" // 允许非连字符式属性名(如 `:customProp`)
|
||||
}
|
||||
}
|
||||
]);
|
||||
'vue/multi-word-component-names': 'off', // 允许单单词组件名(如 `Home.vue`)
|
||||
'vue/script-setup-uses-vars': 'error', // 确保 `<script setup>` 的变量在 `<template>` 里可用
|
||||
'vue/no-mutating-props': 'off', // 允许直接修改 `props`(不推荐,但有时需要)
|
||||
'vue/attribute-hyphenation': 'off', // 允许非连字符式属性名(如 `:customProp`)
|
||||
},
|
||||
},
|
||||
])
|
||||
|
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@ -55,8 +55,8 @@ importers:
|
||||
specifier: ^16.3.0
|
||||
version: 16.3.0
|
||||
husky:
|
||||
specifier: ^9.1.7
|
||||
version: 9.1.7
|
||||
specifier: ^8.0.0
|
||||
version: 8.0.3
|
||||
postcss:
|
||||
specifier: ^8.5.6
|
||||
version: 8.5.6
|
||||
@ -1628,9 +1628,9 @@ packages:
|
||||
htmlparser2@8.0.2:
|
||||
resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}
|
||||
|
||||
husky@9.1.7:
|
||||
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
|
||||
engines: {node: '>=18'}
|
||||
husky@8.0.3:
|
||||
resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
|
||||
ieee754@1.2.1:
|
||||
@ -4302,7 +4302,7 @@ snapshots:
|
||||
domutils: 3.2.2
|
||||
entities: 4.5.0
|
||||
|
||||
husky@9.1.7: {}
|
||||
husky@8.0.3: {}
|
||||
|
||||
ieee754@1.2.1: {}
|
||||
|
||||
|
11
src/App.vue
11
src/App.vue
@ -1,12 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<h1>我增加l一个新标题</h1>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
|
||||
</style>
|
||||
<script lang="ts" setup></script>
|
||||
<style scoped></style>
|
||||
|
@ -11,5 +11,3 @@ const app = createApp(App)
|
||||
app.use(ElementPlus)
|
||||
//挂载APP实例到#app元素上
|
||||
app.mount('#app')
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user