@longzai-intelligence-oxlint/lzi-config-plugin 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @longzai-intelligence-oxlint/lzi-config-plugin
2
+
3
+ Longzai Intelligence Oxlint 的 lzi 工具配置治理插件,治理配置文件默认导出的类型防线形态。
4
+
5
+ ## 简介
6
+
7
+ lzi 前缀工具配置文件以裸对象字面量作为默认导出时,缺少类型防线,字段写错后静态检查无法暴露,加载器按非空对象形态静默放行,历史上已因此产生配置遮蔽与字段非法的存量缺陷。本插件在静态检查阶段拦截该形态,要求默认导出经 defineConfig 工厂包裹,工具未提供工厂时以 satisfies 标注配置类型。
8
+
9
+ ## 能力
10
+
11
+ - `require-define-config` — 校验 `lzi-*.config.ts` 与 `lzi-*.config.mts` 的默认导出不为裸对象字面量,defineConfig 工厂调用与 satisfies、as 类型约束形态放行,无默认导出的文件不在覆盖面
12
+ - 同时兼容 Oxlint 与 ESLint 运行时
@@ -0,0 +1,9 @@
1
+ import "../rolldown-runtime-BqT_7tdF.js";
2
+ import { OxlintRules } from "@longzai-intelligence-oxlint/core";
3
+ //#region src/configs/recommended.config.d.ts
4
+ /**
5
+ * 推荐规则集
6
+ */
7
+ declare const recommended: OxlintRules;
8
+ //#endregion
9
+ export { recommended };
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";const e={"@longzai-intelligence-oxlint/lzi-config-plugin/require-define-config":`error`};export{e as recommended};
@@ -0,0 +1,18 @@
1
+ import "./rolldown-runtime-BqT_7tdF.js";
2
+ //#region src/rules/require-define-config.rule.d.ts
3
+ /**
4
+ * 要求 lzi 工具配置默认导出携带类型防线的门禁规则
5
+ *
6
+ * @remarks
7
+ * 以文件名门禁限定 lzi 前缀配置文件,以导出声明形态判定是否裸对象
8
+ * 类型防线缺失会让非法字段静默通过加载器,本规则在静态检查阶段拦截该形态
9
+ */
10
+ declare const requireDefineConfigRule: import("@oxlint/plugins").Rule;
11
+ //#endregion
12
+ //#region src/index.d.ts
13
+ /**
14
+ * lzi-config 插件实例
15
+ */
16
+ declare const lziConfigPlugin: import("@oxlint/plugins").Plugin;
17
+ //#endregion
18
+ export { lziConfigPlugin as default, lziConfigPlugin, requireDefineConfigRule };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=/(^|\/)lzi-[^/]+\.config\.(ts|mts)$/;function r(e){let t=e.replace(/\\/g,`/`);return n.test(t)}function i(e){return typeof e==`object`&&!!e&&`type`in e}function a(e){return i(e)&&e.type===`ObjectExpression`}const o={bareDefaultExport:`lzi 工具配置的默认导出为裸对象字面量,缺少类型防线,字段写错时静态检查无法暴露。请改用 defineConfig 工厂包裹,工具未提供工厂时以 satisfies 标注配置类型。`},s=e({meta:{type:`problem`,docs:{description:`要求 lzi 工具配置默认导出经 defineConfig 或类型约束提供类型防线`}},createOnce(e){return{before(){let t=e.filename;if(!r(t))return!1},ExportDefaultDeclaration(t){t.type===`ExportDefaultDeclaration`&&a(t.declaration)&&e.report({node:t,message:o.bareDefaultExport})}}}}),c=t({meta:{name:`@longzai-intelligence-oxlint/lzi-config-plugin`},rules:{"require-define-config":s}});export{c as default,c as lziConfigPlugin,s as requireDefineConfigRule};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@longzai-intelligence-oxlint/lzi-config-plugin",
3
+ "version": "0.1.26",
4
+ "description": "Longzai Intelligence oxlint 工具配置规则插件",
5
+ "keywords": [
6
+ "config",
7
+ "longzai-intelligence",
8
+ "lzi",
9
+ "oxlint",
10
+ "rules"
11
+ ],
12
+ "license": "UNLICENSED",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ },
24
+ "./configs/recommended": {
25
+ "types": "./dist/configs/recommended.d.ts",
26
+ "import": "./dist/configs/recommended.js"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "build": "lzi-builder",
31
+ "build:prod": "NODE_ENV=production bun run build",
32
+ "prepublishOnly": "bun run build:prod",
33
+ "dev": "lzi-builder --watch",
34
+ "clean": "lzi-dev-cli clean",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "test:coverage": "vitest run --coverage",
38
+ "lint": "oxlint && oxfmt --check",
39
+ "lint:fix": "oxlint --fix && oxfmt",
40
+ "typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
41
+ "typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
42
+ "typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
43
+ "typecheck:test": "lzi-tsgo typecheck tsconfig/test.json"
44
+ },
45
+ "dependencies": {
46
+ "@longzai-intelligence-oxlint/core": "0.1.26",
47
+ "@oxlint/plugins": "^1.74.0"
48
+ },
49
+ "devDependencies": {
50
+ "@vitest/coverage-v8": "^4.1.10"
51
+ },
52
+ "peerDependencies": {
53
+ "oxlint": ">=1.0.0"
54
+ }
55
+ }