From fc7d30c5105da793c1686d75066a7ff4227ff94e Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 13 Jun 2025 17:52:04 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20oxlint=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展 oxlint 配置,添加更多文件类型支持并引入插件 添加 lint:oxlint-fix 命令以支持自动修复 --- .oxlintrc.json | 23 ++++++++++++++++++----- package.json | 5 +++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index fd48a0e..9d5cf99 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,11 +1,24 @@ { - "extends": ["@oxlint/recommended"], + "$schema": "./node_modules/oxlint/configuration_schema.json", + "extends": ["config:recommended"], + "plugins": ["import", "typescript", "unicorn"], "rules": { "no-console": "off", "no-unused-vars": "off" }, - "files": ["src/**/*.{js,ts,vue}"], - "vue": { - "enabled": true - } + "env": { + "es6": true + }, + "globals": { + "foo": "readonly" + }, + "settings": {}, + "overrides": [ + { + "files": ["*.test.ts", "*.spec.ts"], + "rules": { + "@typescript-eslint/no-explicit-any": "off" + } + } + ] } diff --git a/package.json b/package.json index 624c305..3fd81cb 100644 --- a/package.json +++ b/package.json @@ -71,13 +71,14 @@ "type-check": "vue-tsc --noEmit", "openapi-ts-request": "openapi-ts", "prepare": "git init && husky", - "lint:oxlint": "oxlint src/**/*.{ts,js,vue}" + "lint:oxlint": "oxlint src/**/*.{ts,js,vue}", + "lint:oxlint-fix": "oxlint --fix src/**/*.{ts,js,vue}" }, "lint-staged": { "**/*.{html,cjs,json,md,scss,css,txt}": [ "prettier --write --cache" ], - "**/*.{js,ts,vue}": [ + "**/*.{js,jsx,ts,tsx,vue,mjs,cjs,mts,cts}": [ "oxlint --fix", "prettier --write --cache" ],