Skip to content

Commit

Permalink
fix: patch vue-tsc to fix typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnyq committed Dec 8, 2024
1 parent 108a86e commit abb53a6
Show file tree
Hide file tree
Showing 19 changed files with 442 additions and 504 deletions.
2 changes: 1 addition & 1 deletion babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md

module.exports = {
plugins: [],
presets: [
[
'taro',
Expand All @@ -11,5 +12,4 @@ module.exports = {
},
],
],
plugins: [],
}
4 changes: 2 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ export default defineESLintConfig({
ignores: ['./src/index.html'],
vue: {
overrides: {
'vue/prefer-true-attribute-shorthand': 'off',
'vue/component-name-in-template-casing': [
'error',
'kebab-case',
{
registeredComponentsOnly: false,
ignores: [],
registeredComponentsOnly: false,
},
],
'vue/prefer-true-attribute-shorthand': 'off',
},
},
})
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "taro-vue3-zhihudaily",
"version": "0.3.0",
"private": true,
"packageManager": "pnpm@9.15.0",
"packageManager": "pnpm@9.14.4",
"description": "taro-vue3-zhihudaily",
"templateInfo": {
"name": "vue3-NutUI",
Expand Down Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@ntnyq/eslint-config": "^3.9.1",
"@ntnyq/eslint-config": "^3.8.1",
"@ntnyq/prettier-config": "^1.22.0",
"@tarojs/cli": "^4.0.8",
"@tarojs/helper": "^4.0.8",
Expand All @@ -57,7 +57,7 @@
"eslint": "^9.16.0",
"husky": "^9.1.7",
"nano-staged": "^0.8.0",
"pnpm": "^9.15.0",
"pnpm": "^9.14.4",
"postcss": "^8.4.49",
"prettier": "^3.4.2",
"taro-define-config": "^0.10.2",
Expand All @@ -66,9 +66,13 @@
"unplugin-vue-components": "^0.27.5",
"vue-loader": "^17.4.2",
"vue-tsc": "^2.1.10",
"webpack": "^5.97.1"
"webpack": "^5.97.0"
},
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
},
"prettier": "@ntnyq/prettier-config",
"nano-staged": {
"*.{js,ts,cjs,mjs,vue,yml,yaml,md,json}": "eslint --fix"
},
Expand Down
13 changes: 13 additions & 0 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/index.js b/index.js
index a680d25dfa98a45a3efec0bfb493500e6e9faa91..c67a7a3ff2c8f6b9009bd18e22b391e8322366be 100644
--- a/index.js
+++ b/index.js
@@ -4,7 +4,7 @@ exports.run = run;
const runTsc_1 = require("@volar/typescript/lib/quickstart/runTsc");
const vue = require("@vue/language-core");
const windowsPathReg = /\\/g;
-function run(tscPath = require.resolve('typescript/lib/tsc')) {
+function run(tscPath = require.resolve('typescript/lib/_tsc')) {
let runExtensions = ['.vue'];
const extensionsChangedException = new Error('extensions changed');
const main = () => (0, runTsc_1.runTsc)(tscPath, runExtensions, (ts, options) => {
508 changes: 239 additions & 269 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions prettier.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { config, defineConfig } from '@ntnyq/prettier-config'

export default defineConfig({
...config,

overrides: [
{
files: ['**/*.css', '**/*.scss'],
options: {
singleQuote: false,
},
},
],
})
38 changes: 19 additions & 19 deletions src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@
*/

export default defineAppConfig({
lazyCodeLoading: 'requiredComponents',
pages: ['pages/index/index', 'pages/detail/index', 'pages/user/index'],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: '喔喔日推',
navigationBarTextStyle: 'black',
},
subPackages: [
{
pages: ['author/index', 'copy/index', 'thank/index', 'favorite/index'],
root: 'packages/user',
// name: `user`,
// independent: true,
},
],
tabBar: {
color: '#bfbfbf',
selectedColor: '#ffd300',
backgroundColor: '#fff',
borderStyle: 'white',
color: '#bfbfbf',
list: [
{
pagePath: 'pages/index/index',
iconPath: './assets/images/tabbar/news.png',
pagePath: 'pages/index/index',
selectedIconPath: './assets/images/tabbar/news_active.png',
text: '日推',
},
{
pagePath: 'pages/user/index',
iconPath: './assets/images/tabbar/user.png',
pagePath: 'pages/user/index',
selectedIconPath: './assets/images/tabbar/user_active.png',
text: '个人',
},
],
selectedColor: '#ffd300',
},
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTextStyle: 'black',
navigationBarTitleText: '喔喔日推',
},
subPackages: [
{
root: 'packages/user',
pages: ['author/index', 'copy/index', 'thank/index', 'favorite/index'],
// name: `user`,
// independent: true,
},
],
lazyCodeLoading: 'requiredComponents',
})
1 change: 1 addition & 0 deletions src/assets/styles/core.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Global variables, mixins and functions */

@forward "@nutui/nutui-taro/dist/styles/variables.scss" with (
$primary-color: #ffd300,
$primary-color-end: #ffd300
Expand Down
8 changes: 4 additions & 4 deletions src/components/PosterBuilder/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default defineComponent({
/**
* step1: 初始化图片资源
* @param images = imgTask
* @return downloadImagePromise
* @param images - = imgTask
* @returns downloadImagePromise
*/
const initImages = (images: Image[]) => {
const imageList = images.filter(item => item.url)
Expand All @@ -46,7 +46,7 @@ export default defineComponent({
/**
* step2: 初始化 canvas && 获取其 dom 节点和实例
* @return resolve 里返回其 dom 和实例
* @returns resolve 里返回其 dom 和实例
*/
const initCanvas = () =>
new Promise(resolve => {
Expand Down Expand Up @@ -99,7 +99,7 @@ export default defineComponent({
/**
* step2: 开始绘制任务
* @param drawTasks 待绘制任务
* @param drawTasks - 待绘制任务
*/
const startDrawing = async (drawTasks: any[]) => {
// TODO: check
Expand Down
16 changes: 8 additions & 8 deletions src/components/PosterBuilder/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ export async function downloadFile(url: string) {

/**
* 下载图片并获取图片信息
* @param item 图片参数信息
* @param index 图片下标
* @param item - 图片参数信息
* @param index - 图片下标
* @returns 整理后的图片信息
*/
export async function getImageInfo(item: Image, index: number) {
Expand Down Expand Up @@ -186,12 +186,12 @@ export async function getImageInfo(item: Image, index: number) {
/**
* 获取线性渐变色
* TODO: 待优化, 支持所有角度,多个颜色的线性渐变
* @param ctx canvas 实例对象
* @param color 线性渐变色,如 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 100%)'
* @param startX 起点 x 坐标
* @param startY 起点 y 坐标
* @param w 宽度
* @param h 高度
* @param ctx - canvas 实例对象
* @param color - 线性渐变色,如 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 100%)'
* @param startX - 起点 x 坐标
* @param startY - 起点 y 坐标
* @param w - 宽度
* @param h - 高度
* @returns grd
*/
export function getLinearColor(
Expand Down
Loading

0 comments on commit abb53a6

Please sign in to comment.