Skip to content

Commit

Permalink
Merge pull request #1409 from terwer/dev
Browse files Browse the repository at this point in the history
fix: add ts lint check
  • Loading branch information
terwer authored Nov 8, 2024
2 parents 6b6932c + 016e3ec commit ba096be
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Lint for TypeScript errors
run: pnpm lint

- name: Build for production
run: pnpm build
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"serve": "python scripts/serve.py",
"dev": "python scripts/dev.py",
"test": "vitest",
"lint": "vue-tsc --noEmit",
"coverage": "vitest run --coverage",
"build": "python scripts/build.py",
"pluginBuild": "python scripts/plugin_build.py",
Expand Down
172 changes: 86 additions & 86 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions siyuan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* questions.
*/

import { App, confirm, getFrontend, IMenuItemOption, IModel, IObject, Menu, Plugin, showMessage } from "siyuan"
import { App, confirm, getFrontend, Model, IObject, Plugin } from "siyuan"
import { SiyuanConfig, SiyuanKernelApi } from "zhi-siyuan-api"
import { createSiyuanAppLogger } from "./appLogger"
import { WidgetInvoke } from "./invoke/widgetInvoke"
Expand Down Expand Up @@ -52,7 +52,7 @@ export default class PublisherPlugin extends Plugin {
private widgetInvoke: WidgetInvoke
private pluginInvoke: PluginInvoke

customTabObject: () => IModel
customTabObject: () => Model
public tabInstance: any

private publishSetting: any
Expand Down
6 changes: 3 additions & 3 deletions siyuan/topbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import PublisherPlugin from "./index"
import { icons } from "./utils/svg"
import { IMenuItemOption, Menu, showMessage } from "siyuan"
import { Menu, showMessage } from "siyuan"
import { createSiyuanAppLogger } from "./appLogger"
import { WidgetInvoke } from "./invoke/widgetInvoke"
import { PluginInvoke } from "./invoke/pluginInvoke"
Expand Down Expand Up @@ -80,8 +80,8 @@ export class Topbar {

private async addMenu(
rect: DOMRect,
quickMenus: IMenuItemOption[],
extendMenus: IMenuItemOption[],
quickMenus: any[],
extendMenus: any[],
prefSetting: any
) {
const menu = new Menu("publisherMenu")
Expand Down
5 changes: 2 additions & 3 deletions siyuan/utils/menuUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* questions.
*/

import { IMenuItemOption } from "siyuan"
import { ObjectUtil } from "zhi-common"
import { DYNAMIC_CONFIG_KEY } from "../Constants.ts"
import PageUtils from "~/common/pageUtils.ts"
Expand All @@ -48,7 +47,7 @@ class MenuUtils {
}
}

const submenus = <IMenuItemOption[]>[]
const submenus = <any[]>[]
// 读取配置
if (ObjectUtil.isEmptyObject(setting)) {
// 配置错误,直接返回空
Expand Down Expand Up @@ -96,7 +95,7 @@ class MenuUtils {

const isBlogInstalled = await pluginInvoke.preCheckBlogPlugin()

const extmenus = <IMenuItemOption[]>[]
const extmenus = <any[]>[]
if (isBlogInstalled) {
// 发布预览
const extPreviewMenu = {
Expand Down
9 changes: 7 additions & 2 deletions src/adaptors/web/csdn/csdnUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ class CsdnUtils {

public static processCsdnMath(html: string): string {
// 使用Cheerio加载HTML
const $ = cheerio.load(html, { xmlMode: true, decodeEntities: false })
const $ = cheerio.load(html, {
xml: {
xmlMode: true,
decodeEntities: false,
},
})

// 处理两个$符号包裹的公式
const doubleDollarRegex = /\$\$([^$]+)\$\$/g
Expand Down Expand Up @@ -120,7 +125,7 @@ class CsdnUtils {
/**
* 处理代码高亮
* https://spencersnyder.io/blog/prism-js-with-next-js
*
*
* @param adaptorInstance
* @param html
*/
Expand Down
7 changes: 6 additions & 1 deletion src/adaptors/web/zhihu/zhihuUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ class ZhihuUtils {

public static processZHMath(html: string): string {
// 使用Cheerio加载HTML
const $ = cheerio.load(html, { xmlMode: true, decodeEntities: false })
const $ = cheerio.load(html, {
xml: {
xmlMode: true,
decodeEntities: false,
},
})

// 处理两个$符号和一个$符号包裹的公式
const mathRegex = /\$\$([^\$]+)\$\$|\$([^\$]+)\$/g
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"moduleResolution": "node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
"include": []
}

0 comments on commit ba096be

Please sign in to comment.