ci:修改.prettierrc.cjs、package.json并格式化

This commit is contained in:
佚名程序员 2023-03-08 10:02:46 +08:00
parent d663378365
commit 8de364c82f
67 changed files with 1968 additions and 1978 deletions

View File

@ -1,21 +1,19 @@
# eslint 忽略检查 (根据项目需要自行添加)
node_modules
dist
.idea
.vscode
.hbuilderx
src/manifest.json
src/pages.json
src/tmui/
*.sh
node_modules
*.md
*.woff
*.ttf
*.yaml
dist
# 忽略目录
/dist
/build
/tests
/node_modules
/public
/docs
.husky
.local
/bin
/src/public
/src/static
/src/manifest.json
/vite.config.ts
# node 覆盖率文件
coverage/
# 忽略文件
**/*-min.js
**/*.min.js
**/*-min.css
**/*.min.css

View File

@ -4,11 +4,7 @@ module.exports = {
es2021: true,
},
parser: 'vue-eslint-parser',
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-essential',
'prettier',
],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:vue/vue3-essential', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',

View File

@ -1,20 +1,18 @@
# 忽略格式化文件 (根据项目需要自行添加)
node_modules
dist
.idea
.vscode
.hbuilderx
src/manifest.json
src/pages.json
*.sh
node_modules
*.md
*.woff
*.ttf
*.yaml
dist
# 忽略目录
/dist
/build
/tests
/node_modules
/public
/docs
.husky
.local
/bin
/src/public
/src/static
/src/manifest.json
# node 覆盖率文件
coverage/
# 忽略文件
**/*-min.js
**/*.min.js
**/*-min.css
**/*.min.css

View File

@ -1,25 +1,24 @@
module.exports = {
// 一行最多 160 字符
// .pellerrc 的架构 官网参考https://prettier.io/docs/en/options.html#tab-width
$schema: 'https://json.schemastore.org/prettierrc',
// 一行最多 120 字符
printWidth: 160,
// 不使用缩进符,而使用空格
useTabs: true,
// 使用 2 个空格缩进
// 使用 4 个空格缩进
tabWidth: 4,
tabSize: 4,
// 不使用 tab 缩进,而使用空格
useTabs: false,
// 行尾需要有分号
semi: true,
// 使用单引号
// 使用单引号代替双引号
singleQuote: true,
// 对象的 key 仅在必要时用引号 (可选值as-needed|consistent|preserve)
// 对象的 key 仅在必要时用引号
quoteProps: 'as-needed',
// jsx 不使用单引号,而使用双引号
jsxSingleQuote: false,
// 末尾不需要逗号 'es5' (可选值none|es5|all默认none)
trailingComma: 'es5',
// 大括号内的首尾需要空格
// 末尾使用逗号
trailingComma: 'all',
// 大括号内的首尾需要空格 { foo: bar }
bracketSpacing: true,
// jsx 标签的反尖括号需要换行
jsxBracketSameLine: false,
// 箭头函数,只有一个参数的时候,也需要括号
arrowParens: 'always',
// 每个文件格式化的范围是文件的全部内容
@ -29,12 +28,10 @@ module.exports = {
requirePragma: false,
// 不需要自动在文件开头插入 @prettier
insertPragma: false,
// 使用默认的折行标准 (可选值always|never|preserve)
// 使用默认的折行标准
proseWrap: 'preserve',
// 根据显示样式决定 html 要不要折行 (可选值css|strict|ignore)
// 根据显示样式决定 html 要不要折行
htmlWhitespaceSensitivity: 'css',
// vue脚本文件和样式的缩进
vueIndentScriptAndStyle: false,
// 换行符使用 lf 结尾是 (可选值auto|lf|crlf|cr)
// 换行符使用 lf
endOfLine: 'lf',
};

View File

@ -4,7 +4,6 @@
"kisstkondoros.vscode-gutter-preview", // Image
"ritwickdey.LiveServer", //
"antfu.unocss", // UnoCSS css
"esbenp.prettier-vscode", //
"esbenp.prettier-vscode" //
]
}
}

View File

@ -9,5 +9,5 @@
"source.fixAll": true, //
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
}, //
} //
}

View File

@ -12,14 +12,14 @@
## 简介
- **uni-app Vue3 Vite4 pinia2 TypeScript 基础框架**
- cli创建的Vue3/Vite项目 与 使用HBuilderX导入插件 的包有差异,请直接访问 [开源地址](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template)
- 访问[uniapp插件](https://ext.dcloud.net.cn/plugin?id=8559)
- cli 创建的 Vue3/Vite 项目 与 使用 HBuilderX 导入插件 的包有差异,请直接访问 [开源地址](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template)
- 访问[uniapp 插件](https://ext.dcloud.net.cn/plugin?id=8559)
### 说明
- 框架完全基于Vue3 SFC `<script setup>` 写法,不支持Vue2;
- 框架完全基于 Vue3 SFC `<script setup>` 写法,不支持 Vue2;
- 可用于学习与交流;
- 目前测试H5、微信小程序,APP(Android),支付宝小程序通过;
- 目前测试 H5、微信小程序,APP(Android),支付宝小程序通过;
- 其他平台暂未测试,后续会增加;
- 如发现问题或建议可在评论区留言, 或提[Issues](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/issues)及[PR](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/pulls),会及时处理;
- 如有需求亦可在评论区留言,或在此项目基础上增加;
@ -28,11 +28,11 @@
## 特性
- **最新技术栈**:使用 Vue3/Vite4/pinia ,TypeScript 等前端前沿技术开发;
- **[Unocss](https://github.com/unocss/unocss)**: 原子化CSS, [iconify](https://github.com/iconify/iconify)图标
- **[Unocss](https://github.com/unocss/unocss)**: 原子化 CSS, [iconify](https://github.com/iconify/iconify)图标
- **Eslint/Prettier**: 规范代码格式,统一编码;
- **路由拦截**: 基于uni.addInterceptor进行路由拦截;
- **路由拦截**: 基于 uni.addInterceptor 进行路由拦截;
- **请求拦截**: 核心使用 [luch-request](https://ext.dcloud.net.cn/plugin?id=392),支持请求和响应拦截等;
- **缓存加密**: 使用AES加密缓存,可设置区分在开发或生成环境中是否加密;
- **缓存加密**: 使用 AES 加密缓存,可设置区分在开发或生成环境中是否加密;
## 目录结构
@ -111,21 +111,16 @@
```
## 预览
- H5
![h5](https://api-catch.ranesuangyu.top/images/20220621/364f2b47d91ae5ae82a33d33854e2540.png
)
![h5](https://api-catch.ranesuangyu.top/images/20220621/364f2b47d91ae5ae82a33d33854e2540.png)
- 小程序(体验版-需申请体验)
![小程序](http://api-catch.ranesuangyu.top/images/20220621/8d4388315ef5b8630d0c0b3963d1ba6b.jpg)
## 安装使用
- 安装依赖
@ -155,6 +150,7 @@ pnpm up
# 打开HBuilder X alpha桌面程序-->点击上面的帮助-->历次更新说明-->获取最新版本号3.7.2.20230217-alpha
npx @dcloudio/uvm 3.7.2.20230217-alpha
```
## Git 贡献提交规范
- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))

View File

@ -3,10 +3,7 @@
<head>
<meta charset="UTF-8" />
<script>
var coverSupport =
'CSS' in window &&
typeof CSS.supports === 'function' &&
(CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'));
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'));
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') +

View File

@ -31,7 +31,7 @@
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts}\" --fix",
"prettier": "prettier --write \"src/**/*.{js,ts,json,css,scss,vue}\"",
"format": "prettier --write \"src/**/*.{js,ts,json,css,scss,vue}\"",
"prepare": "husky install"
},
"dependencies": {

View File

@ -4,7 +4,7 @@
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationStyle":"custom"
"navigationStyle": "custom"
},
"meta": {
"ignoreAuth": true
@ -53,9 +53,11 @@
}
}
],
"subPackages": [{
"subPackages": [
{
"root": "pagesA",
"pages": [{
"pages": [
{
"path": "list/test1/index",
"style": {
"navigationBarTitleText": "test1"
@ -63,19 +65,23 @@
"meta": {
"ignoreAuth": true
}
},{
},
{
"path": "list/test2/index",
"style": {
"navigationBarTitleText": "test2",
"navigationStyle":"custom"
"navigationStyle": "custom"
},
"meta": {
"ignoreAuth": true
}
}]
}, {
}
]
},
{
"root": "pagesB",
"pages": [{
"pages": [
{
"path": "detail/index",
"style": {
"navigationBarTitleText": "Detail"
@ -83,8 +89,10 @@
"meta": {
"ignoreAuth": true
}
}]
}],
}
]
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
@ -98,21 +106,25 @@
"color": "#474747",
"selectedColor": "#9BC6FC",
"backgroundColor": "#FFFFFF",
"list": [{
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/images/tabBar/home.png",
"selectedIconPath": "static/images/tabBar/selectedHome.png"
},{
},
{
"pagePath": "pages/demo/index",
"text": "Demo",
"iconPath": "static/images/tabBar/demo.png",
"selectedIconPath": "static/images/tabBar/selectedDemo.png"
},{
},
{
"pagePath": "pages/about/index",
"text": "关于",
"iconPath": "static/images/tabBar/about.png",
"selectedIconPath": "static/images/tabBar/selectedAbout.png"
}]
}
]
}
}

View File

@ -40,7 +40,7 @@ request.interceptors.request.use(
}
return options;
},
(options) => Promise.reject(options)
(options) => Promise.reject(options),
);
/**
@ -59,7 +59,7 @@ request.interceptors.response.use(
(response) =>
// 请求错误做点什么。可以使用async await 做异步操作
// error('Request Error!');
Promise.reject(response)
Promise.reject(response),
);
export { request };

View File

@ -6,10 +6,7 @@
import { defineConfig, presetIcons } from 'unocss';
import presetWeapp from 'unocss-preset-weapp';
import {
transformerAttributify,
transformerClass,
} from 'unocss-preset-weapp/transformer';
import { transformerAttributify, transformerClass } from 'unocss-preset-weapp/transformer';
const transformRules = {
'.': '-d111-',