@longzai-intelligence-oxlint/tsdown-config-plugin 0.1.36 → 0.1.38
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/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=[],r=[];function i(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(`correctPresetNames`in e){let t=Object.getOwnPropertyDescriptor(e,`correctPresetNames`)?.value;if(t!==void 0&&!Array.isArray(t))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 a(e){let t=Array.isArray(e)?e[0]:e;return i(t)?{configPackagePath:t.configPackagePath??``,correctPresetNames:t.correctPresetNames??n,forbiddenExportNames:t.forbiddenExportNames??r}:{configPackagePath:``,correctPresetNames:n,forbiddenExportNames:r}}function o(e){return e.source.type===`Literal`&&typeof e.source.value==`string`?e.source.value:null}function s(e){return e.imported?.type===`Identifier`?e.imported.name??null:null}const c=e({meta:{type:`problem`,docs:{description:`强制执行 tsdown.config.ts 文件中的配置导入规范,必须使用预设函数`},schema:[{type:`object`,properties:{configPackagePath:{type:`string`},correctPresetNames:{type:`array`,items:{type:`string`}},forbiddenExportNames:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{ImportDeclaration(t){let n=a(e.options);if(n.forbiddenExportNames.length===0)return;let r=o(t);if(r)for(let i of t.specifiers){if(i.type!==`ImportSpecifier`)continue;let t=s(i);if(t&&n.forbiddenExportNames.includes(t)){if(r===`tsdown`){let r=n.correctPresetNames.join(`、`);e.report({node:i,message:`禁止从 tsdown 包导入 "${t}"。应使用预设函数(${r})从 "${n.configPackagePath}" 导入`})
|
|
1
|
+
import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=[],r=[];function i(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(`correctPresetNames`in e){let t=Object.getOwnPropertyDescriptor(e,`correctPresetNames`)?.value;if(t!==void 0&&!Array.isArray(t))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 a(e){let t=Array.isArray(e)?e[0]:e;return i(t)?{configPackagePath:t.configPackagePath??``,correctPresetNames:t.correctPresetNames??n,forbiddenExportNames:t.forbiddenExportNames??r}:{configPackagePath:``,correctPresetNames:n,forbiddenExportNames:r}}function o(e){return e.source.type===`Literal`&&typeof e.source.value==`string`?e.source.value:null}function s(e){return e.imported?.type===`Identifier`?e.imported.name??null:null}const c=e({meta:{type:`problem`,docs:{description:`强制执行 tsdown.config.ts 文件中的配置导入规范,必须使用预设函数`},schema:[{type:`object`,properties:{configPackagePath:{type:`string`},correctPresetNames:{type:`array`,items:{type:`string`}},forbiddenExportNames:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{ImportDeclaration(t){let n=a(e.options);if(n.forbiddenExportNames.length===0)return;let r=o(t);if(r)for(let i of t.specifiers){if(i.type!==`ImportSpecifier`)continue;let t=s(i);if(t&&n.forbiddenExportNames.includes(t)){if(r===`tsdown`){let r=n.correctPresetNames.join(`、`);e.report({node:i,message:`禁止从 tsdown 包导入 "${t}"。应使用预设函数(${r})从 "${n.configPackagePath}" 导入`})}else if(r===n.configPackagePath){let r=n.correctPresetNames.join(`、`);e.report({node:i,message:`禁止从 ${n.configPackagePath} 导入 "${t}"。应使用预设函数(${r})`})}}}}}}}),l=t({meta:{name:`@longzai-intelligence-oxlint/tsdown-config-plugin`},rules:{"require-tsdown-config-import":c}});export{l as default,l as tsdownConfigPlugin,c as requireTsdownConfigImportRule};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-oxlint/tsdown-config-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Longzai Intelligence oxlint tsdown 配置规则插件",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typecheck:test": "lzi-tsgo typecheck tsconfig/test.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@longzai-intelligence-oxlint/core": "0.1.
|
|
46
|
+
"@longzai-intelligence-oxlint/core": "0.1.38",
|
|
47
47
|
"@oxlint/plugins": "^1.74.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|