@kingsword/lint-config
v0.2.2
Published
Reusable oxlint presets + self-owned ESLint-compatible JS plugin rules.
Maintainers
Readme
@kingsword/lint-config
可复用的 oxlint 配置与 @kingsword/* 规则插件。
要求:
oxlint >= 1.50.0
安装
npm i -D oxlint @kingsword/lint-config推荐用法(CLI 生成)
# 生成 oxlint.config.ts(默认 lib + none + recommended)
npx xlint init lib
# 更严格示例
npx xlint init fullstack --test vitest --level strict生成后执行:
npx oxlint .手写配置
import { defineConfig } from "oxlint";
import { oxlint } from "@kingsword/lint-config/config";
export default defineConfig(
oxlint({
profile: "lib",
test: "none",
level: "recommended",
}),
);参数说明
profile:base | lib | react | backend | fullstacktest:none | vitestlevel:recommended | strict
oxlint() 无参数时,默认使用最严格推荐档(fullstack-vitest-strict)。
1.50 升级重点
vitest-strict默认启用vitest/prefer-import-in-mockvitest-strict默认启用no-use-before-definevitest-strict默认启用no-shadowvitest-strict默认启用no-unmodified-loop-conditionvitest-strict默认启用unicorn/prefer-modulevitest-strict默认启用node/no-path-concatvitest-strict不默认强制 Vitest globals/import 二选一(减少与不同项目测试风格的冲突)base默认启用typescript/consistent-type-assertionsfrontend默认启用unicorn/relative-url-stylevitest默认启用vitest/prefer-expect-type-ofoxlint.config.ts的extends需使用“配置对象数组”,不再支持字符串路径
规则文档
docs/rules.zh-CN.md- 文档已包含:自研
@kingsword/*全部规则、内置规则(含off项)与 overrides 的完整中文说明
开发验证夹具(Smoke Fixtures)
仓库内用于 lint:* 脚本的最小验证样例位于:test/fixtures/smoke。
base:test/fixtures/smoke/base/baseCase.tsrecommended:test/fixtures/smoke/recommended/recommendedCase.tsfrontend:test/fixtures/smoke/frontend/frontendCase.tsbackend:test/fixtures/smoke/backend/backendCase.tsfullstack:test/fixtures/smoke/fullstack/fullstackCase.tsvitest/vitest:strict:test/fixtures/smoke/vitest/vitestCase.ts
说明:
- 这些夹具是“应当通过”的 smoke 用例,保持最小、稳定、可读。
- 规则触发/报错类断言放在
test/plugin.test.js的场景测试中维护。
