Skip to content

Commit

Permalink
处理eslint格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
gaojianghua committed Apr 4, 2024
1 parent 8c3dbbc commit fd6ce27
Show file tree
Hide file tree
Showing 49 changed files with 1,821 additions and 929 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
51 changes: 32 additions & 19 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
// .eslintrc.js

process.env.ESLINT_TSCONFIG = 'tsconfig.json';

module.exports = {
env: {
browser: true,
es2021: true
es2022: true
},
extends: [
'plugin:prettier/recommended',
'plugin:vue/vue3-recommended',
'plugin:vue/recommended', // Changed to support Vue 2 and Vue 3
'plugin:@typescript-eslint/recommended',
'plugin:nuxt/recommended',
"plugin:tailwindcss/recommended",
"@antfu"
'plugin:tailwindcss/recommended'
],
parserOptions: {
ecmaVersion: 'latest',
ecmaVersion: 2023, // Updated ECMAScript version
parser: '@typescript-eslint/parser',
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'tailwindcss'],
rules: {
'vue/multi-word-component-names': 0, //关闭vue文件和组件命名校验
indent: ['error', 4],
'@typescript-eslint/no-unused-vars': 'off',
'tailwindcss/no-custom-classname': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'vue/multi-word-component-names': 0,
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/max-attributes-per-line': 0,
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'prettier/prettier': [
'no-console': 'off',
'no-debugger': 'off',
// Remove conflicting rules with Prettier
'prettier/prettier': 'off',
'vue/html-indent': [
'error',
4,
{
printWidth: 140, //代码单行长度
tabWidth: 4, //tab键缩进为2空格
useTabs: false, //使用空格缩进
singleQuote: true, //js单引号
semi: false, //去分号
// trailingComma: 'none', //无尾逗号
arrowParens: 'avoid', //箭头函数尽可能省略括号
jsxBracketSameLine: true //标签换行后>单独一行
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: []
}
]
},
settings: {
tailwindcss: {
includeLanguages: ['html', 'vue', 'js', 'jsx', 'tsx'] // Specify which file types Tailwind CSS should be checked against
}
}
}
};
17 changes: 17 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
/*打印宽度,超过后,会将属性换行*/
printWidth: 120,
/*禁止使用尾随逗号,对象和数组最后一个逗号去掉*/
trailingComma: 'none',
/*在对象字面量中的括号之间添加空格*/
bracketSpacing: true,
/*使用单引号而不是双引号来定义字符串*/
singleQuote: true,
/*当箭头函数只有一个参数时,省略参数前后的括号*/
arrowParens: 'avoid',
/*script和style标签中间的内容缩进*/
vueIndentScriptAndStyle: true,
// 将>多行 HTML(HTML、JSX、Vue、Angular)元素放在最后一行的末尾,而不是单独放在下一行(不适用于自闭合元素
bracketSameLine: true,
tabWidth: 4
};
26 changes: 17 additions & 9 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ module.exports = {
'wip',
'workflow',
'types',
'release',
],
],
'release'
]
]
},
prompt: {
messages: {
Expand All @@ -56,7 +56,7 @@ module.exports = {
footerPrefixsSelect: '选择关联issue前缀(可选):',
customFooterPrefixs: '输入自定义issue前缀 :',
footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
confirmCommit: '是否提交或修改commit ?',
confirmCommit: '是否提交或修改commit ?'
},
types: [
// 英文
Expand Down Expand Up @@ -91,10 +91,18 @@ module.exports = {
{ value: 'refactor', name: 'refactor: ♻️ 代码重构(不包括 bug 修复、功能新增)', emoji: '♻️' },
{ value: 'perf', name: 'perf: ⚡️ 性能优化', emoji: '⚡️' },
{ value: 'test', name: 'test: ✅ 添加疏漏测试或已有测试改动', emoji: '✅' },
{ value: 'build', name: 'build: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)', emoji: '📦️' },
{
value: 'build',
name: 'build: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)',
emoji: '📦️'
},
{ value: 'ci', name: 'ci: 🎡 修改 CI 配置、脚本', emoji: '🎡' },
{ value: 'revert', name: 'revert: ⏪️ 回滚 commit', emoji: '⏪️' },
{ value: 'chore', name: 'chore: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)', emoji: '🔨' },
{
value: 'chore',
name: 'chore: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)',
emoji: '🔨'
}
],
useEmoji: true,
themeColorCode: '',
Expand Down Expand Up @@ -123,6 +131,6 @@ module.exports = {
defaultBody: '',
defaultIssues: '',
defaultScope: '',
defaultSubject: '',
},
}
defaultSubject: ''
}
};
119 changes: 63 additions & 56 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,72 @@
*
* Copyright (c) 2023 by 15257184434 [email protected], All Rights Reserved.
*/
import { defineNuxtConfig } from 'nuxt/config'
import { defineNuxtConfig } from 'nuxt/config';

export default defineNuxtConfig({
srcDir: 'src/',
build: {
transpile: ['dayjs'],
},
components: [
{
path: '@/components/public',
extensions: ['.vue'],
srcDir: 'src/',
build: {
transpile: ['dayjs']
},
],
runtimeConfig: {
public: {
apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL
},
},
modules: ['@pinia/nuxt', '@vueuse/nuxt', '@nuxtjs/tailwindcss'],
css: ['~/assets/styles/init.css'],
app: {
head: {
charset: 'utf-8',
title: 'Gao Blog',
meta: [
{ name: 'description', content: '高江华的博客' },
{ name: 'author', content: '高江华, [email protected]' },
{ name: 'keywords', content: '高江华, 博客, vue, react, nuxt, next, nest, uniapp, 小程序, app, html, js, css, scss, less' },
{ name: 'robots', content: 'index,follow' },
{ name: 'viewport', content: 'initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no' },
{ name: 'apple-mobile-web-app-title', content: '高江华的博客' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'renderer', content: 'webkit' },
{ name: 'HandheldFriendly', content: 'true' },
{ name: 'generator', content: 'VsCode Nuxt3' },
{ name: 'copyright', content: '高江华' },
{ name: 'revisit-after', content: '7 days' },
{ name: 'cache-control', content: 'no-cache' },
{ name: 'x-dns-prefetch-control', content: 'on' },
{ name: 'og:type', content: 'website' },
{ name: 'og:url', content: 'https://docs.gaojianghua.cn' },
{ name: 'og:title', content: 'Wolffy-Document' },
{ name: 'og:image', content: 'https://gaojianghua.oss-cn-hangzhou.aliyuncs.com/home/%E7%81%B0%E5%A4%AA%E7%8B%BC.png' },
{
name: 'og:description',
content:
'技术博客--前端后端运维知识点收录: Vue, React, Taro, ReactNative, Webpack, Vite, UniApp, 小程序, H5, Docker, Git, GoLang, Node, Nest, Mysql, Redis, 数据结构, 算法',
},
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: 'https://blog-cli.oss-cn-hangzhou.aliyuncs.com/logo.ico'},
{ rel: 'dns-prefetch', href: 'https://blog-cli.oss-cn-hangzhou.aliyuncs.com' },
{ rel: 'dns-prefetch', href: 'https://docs.gaojianghua.cn' }
],
script: [
components: [
{
src: 'https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/svg_28150_11.961f67029185d625b7656c914468febb.js'
path: '@/components/public',
extensions: ['.vue']
}
],
runtimeConfig: {
public: {
apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL
}
]
},
},
})
modules: ['@pinia/nuxt', '@vueuse/nuxt', '@nuxtjs/tailwindcss'],
css: ['~/assets/styles/init.css'],
app: {
head: {
charset: 'utf-8',
title: 'Gao Blog',
meta: [
{ name: 'description', content: '高江华的博客' },
{ name: 'author', content: '高江华, [email protected]' },
{
name: 'keywords',
content:
'高江华, 博客, vue, react, nuxt, next, nest, uniapp, 小程序, app, html, js, css, scss, less'
},
{ name: 'robots', content: 'index,follow' },
{ name: 'viewport', content: 'initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no' },
{ name: 'apple-mobile-web-app-title', content: '高江华的博客' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'renderer', content: 'webkit' },
{ name: 'HandheldFriendly', content: 'true' },
{ name: 'generator', content: 'VsCode Nuxt3' },
{ name: 'copyright', content: '高江华' },
{ name: 'revisit-after', content: '7 days' },
{ name: 'cache-control', content: 'no-cache' },
{ name: 'x-dns-prefetch-control', content: 'on' },
{ name: 'og:type', content: 'website' },
{ name: 'og:url', content: 'https://docs.gaojianghua.cn' },
{ name: 'og:title', content: 'Wolffy-Document' },
{
name: 'og:image',
content: 'https://gaojianghua.oss-cn-hangzhou.aliyuncs.com/home/%E7%81%B0%E5%A4%AA%E7%8B%BC.png'
},
{
name: 'og:description',
content:
'技术博客--前端后端运维知识点收录: Vue, React, Taro, ReactNative, Webpack, Vite, UniApp, 小程序, H5, Docker, Git, GoLang, Node, Nest, Mysql, Redis, 数据结构, 算法'
}
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: 'https://blog-cli.oss-cn-hangzhou.aliyuncs.com/logo.ico' },
{ rel: 'dns-prefetch', href: 'https://blog-cli.oss-cn-hangzhou.aliyuncs.com' },
{ rel: 'dns-prefetch', href: 'https://docs.gaojianghua.cn' }
],
script: [
{
src: 'https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/svg_28150_11.961f67029185d625b7656c914468febb.js'
}
]
}
}
});
Loading

0 comments on commit fd6ce27

Please sign in to comment.