@longzai-intelligence-oxlint/tsup-config-plugin 0.1.0
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 +17 -0
- package/dist/configs/recommended.d.ts +5 -0
- package/dist/configs/recommended.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @longzai-intelligence-oxlint/tsup-config-plugin
|
|
2
|
+
|
|
3
|
+
## 意图
|
|
4
|
+
|
|
5
|
+
强制 tsup 配置文件使用生态共享配置导入,避免各项目散落自定义 tsup 配置造成构建基线漂移。
|
|
6
|
+
|
|
7
|
+
## 定位
|
|
8
|
+
|
|
9
|
+
Oxlint 生态的 tsup 配置治理插件,通过 `eslintCompatPlugin` 包装以同时兼容 Oxlint 与 ESLint 运行时。
|
|
10
|
+
|
|
11
|
+
## 职能
|
|
12
|
+
|
|
13
|
+
提供 `require-tsup-config-import` 规则,校验项目内 tsup 配置文件是否引用生态内统一的共享配置包。
|
|
14
|
+
|
|
15
|
+
## 实现情况
|
|
16
|
+
|
|
17
|
+
当前仅落地配置导入约束一条规则,规则与插件对象均已导出;整体处于聚焦单点的成熟形态,未见其他规则占位。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={"@longzai-intelligence-oxlint/tsup-config-plugin/require-tsup-config-import":`error`};export{e as recommended};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/rules/require-tsup-config-import.rule.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* require-tsup-config-import 规则定义
|
|
4
|
+
*/
|
|
5
|
+
declare const requireTsupConfigImportRule: import("@oxlint/plugins").Rule;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/index.d.ts
|
|
8
|
+
declare const tsupConfigPlugin: import("@oxlint/plugins").Plugin;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { tsupConfigPlugin as default, tsupConfigPlugin, requireTsupConfigImportRule };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=[];function r(e){if(typeof e!=`object`||!e)return!1;if(`configPackagePath`in e){let t=Object.getOwnPropertyDescriptor(e,`configPackagePath`)?.value;if(t!==void 0&&typeof t!=`string`)return!1}if(`correctExportName`in e){let t=Object.getOwnPropertyDescriptor(e,`correctExportName`)?.value;if(t!==void 0&&typeof t!=`string`)return!1}if(`forbiddenExportNames`in e){let t=Object.getOwnPropertyDescriptor(e,`forbiddenExportNames`)?.value;if(t!==void 0&&!Array.isArray(t))return!1}return!0}function i(e){let t=Array.isArray(e)?e[0]:e;return r(t)?{configPackagePath:t.configPackagePath??``,correctExportName:t.correctExportName??``,forbiddenExportNames:t.forbiddenExportNames??n}:{configPackagePath:``,correctExportName:``,forbiddenExportNames:n}}function a(e){return e.source.type===`Literal`&&typeof e.source.value==`string`?e.source.value:null}function o(e){return e.imported?.type===`Identifier`?e.imported.name??null:null}const s=e({meta:{type:`problem`,docs:{description:`强制执行 tsup.config.ts 文件中的配置导入规范,必须使用 definePackageConfig`},schema:[{type:`object`,properties:{configPackagePath:{type:`string`},correctExportName:{type:`string`},forbiddenExportNames:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{ImportDeclaration(t){let n=i(e.options);if(n.forbiddenExportNames.length===0)return;let r=a(t);if(r)for(let i of t.specifiers){if(i.type!==`ImportSpecifier`)continue;let t=o(i);if(!(!t||!n.forbiddenExportNames.includes(t))){if(r===`tsup`){e.report({node:i,message:`禁止从 tsup 包导入 "${t}"。应使用 ${n.correctExportName} 从 "${n.configPackagePath}" 导入`});continue}r===n.configPackagePath&&e.report({node:i,message:`禁止从 ${n.configPackagePath} 导入 "${t}"。应使用 ${n.correctExportName}`})}}}}}}),c=t({meta:{name:`@longzai-intelligence-oxlint/tsup-config-plugin`},rules:{"require-tsup-config-import":s}});export{c as default,c as tsupConfigPlugin,s as requireTsupConfigImportRule};
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longzai-intelligence-oxlint/tsup-config-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./configs/recommended": {
|
|
17
|
+
"types": "./dist/configs/recommended.d.ts",
|
|
18
|
+
"import": "./dist/configs/recommended.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "lzi-builder",
|
|
23
|
+
"build:prod": "NODE_ENV=production lzi-builder",
|
|
24
|
+
"prepublishOnly": "bun run build:prod",
|
|
25
|
+
"dev": "lzi-builder --watch",
|
|
26
|
+
"clean": "rimraf dist",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"lint": "oxlint && oxfmt --check",
|
|
31
|
+
"lint:fix": "oxlint --fix && oxfmt",
|
|
32
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
33
|
+
"typecheck:app": "tsgo --noEmit -p tsconfig/app.json",
|
|
34
|
+
"typecheck:node": "tsgo --noEmit -p tsconfig/node.json",
|
|
35
|
+
"typecheck:test": "tsgo --noEmit -p tsconfig/test.json"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@longzai-intelligence-oxlint/core": "0.1.0",
|
|
39
|
+
"@oxlint/plugins": "^1.74.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@vitest/coverage-v8": "^4.1.10"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"oxlint": ">=1.0.0"
|
|
46
|
+
}
|
|
47
|
+
}
|