From 87eaa61145a1679ecfd4e82e7937e29b3f1a3cc5 Mon Sep 17 00:00:00 2001 From: Bin Date: Tue, 27 Jan 2026 14:50:22 +0800 Subject: [PATCH] chore: use oxlint and oxfmt --- .oxfmtrc.json | 4 ++++ .oxlintrc.json | 6 ++++++ eslint.config.mjs | 33 --------------------------------- package.json | 45 ++++++++++++++++++++++----------------------- 4 files changed, 32 insertions(+), 56 deletions(-) create mode 100644 .oxfmtrc.json create mode 100644 .oxlintrc.json delete mode 100644 eslint.config.mjs diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..41a42ae --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,4 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "trailingComma": "es5" +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..840b6c4 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["unicorn", "typescript", "oxc", "vue"], + "ignorePatterns": ["iconfont/**", "icons/**", "patches/**"], + "rules": {} +} diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 1233b40..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,33 +0,0 @@ -import antfu from '@antfu/eslint-config' -import oxlint from 'eslint-plugin-oxlint' - -export default antfu({ - ...oxlint.configs['flat/recommended'], - vue: { - overrides: { - 'vue/html-self-closing': 'off', - }, - }, - typescript: { - overrides: { - 'ts/ban-ts-comment': 'off', - }, - }, - ignores: [ - '**/renderer/main.ts', - '**/renderer/theme-editor-main.ts', - '**/*.md', - '**/iconfont', - 'lang/index.js', - ], - rules: { - 'node/prefer-global/process': 'off', - 'node/prefer-global/buffer': 'off', - 'no-console': 'off', - 'on-debug': 'off', - 'style/space-in-parens': 'off', - 'style/max-statements-per-line': 'off', - 'style/brace-style': ['error', '1tbs', { allowSingleLine: false }], - 'unused-imports/no-unused-vars': 'off', - }, -}) diff --git a/package.json b/package.json index 2721c7a..bb261df 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,16 @@ { "name": "milkup", "version": "0.4.10", - "packageManager": "pnpm@10.12.1+sha512.f0dda8580f0ee9481c5c79a1d927b9164f2c478e90992ad268bbb2465a736984391d6333d2c327913578b2804af33474ca554ba29c04a8b13060a717675ae3ac", "description": "A Markdown editor built with Milkdown and Vue.js", - "author": "Larry Zhu", - "license": "MIT", "keywords": [ - "md", - "markdown", "Markdown", + "markdown", + "md", "milkup" ], + "license": "MIT", + "author": "Larry Zhu", "main": "dist-electron/main/index.js", - "engines": { - "node": ">=20.17.0", - "pnpm": ">=10.0.0" - }, "scripts": { "build:main": "esbuild src/main/index.ts --bundle --platform=node --external:electron --outfile=dist-electron/main/index.js", "build:preload": "esbuild src/preload.ts --bundle --platform=neutral --outfile=dist-electron/preload.js --external:electron --format=cjs", @@ -28,8 +23,8 @@ "dist:linux-x64": "pnpm run build && electron-builder --linux --x64", "dist:linux-arm64": "pnpm run build && electron-builder --linux --arm64", "dist:win-x64": "pnpm run build && electron-builder --win --x64", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "lint": "oxlint . && oxfmt --check .", + "format": "oxlint --fix . && oxfmt .", "prepare": "simple-git-hooks", "preinstall": "npx only-allow pnpm", "release": "genereleaselog", @@ -89,7 +84,6 @@ "vue-draggable-plus": "^0.6.0" }, "devDependencies": { - "@antfu/eslint-config": "^5.2.1", "@types/he": "^1.2.3", "@types/mdast": "^4.0.4", "@types/node": "^24.3.0", @@ -100,10 +94,9 @@ "electron": "^37.3.1", "electron-builder": "^26.0.12", "esbuild": "^0.25.9", - "eslint": "^9.33.0", - "eslint-plugin-oxlint": "^1.12.0", "genereleaselog": "^0.0.5", "less": "^4.4.1", + "oxfmt": "^0.27.0", "oxlint": "^1.12.0", "picocolors": "^1.1.1", "simple-git-hooks": "^2.13.1", @@ -111,6 +104,21 @@ "vite": "^7.1.3", "vite-plugin-electron": "^0.29.0" }, + "simple-git-hooks": { + "pre-commit": "npx lint-staged", + "commit-msg": "node scripts/verify-commit.js" + }, + "lint-staged": { + "*.{js,ts,tsx,vue,json}": [ + "oxlint --fix", + "oxfmt" + ] + }, + "engines": { + "node": ">=20.17.0", + "pnpm": ">=10.0.0" + }, + "packageManager": "pnpm@10.12.1+sha512.f0dda8580f0ee9481c5c79a1d927b9164f2c478e90992ad268bbb2465a736984391d6333d2c327913578b2804af33474ca554ba29c04a8b13060a717675ae3ac", "pnpm": { "overrides": { "@codemirror/state": "^6.5.2" @@ -125,15 +133,6 @@ "@milkdown/crepe": "patches/@milkdown__crepe.patch" } }, - "simple-git-hooks": { - "pre-commit": "npx lint-staged", - "commit-msg": "node scripts/verify-commit.js" - }, - "lint-staged": { - "*.{js,ts,tsx,vue,json}": [ - "eslint --cache --fix" - ] - }, "build": { "appId": "com.auto-plugin.milkup", "productName": "milkup",