@longzai-intelligence-oxlint/presets 0.1.47 → 0.2.1

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.
Files changed (86) hide show
  1. package/dist/base.d.ts +2 -1
  2. package/dist/base.entry-BRRJVhQW.js +1 -0
  3. package/dist/{base.entry-B8xoqv2v.d.ts → base.entry-CejDIGVV.d.ts} +4 -3
  4. package/dist/base.js +1 -1
  5. package/dist/dist-CskvMq7J.js +1 -0
  6. package/dist/electron.d.ts +5 -4
  7. package/dist/electron.entry-DGTGFrW5.js +1 -0
  8. package/dist/electron.js +1 -1
  9. package/dist/elysia.d.ts +5 -4
  10. package/dist/elysia.js +1 -1
  11. package/dist/expo.d.ts +3 -1
  12. package/dist/expo.js +1 -1
  13. package/dist/fumadocs.d.ts +2 -1
  14. package/dist/{fumadocs.entry-Dc9xyNem.d.ts → fumadocs.entry-C7QzCdVJ.d.ts} +4 -3
  15. package/dist/fumadocs.entry-oZq7iczh.js +1 -0
  16. package/dist/fumadocs.js +1 -1
  17. package/dist/hono.d.ts +3 -2
  18. package/dist/hono.js +1 -1
  19. package/dist/index-eNRova_s.d.ts +68 -0
  20. package/dist/index.d.ts +10 -13
  21. package/dist/index.js +1 -1
  22. package/dist/library.d.ts +5 -4
  23. package/dist/library.entry-CRtfr5d4.js +1 -0
  24. package/dist/library.js +1 -1
  25. package/dist/mcp.d.ts +3 -2
  26. package/dist/mcp.js +1 -1
  27. package/dist/nest.d.ts +5 -4
  28. package/dist/nest.entry-DHYBO2a1.js +1 -0
  29. package/dist/nest.js +1 -1
  30. package/dist/next.d.ts +2 -1
  31. package/dist/next.entry-BAw82S0g.js +1 -0
  32. package/dist/{next.entry-BqOxjajB.d.ts → next.entry-moZEmUkw.d.ts} +4 -3
  33. package/dist/next.js +1 -1
  34. package/dist/node.d.ts +3 -1
  35. package/dist/node.js +1 -1
  36. package/dist/plugins/architecture-core.js +1 -0
  37. package/dist/plugins/architecture-electron.js +1 -0
  38. package/dist/plugins/architecture-library.js +1 -0
  39. package/dist/plugins/code-style.js +1 -0
  40. package/dist/plugins/composer.js +1 -0
  41. package/dist/plugins/design-rules.js +4 -0
  42. package/dist/plugins/elysia-route.js +1 -0
  43. package/dist/plugins/eslint-config.js +1 -0
  44. package/dist/plugins/file-naming.js +1 -0
  45. package/dist/plugins/lzi-builder-config.js +1 -0
  46. package/dist/plugins/lzi-config.js +1 -0
  47. package/dist/plugins/nestjs-route.js +1 -0
  48. package/dist/plugins/package-json.js +1 -0
  49. package/dist/plugins/perfectionist.js +1 -0
  50. package/dist/plugins/react.js +1 -0
  51. package/dist/plugins/schema-type-separation.js +1 -0
  52. package/dist/plugins/stylistic.js +9 -0
  53. package/dist/plugins/tsconfig.js +1 -0
  54. package/dist/plugins/tsdoc.js +13 -0
  55. package/dist/plugins/tsdown-config.js +1 -0
  56. package/dist/plugins/tsup-config.js +1 -0
  57. package/dist/plugins/typeorm.js +1 -0
  58. package/dist/plugins/typescript-eslint.js +1 -0
  59. package/dist/plugins/vitest-config.js +1 -0
  60. package/dist/plugins/zod.js +1 -0
  61. package/dist/{index-Cu6dVxg4.d.ts → preset-options.types-Czyi-DdY.d.ts} +1 -1
  62. package/dist/react.d.ts +5 -4
  63. package/dist/react.js +1 -1
  64. package/dist/rolldown-runtime-BqT_7tdF-BT7sSRF3.js +1 -0
  65. package/dist/rolldown-runtime-BqT_7tdF-BqT_7tdF.js +1 -0
  66. package/dist/rolldown-runtime-BqT_7tdF-DsHBzDG-.js +1 -0
  67. package/dist/rolldown-runtime-BqT_7tdF.js +1 -0
  68. package/dist/rules.d.ts +2 -1
  69. package/dist/rules.js +1 -1
  70. package/dist/taro.d.ts +2 -1
  71. package/dist/taro.entry-CHCKR0fA.js +1 -0
  72. package/dist/{taro.entry-BrMnYd7F.d.ts → taro.entry-DuohnWen.d.ts} +4 -3
  73. package/dist/taro.js +1 -1
  74. package/dist/typescript-eslint.rules-j0Y80OGu.js +1 -0
  75. package/dist/unicorn.rules-0a_FuIjL.js +1 -0
  76. package/dist/{unicorn.rules-BzgL7xpu.d.ts → unicorn.rules-CoZq5SQL.d.ts} +3 -3
  77. package/package.json +32 -30
  78. package/dist/base.entry-BsfLhCnW.js +0 -1
  79. package/dist/electron.entry-BSUbv_kx.js +0 -1
  80. package/dist/fumadocs.entry-D2EXMqvE.js +0 -1
  81. package/dist/library.entry-CMq8a1Dq.js +0 -1
  82. package/dist/nest.entry-D1JfdqzR.js +0 -1
  83. package/dist/next.entry-BCVfEuLq.js +0 -1
  84. package/dist/taro.entry-B0YhHlhV.js +0 -1
  85. package/dist/typescript-eslint.rules-W6xcPWv3.js +0 -1
  86. package/dist/unicorn.rules-EOaLfd_c.js +0 -1
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return e.type===`Literal`}function r(e){return e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`}const i=e({meta:{type:`problem`,docs:{description:`校验 defineCapability 声明结构:provides/inject 必须是 ServiceToken,factory 必须是函数`}},createOnce(e){return{CallExpression(t){if(t.callee.type===`Identifier`&&t.callee.name===`defineCapability`){let i=t.arguments[0];if(!i||i.type!==`ObjectExpression`)e.report({node:t,message:`defineCapability 的首参必须是对象字面量`});else{let a=!1;for(let t of i.properties)if(t.type===`Property`&&t.key.type===`Identifier`){if(t.key.name===`provides`)a=!0,n(t.value)&&e.report({node:t,message:`provides 必须是 ServiceToken(createServiceToken 产物),禁止使用裸字符串`});else if(t.key.name===`factory`)r(t.value)||e.report({node:t,message:`factory 必须是函数`});else if(t.key.name===`inject`&&t.value.type===`ObjectExpression`)for(let r of t.value.properties)r.type===`Property`&&n(r.value)&&e.report({node:r,message:`inject 值必须是 ServiceToken,禁止使用裸字符串`})}a||e.report({node:t,message:`defineCapability 声明必须包含 provides`})}}}}}});function a(e,t){if(e.type===`Identifier`)return t.get(e.name)??e.name;if(e.type===`CallExpression`&&e.callee.type===`Identifier`&&e.callee.name===`createServiceToken`){let t=e.arguments[0];if(t&&t.type===`Literal`&&typeof t.value==`string`)return t.value}return null}function o(e){let t=/* @__PURE__ */ new Map,n=[],r=null;for(let n of e.keys())t.set(n,0);let i=a=>{t.set(a,1),n.push(a);for(let o of e.get(a)??[]){let e=t.get(o);if(e===1){let e=n.indexOf(o);return r=[...n.slice(e),o],!0}if(e===0&&i(o))return!0}return n.pop(),t.set(a,2),!1};for(let n of e.keys())if(t.get(n)===0&&i(n))return r;return null}const s={"define-capability-validity":i,"inject-graph-acyclic":e({meta:{type:`problem`,docs:{description:`检测同文件内 defineCapability 的 inject 依赖环`}},createOnce(e){let t=/* @__PURE__ */ new Map,n=[];return{Program(){t.clear(),n.length=0},VariableDeclaration(e){for(let n of e.declarations)if(n.id.type===`Identifier`&&n.init&&n.init.type===`CallExpression`&&n.init.callee.type===`Identifier`&&n.init.callee.name===`createServiceToken`){let e=n.init.arguments[0];e&&e.type===`Literal`&&typeof e.value==`string`&&t.set(n.id.name,e.value)}},CallExpression(e){if(e.callee.type===`Identifier`&&e.callee.name===`defineCapability`){let r=e.arguments[0];if(r&&r.type===`ObjectExpression`){let i=null,o=[];for(let e of r.properties)if(e.type===`Property`&&e.key.type===`Identifier`){if(e.key.name===`provides`)i=a(e.value,t);else if(e.key.name===`inject`&&e.value.type===`ObjectExpression`){for(let n of e.value.properties)if(n.type===`Property`){let e=a(n.value,t);e&&o.push(e)}}}i&&n.push({provideId:i,depIds:o,node:e})}}},"Program:exit"(){let t=new Set(n.map(e=>e.provideId)),r=/* @__PURE__ */ new Map;for(let e of n)r.set(e.provideId,e.depIds.filter(e=>t.has(e)));let i=o(r);if(i){let t=n.find(e=>e.provideId===i[0]);t&&e.report({node:t.node,message:`检测到能力依赖环:${i.join(` → `)}`})}}}}})},c=t({meta:{name:`@longzai-intelligence-oxlint/composer-plugin`},rules:s});export{c as composerPlugin,c as default,s as composerRules};
@@ -0,0 +1,4 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=/(?:bg|text|border|fill|stroke|ring|outline|from|to|via|caret|accent|decoration|shadow)-\[(?:#[0-9a-fA-F]{3,8}|(?:rgb|rgba|hsl|hsla|oklch)\([^)]*\))\]/g;function r(e){let t=e.trim();return t.startsWith(`//`)||t.startsWith(`*`)||t.startsWith(`/*`)||t.startsWith(`<!--`)}const i=e({meta:{type:`problem`,docs:{description:`禁止在 className 中硬编码颜色,强制使用设计令牌语义色(如 bg-primary)`}},createOnce(e){return{Program(t){let i=e.sourceCode.text.split(`
2
+ `);for(let a=0;a<i.length;a+=1){let o=i[a];if(o===void 0||r(o))continue;n.lastIndex=0;let s=n.exec(o);s&&e.report({node:t,message:`禁止硬编码颜色 "${s[0]}":请使用设计令牌语义色(如 bg-primary / text-muted-foreground),见 foundations/color 规范。`})}}}}}),a=/\b(?:p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap|gap-x|gap-y|w|h|min-w|min-h|max-w|max-h|space-x|space-y|inset|top|right|bottom|left)-\[\d+(?:\.\d+)?(?:px|rem|em)\]/g;function o(e){let t=e.trim();return t.startsWith(`//`)||t.startsWith(`*`)||t.startsWith(`/*`)||t.startsWith(`<!--`)}const s=e({meta:{type:`problem`,docs:{description:`禁止在 className 中使用任意值间距,强制使用间距刻度(如 p-6 / gap-2)`}},createOnce(e){return{Program(t){let n=e.sourceCode.text.split(`
3
+ `);for(let r=0;r<n.length;r+=1){let i=n[r];if(i===void 0||o(i))continue;a.lastIndex=0;let s=a.exec(i);s&&e.report({node:t,message:`禁止任意值间距 "${s[0]}":请使用间距刻度(如 p-6 / gap-2)或语义别名,见 foundations/spacing 规范。`})}}}}}),c=/\bz-\[\d+\]/g,l=/zIndex\s*:\s*\d+/g;function u(e){let t=e.trim();return t.startsWith(`//`)||t.startsWith(`*`)||t.startsWith(`/*`)||t.startsWith(`<!--`)}const d=e({meta:{type:`problem`,docs:{description:`禁止硬编码 z-index,强制使用层级令牌(如 z-dropdown / z-modal / z-toast)`}},createOnce(e){return{Program(t){let n=e.sourceCode.text.split(`
4
+ `);for(let r=0;r<n.length;r+=1){let i=n[r];if(i===void 0||u(i))continue;c.lastIndex=0;let a=c.exec(i);if(a){e.report({node:t,message:`禁止魔法 z-index "${a[0]}":请使用层级令牌(如 z-dropdown / z-modal / z-toast),见 foundations/elevation 规范。`});continue}l.lastIndex=0;let o=l.exec(i);o&&e.report({node:t,message:`禁止硬编码 zIndex "${o[0]}":请使用层级令牌(如 z-dropdown / z-modal / z-toast),见 foundations/elevation 规范。`})}}}}}),f=t({meta:{name:`@longzai-intelligence-oxlint/design-rules-plugin`},rules:{"no-hardcoded-color":i,"no-hardcoded-spacing":s,"no-magic-z-index":d}});export{f as default,f as designRulesPlugin,i as noHardcodedColorRule,s as noHardcodedSpacingRule,d as noMagicZIndexRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=[`get`,`post`,`put`,`patch`,`delete`,`all`,`route`,`group`];function r(e){if(e.type===`Literal`&&`value`in e&&typeof e.value==`string`)return e.value}function i(e){switch(e.type){case`Literal`:return r(e)?.startsWith(`/`)===!0;case`TemplateLiteral`:return e.quasis[0]?.value.raw.startsWith(`/`)===!0;case`BinaryExpression`:return e.operator===`+`&&i(e.left);default:return!1}}function a(e){if(e.callee.type!==`MemberExpression`)return!1;let t=e.callee.property;if(t.type!==`Identifier`||!n.includes(t.name))return!1;let r=e.arguments[0];return r?i(r):!1}function o(e){return e.callee.type===`Identifier`&&e.callee.name===`Elysia`}function s(e){let t=e.arguments[0];if(t&&t.type===`ObjectExpression`){for(let e of t.properties)if(e.type===`Property`&&e.key.type===`Identifier`&&e.key.name===`prefix`)return e.value}}function c(e,t){return t.some(t=>e.includes(t))}function l(e,t){return t.includes(e)}function u(e){return r(e)}const d=`Elysia 路由注册禁止裸 URL 路径字面量,路径必须取自契约 RouteDefinition 字典导出(如 xxxRoutes.operation.path)。`;function f(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function p(e){return!(typeof e!=`object`||!e||!(`allowedFiles`in e)&&!(`allowedPaths`in e)||`allowedFiles`in e&&e.allowedFiles!==void 0&&!f(e.allowedFiles)||`allowedPaths`in e&&e.allowedPaths!==void 0&&!f(e.allowedPaths))}const m=e({meta:{type:`problem`,docs:{description:`Elysia 路由注册禁止裸 URL 路径字面量,路径必须取自契约 RouteDefinition 字典导出`},schema:[{type:`object`,properties:{allowedFiles:{type:`array`,items:{type:`string`},description:`豁免文件路径后缀列表,命中文件整件豁免`},allowedPaths:{type:`array`,items:{type:`string`},description:`豁免路径字面量列表,完全一致时豁免`}},additionalProperties:!1}]},createOnce(e){let t=!1,n=[];return{Program(r){t=!1,n=[];let i=e.options?.[0];if(!p(i))return;let a=i;n=a.allowedPaths??[],a.allowedFiles!==void 0&&c(e.filename,a.allowedFiles)&&(t=!0)},CallExpression(r){if(t||!a(r))return;let i=r.arguments[0];if(!i)return;let o=u(i);o!==void 0&&l(o,n)||e.report({node:i,message:d})},NewExpression(r){if(t||!o(r))return;let a=s(r);if(!a||!i(a))return;let c=u(a);c!==void 0&&l(c,n)||e.report({node:a,message:d})}}}}),h=t({meta:{name:`@longzai-intelligence-oxlint/elysia-route-plugin`},rules:{"no-bare-route-path":m}});export{h as default,h as elysiaRoutePlugin,s as extractPrefixPropertyNode,c as isAllowedFile,l as isAllowedPath,o as isNewElysiaExpression,i as isPathLikeExpression,a as isRouteRegistrationCall,m as noBareRoutePathRule,u as readPathValue};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";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(`allowedCreateFunctions`in e){let t=Object.getOwnPropertyDescriptor(e,`allowedCreateFunctions`)?.value;if(t!==void 0&&!Array.isArray(t))return!1}if(`forbiddenDefaultExports`in e){let t=Object.getOwnPropertyDescriptor(e,`forbiddenDefaultExports`)?.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??``,allowedCreateFunctions:t.allowedCreateFunctions??n,forbiddenDefaultExports:t.forbiddenDefaultExports??r}:{configPackagePath:``,allowedCreateFunctions:n,forbiddenDefaultExports:r}}function o(e){return e.source.type===`Literal`&&typeof e.source.value==`string`?e.source.value:null}function s(e,t){let n=!1,r=[],i=[];for(let a of e)if(a.type===`ImportDefaultSpecifier`||a.type===`ImportNamespaceSpecifier`)n=!0;else if(a.type===`ImportSpecifier`){let e=a.imported?.type===`Identifier`?a.imported.name:null;if(!e)continue;t.forbiddenDefaultExports.includes(e)?i.push(e):t.allowedCreateFunctions.includes(e)&&r.push(e)}return{hasDefaultOrNamespace:n,validNames:r,invalidNames:i}}function c(e,t){return e.some(e=>e.type===`ImportSpecifier`&&e.imported?.type===`Identifier`&&e.imported.name!==void 0&&!t.allowedCreateFunctions.includes(e.imported.name)&&!t.forbiddenDefaultExports.includes(e.imported.name))}const l=e({meta:{type:`problem`,docs:{description:`强制执行 eslint.config.ts 文件中的配置导入规范,必须使用 createXxxConfig 函数`},schema:[{type:`object`,properties:{configPackagePath:{type:`string`},allowedCreateFunctions:{type:`array`,items:{type:`string`}},forbiddenDefaultExports:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{ImportDeclaration(t){let n=a(e.options);if(!n.configPackagePath||o(t)!==n.configPackagePath)return;let r=s(t.specifiers,n);if(r.hasDefaultOrNamespace)for(let r of t.specifiers)r.type===`ImportDefaultSpecifier`?e.report({node:r,message:`禁止从 ${n.configPackagePath} 使用默认导入。应使用具名导入 ${n.allowedCreateFunctions.join(`、`)} 等配置创建函数`}):r.type===`ImportNamespaceSpecifier`&&e.report({node:r,message:`禁止从 ${n.configPackagePath} 使用命名空间导入。应使用具名导入 ${n.allowedCreateFunctions.join(`、`)} 等配置创建函数`});else{for(let i of r.invalidNames)e.report({node:t,message:`禁止从配置包导入 "${i}"。应使用 ${n.allowedCreateFunctions.join(`、`)} 等配置创建函数`});r.invalidNames.length===0&&r.validNames.length===0&&(c(t.specifiers,n)||e.report({node:t,message:`必须从 ${n.configPackagePath} 导入至少一个配置创建函数(如 ${n.allowedCreateFunctions.join(`、`)})`}))}}}}}),u=t({meta:{name:`@longzai-intelligence-oxlint/eslint-config-plugin`},rules:{"require-eslint-config-import":l}});export{u as default,u as eslintConfigPlugin,l as requireEslintConfigImportRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{n as e}from"../dist-CskvMq7J.js";import{defineRule as t,eslintCompatPlugin as n}from"@oxlint/plugins";import{existsSync as r,readdirSync as i}from"node:fs";import a from"node:path";const o=[`index.ts`,`index.tsx`,`main.ts`,`main.tsx`,`App.tsx`],s=[`types.ts`,`errors.ts`,`constants.ts`],c=[`persistence.ts`,`typeorm.ts`,`hono.ts`,`react.ts`,`vue.ts`,`next.ts`,`electron.ts`,`browser.ts`,`node.ts`],l=[...o,...s,...c],u=[`impl`,`functions`,`methods`,`handlers`,`classes`,`class`,`manager`,`object`,`processor`,`process`,`common`,`logic`,`hooks`,`component`],d=[{pattern:/^use[A-Z][a-zA-Z]*\.spec\.tsx?$/,caseStyle:`camelCase`,description:`Hook 测试文件应使用 camelCase 并以 use 前缀开头(如 useChat.spec.ts)`},{pattern:/^use[A-Z][a-zA-Z]*\.test\.tsx?$/,caseStyle:`camelCase`,description:`Hook 测试文件应使用 camelCase 并以 use 前缀开头(如 useChat.test.ts)`},{pattern:/^use[A-Z][a-zA-Z]*\.types\.ts$/,caseStyle:`camelCase`,description:`Hook 类型文件应使用 camelCase 并以 use 前缀开头(如 useChat.types.ts)`},{pattern:/\.spec\.ts$/,caseStyle:`kebab-case-test`,description:`测试文件应使用 xxx.spec.ts 格式(kebab-case)`},{pattern:/\.test\.ts$/,caseStyle:`kebab-case-test`,description:`测试文件应使用 xxx.test.ts 格式(kebab-case)`},{pattern:/\.spec\.tsx$/,caseStyle:`kebab-case-test`,description:`测试文件应使用 xxx.spec.tsx 格式(kebab-case)`},{pattern:/\.test\.tsx$/,caseStyle:`kebab-case-test`,description:`测试文件应使用 xxx.test.tsx 格式(kebab-case)`},{pattern:/^use[A-Z][a-zA-Z]*\.tsx?$/,caseStyle:`camelCase`,description:`Hook 文件应使用 camelCase 并以 use 前缀开头(如 useChat.ts)`}],f=[{pattern:/\.service\.drizzle\.ts$/,caseStyle:`kebab-case`,description:`Drizzle Service 文件应使用 xxx.service.drizzle.ts 格式(kebab-case)`},{pattern:/\.service\.memory\.ts$/,caseStyle:`kebab-case`,description:`Memory Service 文件应使用 xxx.service.memory.ts 格式(kebab-case)`},{pattern:/\.service\.ts$/,caseStyle:`kebab-case`,description:`服务文件应使用 xxx.service.ts 格式(kebab-case)`},{pattern:/\.controller\.ts$/,caseStyle:`kebab-case`,description:`控制器文件应使用 xxx.controller.ts 格式(kebab-case)`},{pattern:/\.module\.ts$/,caseStyle:`kebab-case`,description:`模块文件应使用 xxx.module.ts 格式(kebab-case)`},{pattern:/\.repository\.drizzle\.ts$/,caseStyle:`kebab-case`,description:`Drizzle Repository 文件应使用 xxx.repository.drizzle.ts 格式(kebab-case)`},{pattern:/\.repository\.memory\.ts$/,caseStyle:`kebab-case`,description:`Memory Repository 文件应使用 xxx.repository.memory.ts 格式(kebab-case)`},{pattern:/\.repository\.interface\.ts$/,caseStyle:`kebab-case`,description:`Repository 接口文件应使用 xxx.repository.interface.ts 格式(kebab-case)`},{pattern:/\.repository\.types\.ts$/,caseStyle:`kebab-case`,description:`Repository 类型文件应使用 xxx.repository.types.ts 格式(kebab-case)`},{pattern:/\.repository\.ts$/,caseStyle:`kebab-case`,description:`Repository 文件应使用 xxx.repository.ts 格式(kebab-case)`},{pattern:/\.entity\.types\.ts$/,caseStyle:`kebab-case`,description:`Entity 类型文件应使用 xxx.entity.types.ts 格式(kebab-case)`},{pattern:/\.entity\.interface\.ts$/,caseStyle:`kebab-case`,description:`Entity 接口文件应使用 xxx.entity.interface.ts 格式(kebab-case)`},{pattern:/\.entity\.ts$/,caseStyle:`kebab-case`,description:`Entity 文件应使用 xxx.entity.ts 格式(kebab-case)`},{pattern:/\.dto\.ts$/,caseStyle:`kebab-case`,description:`DTO 文件应使用 xxx.dto.ts 格式(kebab-case)`},{pattern:/\.port\.interface\.ts$/,caseStyle:`kebab-case`,description:`Port 接口文件应使用 xxx.port.interface.ts 格式(kebab-case)`},{pattern:/\.interface\.ts$/,caseStyle:`kebab-case`,description:`接口文件应使用 xxx.interface.ts 格式(kebab-case)`},{pattern:/\.interface\.tsx$/,caseStyle:`kebab-case`,description:`接口文件应使用 xxx.interface.tsx 格式(kebab-case)`},{pattern:/\.types\.ts$/,caseStyle:`kebab-case`,description:`类型文件应使用 xxx.types.ts 格式(kebab-case)`},{pattern:/\.schema\.ts$/,caseStyle:`kebab-case`,description:`Schema 文件应使用 xxx.schema.ts 格式(kebab-case)`},{pattern:/\.port\.ts$/,caseStyle:`kebab-case`,description:`Port 文件应使用 xxx.port.ts 格式(kebab-case)`},{pattern:/\.port-adapter\.factory\.ts$/,caseStyle:`kebab-case`,description:`Port Adapter Factory 文件应使用 xxx.port-adapter.factory.ts 格式(kebab-case)`},{pattern:/\.port-adapter\.ts$/,caseStyle:`kebab-case`,description:`Port Adapter 文件应使用 xxx.port-adapter.ts 格式(kebab-case)`},{pattern:/\.adapter\.ts$/,caseStyle:`kebab-case`,description:`Adapter 文件应使用 xxx.adapter.ts 格式(kebab-case)`},{pattern:/\.client\.ts$/,caseStyle:`kebab-case`,description:`客户端文件应使用 xxx.client.ts 格式(kebab-case)`},{pattern:/\.events\.ts$/,caseStyle:`kebab-case`,description:`Events 文件应使用 xxx.events.ts 格式(kebab-case)`},{pattern:/\.mapper\.ts$/,caseStyle:`kebab-case`,description:`Mapper 文件应使用 xxx.mapper.ts 格式(kebab-case)`},{pattern:/\.ipc\.ts$/,caseStyle:`kebab-case`,description:`IPC 文件应使用 xxx.ipc.ts 格式(kebab-case)`},{pattern:/\.config\.ts$/,caseStyle:`kebab-case`,description:`配置文件应使用 xxx.config.ts 格式(kebab-case)`},{pattern:/\.errors\.ts$/,caseStyle:`kebab-case`,description:`错误文件应使用 xxx.errors.ts 格式(kebab-case)`},{pattern:/\.utils\.ts$/,caseStyle:`kebab-case`,description:`工具函数文件应使用 xxx.utils.ts 格式(kebab-case)`},{pattern:/\.constants\.ts$/,caseStyle:`kebab-case`,description:`常量文件应使用 xxx.constants.ts 格式(kebab-case)`},{pattern:/\.atom\.ts$/,caseStyle:`kebab-case`,description:`Atom 文件应使用 xxx.atom.ts 格式(kebab-case)`},{pattern:/\.vo\.ts$/,caseStyle:`kebab-case`,description:`值对象文件应使用 xxx.vo.ts 格式(kebab-case)`},{pattern:/\.usecase\.ts$/,caseStyle:`kebab-case`,description:`UseCase 文件应使用 xxx.usecase.ts 格式(kebab-case)`},{pattern:/\.styles\.css$/,caseStyle:`kebab-case`,description:`样式文件应使用 xxx.styles.css 格式(kebab-case)`},{pattern:/\.extension\.tsx?$/,caseStyle:`kebab-case`,description:`扩展文件应使用 xxx.extension.ts(x) 格式(kebab-case)`}],p=[{pattern:/^[A-Z][a-zA-Z0-9]*\.types\.ts$/,caseStyle:`PascalCase`,description:`类型文件可使用 PascalCase(如 DataExtractor.types.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.utils\.ts$/,caseStyle:`PascalCase`,description:`工具函数文件可使用 PascalCase(如 DataExtractor.utils.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.constants\.ts$/,caseStyle:`PascalCase`,description:`常量文件可使用 PascalCase(如 ByteVisualizer.constants.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.guards\.ts$/,caseStyle:`PascalCase`,description:`守卫文件可使用 PascalCase(如 DataExtractor.guards.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.helpers\.ts$/,caseStyle:`PascalCase`,description:`辅助函数文件可使用 PascalCase(如 TableVisualizer.helpers.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.groups\.ts$/,caseStyle:`PascalCase`,description:`分组文件可使用 PascalCase(如 TableVisualizer.groups.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.type-guards\.ts$/,caseStyle:`PascalCase`,description:`类型守卫文件可使用 PascalCase(如 TableVisualizer.type-guards.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.test\.ts$/,caseStyle:`PascalCase`,description:`测试文件可使用 PascalCase(如 DataExtractor.test.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.[a-z][-a-z]*\.test\.ts$/,caseStyle:`PascalCase`,description:`伴生测试文件可使用 PascalCase(如 DataExtractor.guards.test.ts)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.[a-z][-a-z]*\.test\.tsx$/,caseStyle:`PascalCase`,description:`伴生测试文件可使用 PascalCase(如 PacketCompare.test.tsx)`},{pattern:/^[A-Z][a-zA-Z0-9]*\.test\.tsx$/,caseStyle:`PascalCase`,description:`测试文件可使用 PascalCase(如 ByteVisualizer.test.tsx)`}],m={pattern:/^[a-z][a-zA-Z0-9_-]*\.tsx$/,caseStyle:`PascalCase`,description:`组件文件应使用 PascalCase(如 ChatPage.tsx),小写开头不允许`},h={pattern:/^[A-Z][a-zA-Z0-9]*\.tsx$/,caseStyle:`PascalCase`,description:`React 组件文件可使用 PascalCase(如 ChatPage.tsx)`},g=[...d,...p,...f,m,h];function _(e){return/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(e)}function v(e){return e.split(`.`).every(e=>_(e)&&e.length>0)}function y(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function b(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function x(e){let t=e.split(`.`)[0];return t!==void 0&&t.length>0&&y(t)}function S(e){return e.split(`.`).every(e=>_(e)&&e.length>0)}function ee(e,t){switch(t){case`kebab-case`:return v(e);case`PascalCase`:return y(e);case`camelCase`:return b(e);case`kebab-case-test`:return S(e);default:return!0}}function te(e){return/^v\d+(-[a-z0-9-]+)?\.ts$/.test(e)}function C(e){let t=e.replace(/\.tsx?$/,``);for(let e of u){if(t.endsWith(`.${e}`))return e;let n=t.split(`.`);if(n.length>=2&&n[n.length-1]===e)return e}return null}function w(e){return!!(l.includes(e)||e.endsWith(`.d.ts`)||te(e)||e.startsWith(`[`)||e.startsWith(`_`))}function T(e,t){let n=e.replace(/\\/g,`/`);for(let e of t){let t=e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*\*\//g,`<<DOUBLE_STAR_SLASH>>`).replace(/\*\*/g,`<<DOUBLE_STAR>>`).replace(/\*/g,`[^/]*`).replace(/<<DOUBLE_STAR_SLASH>>/g,`(.*\\/)?`).replace(/<<DOUBLE_STAR>>/g,`.*`);if(RegExp(`.*${t}`).test(n))return!0}return!1}function E(e,t){if(t===h)return e.replace(/\.tsx$/,``);let n=t.pattern.source;if(n.startsWith(`^`)&&n.endsWith(`$`)){if(n.includes(`\\.test\\.`)||n.includes(`\\.spec\\.`))return e.replace(/\.(test|spec)\.(tsx?|jsx?)$/,``);let t=e.match(/^([A-Z][a-zA-Z0-9]*)\.[a-z][-a-z]*\.tsx?$/);return t&&t[1]?t[1]:n.includes(`\\.types\\.`)?e.replace(/\.types\.ts$/,``):e.replace(/\.[^.]+$/,``)}return e.replace(t.pattern,``)}[...l];const D=/* @__PURE__ */ new Map;function O(e){let t=D.get(e);if(t!==void 0)return t;let n;try{n=r(e)}catch{n=!1}return D.set(e,n),n}const k=/^([A-Z][a-zA-Z0-9]*)\.[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*\.ts$/;function A(e){return e.match(k)?.[1]??null}function j(e,t){let n=A(t);if(!n)return!1;let r=`${n}.tsx`,i=e.substring(0,e.lastIndexOf(`/`));return O(a.join(i,r))}function M(e){let t=e.replace(/\.(test|spec)\.(tsx|ts)$/,``);return y(t)||x(t)}function N(e,t){if(!(t.endsWith(`.test.tsx`)||t.endsWith(`.spec.tsx`)||t.endsWith(`.test.ts`)||t.endsWith(`.spec.ts`))||!M(t))return{status:`not-component-test`};let n=t.replace(/\.(test|spec)\.(tsx|ts)$/,`.tsx`),r=t.replace(/\.(test|spec)\.(tsx|ts)$/,`.ts`);if(e.includes(`/__tests__/`))return F(e,n)||F(e,r)?{status:`component-test-found`}:{status:`not-component-test`};if(e.includes(`/components/`)){let t=e.substring(0,e.lastIndexOf(`/`)),i=e.indexOf(`/components/`),o=e.substring(0,i+11),s=t;for(;;){if(P(s,n)||P(s,r))return{status:`component-test-found`};if(s===o)break;let e=a.dirname(s);if(e===s)break;s=e}}return{status:`not-component-test`}}function P(e,t){if(O(a.join(e,t)))return!0;try{let n=i(e,{withFileTypes:!0});for(let r of n)if(r.isDirectory()&&O(a.join(e,r.name,t)))return!0}catch{}return!1}function F(e,t){let n=e.indexOf(`/__tests__/`),r=e.substring(0,n),i=e.substring(n+11),o=a.dirname(i),s=o===`.`?r:a.join(r,o);for(;;){if(P(s,t))return!0;if(s===r)break;let e=a.dirname(s);if(e===s)break;s=e}return!1}function I(e){return typeof e==`object`&&!!e}function L(e,t){let n=I(t)?t:void 0;return!!(n?.skipPatterns?.length&&T(e,n.skipPatterns))}const R=t({meta:{type:`problem`,docs:{description:`强制执行文件命名规范`},schema:[{type:`object`,properties:{skipPatterns:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{before(){if(L(e.filename,e.options?.[0])||w(e.filename.replace(/\\/g,`/`).split(`/`).pop()??``))return!1},Program(t){if(L(e.filename,e.options?.[0]))return;let n=e.filename.replace(/\\/g,`/`).split(`/`).pop()??``,r=e.filename.replace(/\\/g,`/`),i=C(n);if(i!==`hooks`&&j(r,n))return;if(N(r,n).status===`component-test-found`){let e=n.replace(/\.(test|spec)\.(tsx|ts)$/,``);if(y(e)||x(e))return}if(i!==null){let r=i===`hooks`?`hook 文件应使用 use 前缀小驼峰且不带后缀,如 useRepos.ts`:i===`component`?`组件文件应使用大驼峰且不带后缀,如 RepoList.tsx`:`.${i} 后缀语义过于泛化,请改用具体语义后缀`;e.report({node:t,message:`文件命名违规: ${n}。禁用 .${i} 后缀,${r}`});return}let a=g.find(e=>e.pattern.test(n));a&&(ee(E(n,a),a.caseStyle)||e.report({node:t,message:`文件命名违规: ${n}。${a.description}`}))}}}}),ne=[`.types.ts`,`.types.d.ts`];function z(e){return ne.some(t=>e.endsWith(t))}const B=t({meta:{type:`problem`,docs:{description:`强制执行 types 文件中的接口命名规范(禁止 I 前缀)`}},createOnce(t){return{before(){let e=t.filename.replace(/\\/g,`/`).split(`/`).pop()??``;if(e.endsWith(`.test.ts`)||e.endsWith(`.spec.ts`)||!z(e))return!1},TSInterfaceDeclaration(n){let r=n.id.name;e(r)&&t.report({node:n,message:`类型文件中的接口名 "${r}" 使用了 I 前缀。现代 TypeScript 不推荐使用匈牙利命名法,建议使用 "${r.substring(1)}"`})}}}}),V=[`impl`,`functions`,`methods`,`handlers`,`classes`,`class`,`manager`,`object`,`processor`,`process`,`common`,`logic`],H=/* @__PURE__ */ new Set([`index.ts`,`index.tsx`,`main.ts`,`main.tsx`,`App.tsx`,`types.ts`,`errors.ts`,`constants.ts`,`types.d.ts`,`persistence.ts`,`typeorm.ts`,`migrate.ts`,`seed.ts`,`hono.ts`,`react.ts`,`vue.ts`,`next.ts`,`electron.ts`,`browser.ts`,`node.ts`]);function U(e){if(!e.endsWith(`.ts`)&&!e.endsWith(`.tsx`))return!1;let t=e.replace(/\.tsx?$/,``);return/^use[A-Z][a-zA-Z0-9]*$/.test(t)}function W(e){if(!e.endsWith(`.tsx`))return!1;let t=e.replace(`.tsx`,``);return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function G(e){return/^v\d+(-[a-z0-9-]+)?\.ts$/.test(e)}function K(e){let t=e.replace(/\.tsx?$/,``);return[/s$/,/es$/,/ies$/].some(e=>e.test(t))}function q(e){return e.endsWith(`.types.ts`)?!0:/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.tsx?$/.test(e)||/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.tsx?$/.test(e)}function J(e){let t=e.replace(/\.tsx?$/,``);for(let e of V){if(t.endsWith(`.${e}`))return e;let n=t.split(`.`);if(n.length>=2&&n[n.length-1]===e)return e}return null}function Y(e){let t=[],n=e.replace(/\.tsx?$/,``);return(n.includes(`service`)||n.includes(`Service`))&&t.push(`.service.ts`),(n.includes(`controller`)||n.includes(`Controller`))&&t.push(`.controller.ts`),(n.includes(`utils`)||n.includes(`helper`))&&t.push(`.utils.ts`),(n.includes(`constant`)||n.includes(`Constant`))&&t.push(`.constants.ts`),(n.includes(`config`)||n.includes(`Config`))&&t.push(`.config.ts`),t.length===0&&t.push(`.utils.ts`,`.config.ts`,`.constants.ts`),t}function X(e){for(let t of[`.test.ts`,`.test.tsx`,`.spec.ts`,`.spec.tsx`])if(e.endsWith(t)){let n=t.endsWith(`.tsx`)?`.tsx`:`.ts`;return e.replace(t,n)}return e}function Z(e){return typeof e==`object`&&!!e}function re(e,t,n,r){return!!(n?.skipPatterns&&T(r,n.skipPatterns)||H.has(t)||t.endsWith(`.d.ts`)||e.startsWith(`[`)||e.startsWith(`_`)||t.endsWith(`.tsx`)||e.endsWith(`.test.ts`)||e.endsWith(`.test.tsx`)||e.endsWith(`.spec.ts`)||e.endsWith(`.spec.tsx`)||G(t)||W(t)||U(t)||!J(t)&&K(t))}const Q=t({meta:{type:`problem`,docs:{description:`强制执行文件类型后缀规范,确保文件名明确表达其用途`},schema:[{type:`object`,properties:{skipPatterns:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{Program(t){let n=e.options?.[0],r=Z(n)?n:void 0,i=e.filename.replace(/\\/g,`/`).split(`/`).pop()??``,a=X(i);if(re(i,a,r,e.filename))return;let o=J(a);if(o){e.report({node:t,message:`文件 "${i}" 使用了禁止的后缀 ".${o}"。该后缀语义过于泛化,无法表达文件用途。请使用更具体的后缀,如 ".utils"、".service" 等。`});return}if(q(a))return;let s=Y(a);e.report({node:t,message:`文件 "${i}" 缺少类型后缀。除特殊文件外,所有文件应使用 xxx.yyy.ts 格式明确表达用途。建议: ${s.join(`, `)}`})}}}}),$=n({meta:{name:`@longzai-intelligence-oxlint/file-naming-plugin`},rules:{"file-naming":R,"require-type-naming":B,"require-type-suffix":Q}});export{$ as default,$ as fileNamingPlugin,R as fileNamingRule,B as requireTypeNamingRule,Q as requireTypeSuffixRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import"../rolldown-runtime-BqT_7tdF-DsHBzDG-.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";import{existsSync as n,readFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";const o=/(^|\/)lzi-builder\.config\.(ts|mts)$/,s=[`lzi-builder.config.ts`,`lzi-builder.config.mts`],c=/banner\s*:\s*['"]#!/,l=/banner\s*:\s*\{[^}]*#!/,u=/(^|\/)dist\//,d=/(^|\/)src\//;function f(e){return typeof e==`object`&&!!e}function p(e){let t=e.replace(/\\/g,`/`);return o.test(t)||t.endsWith(`/lzi.config.ts`)}function m(e){let t=e.bin;return typeof t==`string`?[t]:f(t)?Object.values(t).filter(e=>typeof e==`string`):[]}function h(e){return c.test(e)||l.test(e)}function g(e){let t=a(e,`package.json`);if(!n(t))return null;try{let e=JSON.parse(r(t,`utf8`));return f(e)?e:null}catch{return null}}function _(e,t){let n=m(e);return n.length===0?null:n.some(e=>u.test(e.replace(/^\.\//,``)))?h(t)?null:`missingBanner`:e.private===!0?null:n.some(e=>d.test(e.replace(/^\.\//,``)))?`binPointsToSource`:null}const v={missingBanner:`bin 入口指向 dist 产物但构建配置缺少 banner,发布后经 npm 软链直执行会交系统 shell 解析而报语法错误。请配置 "banner: '#!/usr/bin/env bun'",规范见 architecture 仓 "docs/best-practices/build-and-toolchain/guides/cli-bin-shebang.md"。`,binPointsToSource:`可发布包的 bin 入口指向 src 源码,安装链软链直指 TS 源码无法执行。请将 bin 指向 "dist" 产物并配置 banner。`},y=e({meta:{type:`problem`,docs:{description:`要求 bin 指向 dist 产物的包在构建配置注入 shebang banner`}},createOnce(e){return{before(){let t=e.filename;if(!p(t))return!1},Program(t){let r=i(e.filename);if(e.filename.replace(/\\/g,`/`).endsWith(`/lzi.config.ts`)&&s.some(e=>n(a(r,e))))return;let o=g(r);if(o===null)return;let c=_(o,e.sourceCode.text);c!==null&&e.report({node:t,message:v[c]})}}}}),b=/readPackageVersionString/;function x(e){return b.test(e)}function S(e,t){let n=m(e);return n.length===0||!n.some(e=>u.test(e.replace(/^\.\//,``)))||x(t)?null:`missingVersionInjection`}const C={missingVersionInjection:`版本注入未启用,bin 入口指向 dist 产物的包 --version 将回退框架兜底版本而非本包版本。请在 define 声明中以 readPackageVersionString 注入本包版本号,键为 process.env.CLI_VERSION,规范见 architecture 仓 ADR 0049 §3。`},w=e({meta:{type:`problem`,docs:{description:`要求 bin 指向 dist 产物的包在构建配置声明版本注入`}},createOnce(e){return{before(){let t=e.filename;if(!p(t))return!1},Program(t){let r=i(e.filename);if(e.filename.replace(/\\/g,`/`).endsWith(`/lzi.config.ts`)&&s.some(e=>n(a(r,e))))return;let o=g(r);if(o===null)return;let c=S(o,e.sourceCode.text);c!==null&&e.report({node:t,message:C[c]})}}}}),T=t({meta:{name:`@longzai-intelligence-oxlint/lzi-builder-config-plugin`},rules:{"require-bin-banner":y,"require-version-injection":w}});export{T as default,T as lziBuilderConfigPlugin,y as requireBinBannerRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import"../rolldown-runtime-BqT_7tdF-BT7sSRF3.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})}}}});function c(e){return typeof e==`object`&&!!e&&`type`in e}function l(e){if(!c(e)||e.type!==`CallExpression`)return!1;let t=e.callee;if(!c(t)||t.type!==`Identifier`||t.name!==`defineConfig`)return!1;let n=e.arguments??[];if(n.length!==1)return!1;let[r]=n;return!c(r)||r.type!==`ObjectExpression`?!1:(r.properties??[]).length===0}const u={emptyDefineConfigCall:"`defineConfig` 不接受空对象字面量,空配置请使用无参调用 `defineConfig()`。配置文件形态以仓内同类配置先例为准。"},d=e({meta:{type:`problem`,docs:{description:"禁止 `defineConfig` 以空对象字面量为唯一入参,空配置应无参调用"}},createOnce(e){return{before(){let t=e.filename;if(!r(t))return!1},CallExpression(t){t.type===`CallExpression`&&l(t)&&e.report({node:t,message:u.emptyDefineConfigCall})}}}}),f=t({meta:{name:`@longzai-intelligence-oxlint/lzi-config-plugin`},rules:{"no-empty-define-config":d,"require-define-config":s}});export{f as default,f as lziConfigPlugin,d as noEmptyDefineConfigRule,s as requireDefineConfigRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return typeof e==`object`&&!!e}function r(e){return n(e)&&`typeAnnotation`in e}function i(e){return n(e)&&`typeName`in e}function a(e){return n(e)&&`typeParameters`in e}function o(e){return n(e)&&`params`in e}function s(e){return n(e)&&`name`in e}function c(e){return n(e)&&`left`in e&&`right`in e}function l(e){return n(e)&&`type`in e}function u(e){return n(e)&&`exprName`in e}function d(e){return e.type!==`CallExpression`||e.callee.type!==`Identifier`?!1:e.callee.name===`defineHandler`}function f(e){if(e.type!==`ObjectPattern`)return[];let t=[];for(let n of e.properties)n.type===`Property`?n.key.type===`Identifier`&&t.push(n.key.name):n.type===`RestElement`&&n.argument.type===`Identifier`&&t.push(n.argument.name);return t}function p(e){if(e.type!==`MethodDefinition`||!(`decorators`in e)||!e.decorators)return!1;for(let t of e.decorators){let e=t.expression;if(e.type===`CallExpression`&&e.callee.type===`Identifier`&&e.callee.name===`TypedHandle`)return!0}return!1}function m(e,t){return!e||e.type!==`CallExpression`||e.callee.type!==`Identifier`?!1:t.includes(e.callee.name)}function h(e){if(e.type!==`BlockStatement`)return!1;for(let t of e.body)if(t.type===`ReturnStatement`&&t.argument!==null)return!0;return!1}const g=[`typedResponse`,`typedEmpty`];function _(e){if(!r(e))return!1;let t=e.typeAnnotation;if(!n(t))return!1;if(i(t)){let e=t.typeName;if(s(e)&&e.name===`InferRouteReturn`)return!0}if(a(t)){let e=t.typeParameters;if(o(e)){let t=e.params;for(let e of t)if(i(e)){let t=e.typeName;if(s(t)&&t.name===`InferRouteReturn`)return!0}}}return!1}function v(e){if(!r(e))return`unknown`;let t=e.typeAnnotation;if(!n(t)||!i(t))return`unknown`;let a=t.typeName;if(s(a)&&typeof a.name==`string`)return a.name;if(c(a)){let e=a.left,t=a.right;if(s(e)&&s(t)){let n=e.name,r=t.name;if(typeof n==`string`&&typeof r==`string`)return`${n}.${r}`}}return`unknown`}function y(e){if(!r(e))return!1;let t=e.typeAnnotation;if(!i(t))return!1;let n=t,c=n.typeName;if(!s(c)||c.name!==`Parameters`||!a(n))return!1;let d=n.typeParameters;if(!o(d))return!1;let f=d.params;if(f.length===0)return!1;let p=f[0];if(!l(p)||p.type!==`TSTypeQuery`||!u(p))return!1;let m=p.exprName;return s(m)&&m.name===`typedResponse`}function b(e){if(e.type!==`ObjectExpression`)return!1;for(let t of e.properties)if(t.type===`Property`&&t.key.type===`Identifier`&&t.key.name===`success`)return!0;return!1}function x(e,t,n){e.init&&d(e.init)&&e.id.type===`ObjectPattern`&&f(e.id).includes(`TypedHandle`)&&n()}function S(e,t){if(!p(e))return;let n=e.value;if(n.type!==`FunctionExpression`)return;let r=`returnType`in n?n.returnType:void 0;if(r&&!_(r)){let n=v(r);t.report({node:e,message:`handle 方法的返回类型必须使用 InferRouteReturn<typeof route>,当前使用了自定义类型 "${n}"。这会导致路由定义与实现的类型约束脱节。`})}let i=n.body;if(i)for(let e of i.body){if(e.type!==`ReturnStatement`)continue;let n=e.argument;n!=null&&(m(n,g)||b(n)&&t.report({node:e,message:`禁止在 @TypedHandle 方法中直接返回包含 success/error 字段的对象。请使用 typedResponse() 包装成功响应,通过抛出异常处理错误情况。`}))}}const C=e({meta:{type:`suggestion`,docs:{description:`强制 TypedHandler 的 handle 方法使用 InferRouteReturn 作为返回类型`}},createOnce(e){let t=!1;return{VariableDeclarator(n){x(n,e,()=>{t=!0})},TSTypeAliasDeclaration(n){t&&y(n)&&e.report({node:n,message:`禁止使用 Parameters<typeof typedResponse> 推断响应类型。请直接使用 InferRouteReturn<typeof route> 作为 handle 方法的返回类型。`})},MethodDefinition(n){t&&S(n,e)}}}}),w=/* @__PURE__ */ new Set([`Get`,`Post`,`Put`,`Delete`,`Patch`,`All`,`Options`,`Head`]);function T(e){return!e.includes(`:`)}function E(e){let t=e.arguments;if(!t.length)return`/`;let n=t[0];if(!n)return null;if(n.type===`Literal`){let e=`value`in n?n.value:void 0;if(typeof e==`string`)return e}return null}function D(e){return e.callee.type===`Identifier`?e.callee.name:null}function O(e){return e.type===`CallExpression`&&e.callee.type===`Identifier`&&w.has(e.callee.name)}function k(e){let t=[];for(let n of e)if(n.type===`MethodDefinition`&&`decorators`in n&&n.decorators)for(let e of n.decorators){let n=e.expression;if(!O(n)||n.type!==`CallExpression`)continue;let r=E(n),i=D(n);r!==null&&i&&t.push({path:r,method:i,isStatic:T(r)})}return t}function A(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=`${n.method}|${n.path}`,r=t.get(e);r?r.push(n):t.set(e,[n])}let n=/* @__PURE__ */ new Map;for(let[e,r]of t)r.length>1&&n.set(e,r);return n}function j(e){return e.type===`CallExpression`?e.callee.type===`Identifier`&&e.callee.name===`Controller`:e.type===`Identifier`&&e.name===`Controller`}function M(e){return e.type===`CallExpression`?e.callee.type===`Identifier`&&e.callee.name===`ApiTags`:e.type===`Identifier`&&e.name===`ApiTags`}function N(e){switch(e.type){case`Literal`:return typeof(`value`in e?e.value:void 0)==`string`;case`TemplateLiteral`:return!0;case`BinaryExpression`:return`operator`in e&&e.operator===`+`;default:return!1}}function P(e,t){if(!e)return t;switch(e.type){case`Identifier`:case`MemberExpression`:case`CallExpression`:return!0;default:return!1}}const F=e({meta:{type:`problem`,docs:{description:`防止 NestJS 控制器中出现重复的路由定义`}},createOnce(e){return{ClassBody(t){let n=A(k(t.body));for(let[,r]of n){let n=r[0];if(!n)continue;let i=`${n.method}('${n.path}')`;for(let n=1;n<r.length;n++)e.report({node:t,message:`发现重复路由 ${i}。控制器内的每个路由应该是唯一的,请检查并移除重复定义。`})}}}}}),I=e({meta:{type:`problem`,docs:{description:`确保 NestJS 控制器中静态路由位于参数化路由之前`}},createOnce(e){return{ClassBody(t){let n=k(t.body);if(n.length<2)return;let r=/* @__PURE__ */ new Map;for(let e of n){let t=r.get(e.method);t?t.push(e):r.set(e.method,[e])}for(let[,n]of r){let r=!1;for(let i of n)if(!i.isStatic)r=!0;else if(r){let r=n.find(e=>!e.isStatic);r&&e.report({node:t,message:`静态路由('${i.path}')应该位于参数化路由('${r.path}')之前。参数化路由会拦截静态路由的请求。`});return}}}}}});function L(e){return!(typeof e!=`object`||!e)}const R=e({meta:{type:`suggestion`,docs:{description:`推荐使用 TypedController 装饰器替代 Controller + ApiTags 组合`},schema:[{type:`object`,properties:{checkApiTags:{type:`boolean`,description:`是否检查同时存在 ApiTags 装饰器`}},additionalProperties:!1}]},createOnce(e){let t=e.options?.[0]??{},n=L(t)?t:{},r=n.checkApiTags===void 0||n.checkApiTags;return{ClassDeclaration(t){`decorators`in t&&t.decorators&&t.decorators.length!==0&&t.decorators.some(e=>j(e.expression))&&(!r||t.decorators.some(e=>M(e.expression)))&&e.report({node:t,message:`推荐使用 @TypedController() 装饰器替代 @Controller() + @ApiTags() 组合。TypedController 可以从路由定义中自动提取 API 标签。`})}}}});function z(e){return!(typeof e!=`object`||!e)}const B=e({meta:{type:`problem`,docs:{description:`Controller 装饰器必须使用路由常量,禁止使用字符串字面量`},schema:[{type:`object`,properties:{allowedIdentifiers:{type:`array`,items:{type:`string`},description:`允许的路由常量标识符前缀列表`},allowEmpty:{type:`boolean`,description:`是否允许 Controller 装饰器无参数`}},additionalProperties:!1}]},createOnce(e){let t=e.options?.[0]??{},n=z(t)?t:{},r=n.allowEmpty===void 0||n.allowEmpty;return{Decorator(t){let n=t.expression;if(!j(n)||n.type!==`CallExpression`)return;let i=n.arguments[0];i?N(i)?e.report({node:i,message:`Controller 装饰器必须使用路由常量,禁止使用字符串字面量。请使用 clientRoutes.xxx.prefix 或 manageRoutes.xxx.prefix 替代。`}):P(i,r)||e.report({node:i,message:`Controller 装饰器必须使用路由常量,禁止使用字符串字面量。请使用 clientRoutes.xxx.prefix 或 manageRoutes.xxx.prefix 替代。`}):r||e.report({node:t,message:`Controller 装饰器必须使用路由常量,禁止使用字符串字面量。请使用 clientRoutes.xxx.prefix 或 manageRoutes.xxx.prefix 替代。`})}}}}),V=[`typedResponse`,`typedEmpty`,`typedStream`,`rawResponse`];function H(e){return!(typeof e!=`object`||!e)}function U(e,t,n,r){let i=e.init;if(!i||!d(i))return;let a=e.id;if(a.type!==`ObjectPattern`)return;let o=f(a),s=o.includes(`TypedHandle`),c=o.some(e=>t.includes(e));s&&r(),s&&!c&&n.report({node:e,message:`使用 defineHandler 且解构 TypedHandle 时,必须同时解构 typedResponse 或 typedEmpty`})}function W(e,t,n,r){if(!p(e)||n)return;let i=e.value;if(i.type!==`FunctionExpression`)return;let a=i.body;if(a&&h(a))for(let e of a.body){if(e.type!==`ReturnStatement`)continue;let n=e.argument;n!=null&&(m(n,t)||r.report({node:e,message:`@TypedHandle 方法的 return 语句必须使用 typedResponse() 或 typedEmpty() 包装返回值`}))}}const G=e({meta:{type:`problem`,docs:{description:`使用 defineHandler 且解构 TypedHandle 时,必须同时解构 typedResponse、typedEmpty 或 typedStream,且 TypedHandle 方法的 return 语句必须使用包装函数`},schema:[{type:`object`,properties:{responseFunctions:{type:`array`,items:{type:`string`},description:`覆盖默认的响应包装函数名列表`},allowDirectReturn:{type:`boolean`,description:`是否允许 TypedHandle 方法直接返回值(不经过包装函数)`}},additionalProperties:!1}]},createOnce(e){let t=e.options?.[0]??{},n=H(t)?t:{},r=n.responseFunctions??V,i=n.allowDirectReturn??!1,a=!1;return{VariableDeclarator(t){U(t,r,e,()=>{a=!0})},MethodDefinition(t){a&&W(t,r,i,e)}}}}),K=t({meta:{name:`@longzai-intelligence-oxlint/nestjs-route-plugin`},rules:{order:I,"no-duplicates":F,"require-route-constant":B,"prefer-typed-controller":R,"require-typed-response":G,"enforce-typed-handler-return":C}});export{K as default,K as nestjsRoutePlugin,C as enforceTypedHandlerReturnRule,f as extractDestructuredNames,k as extractRouteInfos,A as findDuplicateRoutes,h as hasReturnStatement,p as hasTypedHandleDecorator,M as isApiTagsDecorator,j as isControllerDecorator,d as isDefineHandlerCall,m as isResponseFunctionCall,O as isRouteDecorator,T as isStaticRoute,F as noDuplicatesRule,I as orderRule,R as preferTypedControllerRule,B as requireRouteConstantRule,G as requireTypedResponseRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return/\/(apps|packages)\//.test(e)&&e.endsWith(`/package.json`)}function r(e){return e.endsWith(`-infrastructure`)}function i(e){return typeof e==`object`&&!!e}const a=e({meta:{type:`problem`,docs:{description:`禁止 apps/packages 层声明领域基础设施包依赖(ADR 0102:域细节只经域公开面流出)`}},createOnce(e){return{before(){if(!n(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let a=JSON.parse(n);if(!i(a)||!i(a.dependencies))return;let o=Object.keys(a.dependencies).filter(r);o.length>0&&e.report({node:t,message:`禁止 apps/packages 层声明领域基础设施包依赖(ADR 0102):域的持久化实现细节只经域公开面流出。发现依赖 [${o.join(`, `)}]。`})}catch{}}}}}),o=/* @__PURE__ */ new Set([`tsgo`,`tsc`]),s={bareCompiler:`裸调 tsgo 或 tsc 执行类型检查`,legacyDevCliTypecheck:`使用 lzi-dev-cli typecheck 旧封装,应迁移至 lzi-tsgo typecheck`,wrapperWithoutConfig:`lzi-tsgo typecheck 未传 tsconfig 路径`,wrapperWithoutSubcommand:`调用 lzi-tsgo 未带 typecheck 子命令`};function ee(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function c(e){return typeof e==`object`&&!!e}function l(e){return e===`typecheck`||e.startsWith(`typecheck:`)}function u(e){return e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(e=>e.length>0)}function d(e){let t=e.split(/\s+/).filter(e=>e.length>0),n=``,r=[];for(let e of t)if(n)r.push(e);else{if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(e))continue;n=e}return n?{command:n,args:r}:null}function f(e,t,n){let r=d(t);if(!r)return null;let i=r.command,a=r.args;return o.has(i)?n||a.includes(`--noEmit`)?{key:e,kind:`bareCompiler`,segment:t}:null:n?i===`lzi-tsgo`?a[0]===`typecheck`?a.slice(1).some(e=>!e.startsWith(`-`))?null:{key:e,kind:`wrapperWithoutConfig`,segment:t}:{key:e,kind:`wrapperWithoutSubcommand`,segment:t}:i===`lzi-dev-cli`&&a[0]===`typecheck`?{key:e,kind:`legacyDevCliTypecheck`,segment:t}:null:null}function te(e){let t=[];for(let[n,r]of Object.entries(e)){if(typeof r!=`string`)continue;let e=l(n);for(let i of u(r)){let r=f(n,i,e);r&&t.push(r)}}return t}function p(e){if(!c(e))return null;let t=e.scripts;return c(t)?t:null}function m(e){return`scripts 键 ${e.key} ${s[e.kind]}。类型检查统一使用 lzi-tsgo typecheck 加 tsconfig 路径,依据 ADR 0057 与 ADR 0117。`}const ne=e({meta:{type:`problem`,docs:{description:`禁止在 package.json scripts 中绕过 lzi-tsgo 封装执行类型检查`}},createOnce(e){return{before(){let t=e.filename;if(!ee(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=p(JSON.parse(n));if(r){let n=te(r);for(let r of n)e.report({node:t,message:m(r)})}}catch{}}}}});function re(e){return/\/domains\/[^/]+\/implementation\/package\.json$/.test(e)}function h(e){return typeof e==`object`&&!!e}function ie(e,t){if(e===`./domain`)return!0;let n=typeof t==`string`?t:h(t)?[t.types,t.import,t.require,t.default].filter(e=>typeof e==`string`).join(` `):``;return/(^|\/)dist\/domain(\.|\/|$)/.test(n)||/(^|\/)src\/domain(\/|$)/.test(n)}const ae={noDomainLayerSubpathExport:"禁止领域实现包声明领域分层子路径导出(ADR 0101):领域分层(domain/)为 implementation 包内私有,仓储端口应落位 contract 包;`./domain` 类子导出属违规逃逸通道。"},g=e({meta:{type:`problem`,docs:{description:`禁止领域实现包声明领域分层子路径导出(ADR 0101 违规逃逸通道)`}},createOnce(e){return{before(){if(!re(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!h(r)||!h(r.exports))return;for(let[n,i]of Object.entries(r.exports))n!==`.`&&ie(n,i)&&e.report({node:t,message:`${ae.noDomainLayerSubpathExport}(发现子路径 "${n}")`})}catch{}}}}}),_=/* @__PURE__ */ new Set([`@types/bun`,`@types/node`,`@typescript/native-preview`,`oxfmt`,`oxlint`,`tsdown`,`turbo`]),v=[`@longzai-intelligence-agent-tools/`,`@longzai-intelligence-bun/`,`@longzai-intelligence-builder/`,`@longzai-intelligence-changelog/`,`@longzai-intelligence-decision/`,`@longzai-intelligence-dev-tools/`,`@longzai-intelligence-env/`,`@longzai-intelligence-git/`,`@longzai-intelligence-issues/`,`@longzai-intelligence-oxfmt/`,`@longzai-intelligence-oxlint/`,`@longzai-intelligence-release/`,`@longzai-intelligence-tsgo/`,`@longzai-intelligence-tsdown/`,`@longzai-intelligence-typescript/`,`@longzai-intelligence-vitest/`,`@longzai-intelligence-vscode/`],y=/* @__PURE__ */ new Set([`@longzai-intelligence/typescript-config`]),b=/* @__PURE__ */ new Set([`@longzai-intelligence-dev-tools/vite-plugin`,`@longzai-intelligence-typescript/rolldown-plugin-type-boundary`]);function x(e){return/\/(apps|packages|domains|plugins)\//.test(e)&&e.endsWith(`/package.json`)}function S(e){return b.has(e)?!1:_.has(e)||y.has(e)?!0:v.some(t=>e.startsWith(t))}function C(e){return typeof e==`object`&&!!e}const w=e({meta:{type:`problem`,docs:{description:`禁止子包声明应放 workspace 根的开发依赖,依据 ADR 0036 根已声明与应放根类别由根统一承载`}},createOnce(e){return{before(){if(!x(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!C(r)||!C(r.devDependencies)||`workspaces`in r)return;let i=Object.keys(r.devDependencies).filter(S);i.length>0&&e.report({node:t,message:`禁止子包声明应放 workspace 根的开发依赖,ADR 0036 判定根已声明与应放根类别均由根统一承载,子包经 Bun hoisting 取用。发现依赖 [${i.join(`, `)}]。`})}catch{}}}}});function T(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function E(e){return typeof e==`object`&&!!e}const D={noMitLicense:`禁止使用 MIT 协议。项目中的所有包都应使用 "license": "UNLICENSED"。`},O=e({meta:{type:`problem`,docs:{description:`禁止在 package.json 中使用 MIT 协议`}},createOnce(e){return{before(){let t=e.filename;if(!T(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);E(r)&&r.license===`MIT`&&e.report({node:t,message:D.noMitLicense})}catch{}}}}});function k(e){return/\/domains\/[^/]+\/infrastructure\/package\.json$/.test(e)}function A(e){return e.endsWith(`-infrastructure`)?`${e.slice(0,-15)}-implementation`:null}function j(e){return typeof e==`object`&&!!e}const M=e({meta:{type:`problem`,docs:{description:`禁止领域基础设施包依赖同域实现包(ADR 0101 依赖图只允许 infrastructure ──> contract)`}},createOnce(e){return{before(){if(!k(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!j(r)||typeof r.name!=`string`)return;let i=A(r.name);if(!i||!j(r.dependencies))return;i in r.dependencies&&e.report({node:t,message:`禁止领域基础设施包依赖同域实现包(ADR 0101):依赖图只允许 infrastructure ──> contract,发现依赖 "${i}"。`})}catch{}}}}});function N(e){return e.endsWith(`/package.json`)}const P=/^(?:\.{1,2}\/)?src\//;function F(e){return typeof e==`object`&&!!e}function I(e,t,n){if(typeof t==`string`)P.test(t)&&n.push({subpath:e,target:t});else if(F(t))for(let r of Object.values(t))I(e,r,n)}function L(e){let t=[];if(typeof e==`string`)return I(`.`,e,t),t;if(F(e))for(let[n,r]of Object.entries(e))I(n,r,t);return t}const R={noSrcExports:`禁止 exports 指向 src 源码(统一 dist 产物范式):包导出一律指向 dist 产物,指向源码会使消费方程序拉入本包源码编译。`},z=e({meta:{type:`problem`,docs:{description:`禁止 exports 指向 src 源码(统一 dist 产物范式门禁)`}},createOnce(e){return{before(){if(!N(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!F(r))return;let i=L(r.exports);for(let n of i)e.report({node:t,message:`${R.noSrcExports}(发现 "${n.subpath}" 指向 "${n.target}")`})}catch{}}}}}),B=[`-domain`,`-contract`,`-implementation`,`-infrastructure`];function V(e){return/\/domains\/[^/]+\/ui\/package\.json$/.test(e)}function H(e){return B.some(t=>e.endsWith(t))}function U(e){return typeof e==`object`&&!!e}const W=e({meta:{type:`problem`,docs:{description:`禁止 domains ui 层声明域内四层包依赖,ADR 0127:UI 面域外依赖唯一指向生成式 sdk 客户端`}},createOnce(e){return{before(){if(!V(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!U(r)||!U(r.dependencies))return;let i=Object.keys(r.dependencies).filter(H);i.length>0&&e.report({node:t,message:`禁止 ui 层声明域内包依赖,ADR 0127:UI 面域外依赖唯一指向生成式 sdk 客户端,DDD 主体对 ui 全封闭。发现依赖 [${i.join(`, `)}]。`})}catch{}}}}}),G=[`mcp`,`cli`,`tui`,`dev`];function K(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}const q=/^@longzai-intelligence-([a-z0-9][a-z0-9-]*)\//,J=/^longzai-intelligence-[a-z0-9][a-z0-9-]*$/;function Y(e){return typeof e==`object`&&!!e}function oe(e){let t=e.replace(/\\/g,`/`).split(`/`);for(let e=t.length-2;e>=0;--e){let n=t[e];if(n!==void 0&&J.test(n))return n.slice(21)}return null}function se(e){let t=q.exec(e);return t===null?null:t[1]??null}function ce(e,t){return oe(e)??se(t)}function X(e){return`lzi-${e}`}function Z(e){return e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e}function le(e,t,n){let r=X(t),i=G.find(t=>e===t||e.endsWith(`-${t}`));if(i!==void 0)return`${r}-${i}`;if(n===void 0)return r;let a=Z(n);return e.endsWith(`-${a}`)?`${r}-${a}`:r}function ue(e,t,n){let r=X(t);return e===r||G.some(t=>e===`${r}-${t}`)?!0:n!==void 0&&e===`${r}-${Z(n)}`}function Q(e,t){let n=e.bin;return typeof n==`string`?[Z(t)]:Y(n)?Object.keys(n):[]}const de={invalidBinName:`bin 命令名不符合 ADR 0049 完整名称规范,命令名须为 lzi- 前缀加项目全名的 kebab-case 形态,禁止缩写`};function fe(e,t){return`${de.invalidBinName},实际命令名为 "${e}",应为 "${t}"。`}const pe=e({meta:{type:`problem`,docs:{description:`校验 package.json 的 bin 命令名使用项目全名,禁止缩写,依据 ADR 0049`}},createOnce(e){return{before(){let t=e.filename;if(!K(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!Y(r)||typeof r.name!=`string`||r.bin===void 0||r.name.includes(`{{`))return;let i=ce(e.filename,r.name);if(i===null)return;let a=Q(r,r.name);for(let n of a)n.includes(`{{`)||ue(n,i,r.name)||e.report({node:t,message:fe(n,le(n,i,r.name))})}catch{}}}}}),$=t({meta:{name:`@longzai-intelligence-oxlint/package-json-plugin`},rules:{"no-app-infrastructure-dependency":a,"no-bare-tsgo-invocation":ne,"no-domain-layer-subpath-export":g,"no-hoistable-dev-dependency":w,"no-mit-license":O,"no-sibling-implementation-dependency":M,"no-src-exports":z,"no-ui-domain-package-dependency":W,"require-full-project-bin-name":pe}});export{$ as default,$ as packageJsonPlugin,T as isPackageJson,O as noMitLicenseRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=[/^@\//,/^@main\//,/^@renderer\//,/^@preload\//,/^@shared\//],r=/^@longzai-intelligence\//;function i(e){return e.type===`Program`}function a(e){return e.type===`ImportDeclaration`}function o(e,t){return t?`type`:n.some(t=>t.test(e))?`internal`:r.test(e)?`external`:e.startsWith(`.`)?e===`.`||e===`./`?`index`:e.startsWith(`../`)?`parent`:`sibling`:`external`}const s={type:0,"side-effect":1,external:2,internal:3,parent:4,sibling:5,index:6,unknown:7},c=e({meta:{type:`layout`,docs:{description:`对 import 语句进行排序`}},createOnce(e){return{Program(t){if(!i(t))return;let n=t.body,r=[];for(let e of n)if(a(e)){let t=e.source.value,n=e.importKind===`type`;r.push({node:e,source:t,group:o(t,n),isType:n})}else e.type===`ExpressionStatement`&&e.expression.type===`CallExpression`&&e.expression.callee.type===`Identifier`&&e.expression.callee.name===`import`&&r.push({node:e,source:``,group:`side-effect`,isType:!1});for(let t=1;t<r.length;t++){let n=r[t-1],i=r[t];n&&i&&s[n.group]>s[i.group]&&e.report({node:i.node,message:`导入顺序错误:'${i.source}' 应在 '${n.source}' 之前`})}}}}});function l(e){return e.type===`ImportDeclaration`}function u(e){return e.type===`ImportSpecifier`}const d={"sort-imports":c,"sort-named-imports":e({meta:{type:`layout`,docs:{description:`对具名导入进行排序`}},createOnce(e){return{ImportDeclaration(t){if(!l(t))return;let n=t.specifiers.filter(u);if(n.length<=1)return;let r=n.map(e=>e.imported.type===`Identifier`?e.imported.name:String(e.imported.value)),i=[...r].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));for(let n=0;n<r.length;n++)if(r[n]!==i[n]){e.report({node:t,message:`具名导入未按字母顺序排列:'${r[n]}' 应为 '${i[n]}'`});break}}}}})},f=t({meta:{name:`@longzai-intelligence-oxlint/perfectionist-plugin`},rules:d});export{f as default,f as perfectionistPlugin,d as perfectionistRules};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=/\/hooks\//,r=/^use-[a-z][-a-z0-9]*(?:\.hook)?\.tsx?$/,i=/\.hook\.tsx?$/,a=/^use[A-Za-z-]*\.types\.ts$/;function o(e){return`${e.replace(/\.tsx?$/,``).replace(/\.hook$/,``).split(`-`).map((e,t)=>t===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(``)}${e.endsWith(`.tsx`)?`.tsx`:`.ts`}`}const s=e({meta:{type:`problem`,docs:{description:`检测 hooks/ 目录下不规范的 hook 文件命名`}},createOnce(e){return{before(){let t=e.filename.replace(/\\/g,`/`);if(!n.test(t))return!1},Program(t){let s=e.filename.replace(/\\/g,`/`);if(!n.test(s))return;let c=s.split(`/`).pop()??``;if(r.test(c)){let n=o(c);e.report({node:t,message:`Hook 文件命名违规: ${c} 使用了 kebab-case。应使用 camelCase,如 ${n}`})}else if(i.test(c)){let n=c.replace(/\.hook(\.tsx?)$/,`$1`);e.report({node:t,message:`Hook 文件命名违规: ${c} 使用了 .hook 后缀。应移除 .hook 后缀,如 ${n}`})}else a.test(c)&&e.report({node:t,message:`Hook 文件命名违规: ${c}。类型文件不应以 use 开头`})}}}}),c=t({meta:{name:`@longzai-intelligence-oxlint/react-plugin`},rules:{"no-incorrect-hook-naming":s}});export{c as default,c as reactPlugin,s as noIncorrectHookNamingRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=/* @__PURE__ */ new Set(/* @__PURE__ */ `object.enum.string.number.boolean.array.record.tuple.union.intersection.literal.nativeEnum.any.unknown.void.never.date.bigint.map.set.nan.null.undefined.symbol.coerce.lazy.promise.function.branded.catch.default.describe.nullable.optional.transform.pipe.refine.superRefine.preprocess`.split(`.`));function r(e){return e.endsWith(`.types.ts`)}const i=e({meta:{type:`problem`,docs:{description:`禁止在 *.types.ts 文件中包含 Zod Schema 运行时定义,允许 z.infer 类型推导`}},createOnce(e){return{before(){let t=e.filename;if(!r(t))return!1},CallExpression(t){if(t.callee.type!==`MemberExpression`||t.callee.object.type!==`Identifier`||t.callee.object.name!==`z`||t.callee.property.type!==`Identifier`)return;let r=t.callee.property.name;n.has(r)&&e.report({node:t,message:`*.types.ts 文件不允许包含 Zod Schema 定义。"z.${r}()" 是运行时验证逻辑,应放在 *.schema.ts 文件中。`})},ImportDeclaration(t){if(t.source.value===`zod`&&!(`importKind`in t&&t.importKind===`type`)){for(let n of t.specifiers)if(n.type===`ImportNamespaceSpecifier`||!(`importKind`in n&&n.importKind===`type`)){e.report({node:t,message:`*.types.ts 文件不允许从 zod 进行值导入。如需引用 Zod 类型,请使用 import type 语法。`});return}}}}}});function a(e){return e.endsWith(`.schema.ts`)}function o(e){if(`id`in e&&e.id!==null&&typeof e.id==`object`&&`name`in e.id&&typeof e.id.name==`string`)return e.id.name}const s=e({meta:{type:`problem`,docs:{description:`禁止在 *.schema.ts 文件中包含任何 type 定义,强制拆分到 *.types.ts 文件`}},createOnce(e){return{before(){let t=e.filename;if(!a(t))return!1},TSTypeAliasDeclaration(t){let n=o(t);e.report({node:t,message:`*.schema.ts 文件不允许包含 type 定义。类型 "${n??`未知类型`}" 应拆分到对应的 *.types.ts 文件中。`})}}}}),c=t({meta:{name:`@longzai-intelligence-oxlint/schema-type-separation-plugin`},rules:{"no-type-in-schema":s,"no-schema-in-types":i}});export{n as ZOD_SCHEMA_METHODS,c as default,c as schemaTypeSeparationPlugin,a as isSchemaFile,r as isTypesFile,i as noSchemaInTypesRule,s as noTypeInSchemaRule};
@@ -0,0 +1,9 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{parseSeparatorComment as e}from"./tsdoc.js";import{defineRule as t,eslintCompatPlugin as n}from"@oxlint/plugins";function r(){return{isBlockStart:!1,isBlockEnd:!1,isObjectStart:!1,isObjectEnd:!1,isArrayStart:!1,isArrayEnd:!1,isClassStart:!1,isClassEnd:!1,isInterfaceStart:!1,isInterfaceEnd:!1,isTypeStart:!1,isTypeEnd:!1,isEnumStart:!1,isEnumEnd:!1,isModuleStart:!1,isModuleEnd:!1,isFunctionStart:!1,isFunctionEnd:!1}}function i(e){return!!(e.includes(`type `)||e.includes(`extends {`)||e.includes(`type{`)||e.includes(`Array<{`)||e.includes(`Promise<{`)||e.includes(`<{`)||e.includes(`| {`)||e.includes(`as {`)||e.includes(`Record<{`)||e.includes(`Partial<{`)||e.includes(`Required<{`)||e.includes(`Pick<{`)||e.includes(`Omit<{`)||e.includes(`& {`))}function a(e,t){for(let n=2;n<=5&&t>n;n++){let r=e[t-n-1];if(r){let e=r.trimEnd();if(e.includes(`Record<{`)||e.includes(`Partial<{`)||e.includes(`Required<{`)||e.includes(`Pick<{`)||e.includes(`Omit<{`)||e.includes(`Array<{`)||e.includes(`Promise<{`)||e.includes(`type `)||e.includes(`interface `))return!0}}return!1}function o(e){return e.endsWith(`) {`)||e.endsWith(`){`)||/\)\s*(?::\s*[^{]+)?\{/.test(e)||e.includes(`=> {`)}function s(e){return!!(e.endsWith(`) {`)||e.endsWith(`){`)||e===`{`||/: [^{]+ \{$/.test(e)||/\)\s*(?::\s*[^{]+)?\{/.test(e)||e.endsWith(`}> {`)||e===`> {`||e.includes(`try {`)||e.includes(`catch {`)||e.includes(`finally {`)||e.includes(`=> {`)||e.includes(`else {`)||/^\w+\s*\{$/.test(e)||/^\| .+ \{$/.test(e))}function c(e){let t=e.includes(`namespace `)||e.includes(`namespace{`),n=e.startsWith(`declare global`)||e.startsWith(`declare module`);return e.includes(`module `)||e.includes(`module{`)||t||n}function l(e,t){for(let n=2;n<=10&&t>n;n++){let r=e[t-n-1];if(r){let e=r.trim();if(e.includes(`class `)||e.includes(`class{`))return!0}}return!1}function u(e){let t=/\w\(\{$/.test(e),n=e.endsWith(`, {`),r=/=>\s*\(\{$/.test(e),i=e.includes(`export default {`);return e.includes(`: {`)||e.endsWith(`= {`)||t||n||r||i}function d(e,t,n,r){i(t)?e.isTypeStart=!0:t.trim()===`{`?e[a(n,r)?`isTypeStart`:`isBlockStart`]=!0:t.includes(`interface `)||t.includes(`interface{`)?e.isInterfaceStart=!0:t.includes(`enum `)||t.includes(`enum{`)?e.isEnumStart=!0:c(t)?e.isModuleStart=!0:t.includes(`class `)||t.includes(`class{`)||t===`> {`?e.isClassStart=!0:s(t)?(e.isBlockStart=!0,o(t)&&(e.isFunctionStart=!0)):u(t)?e.isObjectStart=!0:t.includes(`: [`)||t.endsWith(`= [`)||t.endsWith(`[`)?e.isArrayStart=!0:l(n,r)&&(e.isClassStart=!0)}function f(e,t,n){if(t<=1)return;let r=t-2;for(;r>=0;){let e=n[r];if(e&&e.trim().length>0)break;r--}if(r<0)return;let i=n[r];if(!i)return;let a=i.trim();a.endsWith(`{`)||/>+\s*\{\s*$/.test(a)?d(e,a,n,t):a.endsWith(`(`)||a.endsWith(`>`)?e.isBlockStart=!0:a.endsWith(`[`)&&(e.isArrayStart=!0)}function p(e,t,n){if(t>=n.length)return;let r=n[t];if(!r)return;let i=r.trimStart();i===`}`||i===`};`?(e.isBlockEnd=!0,e.isObjectEnd=!0,e.isClassEnd=!0,e.isInterfaceEnd=!0,e.isTypeEnd=!0,e.isEnumEnd=!0,e.isModuleEnd=!0,e.isFunctionEnd=!0):i.startsWith(`];`)&&(e.isArrayEnd=!0)}function m(e,t){let n=r(),i=e.loc.start.line,a=e.loc.end.line;return f(n,i,t),p(n,a,t),n}const h={beforeBlockComment:!0,afterBlockComment:!1,beforeLineComment:!1,afterLineComment:!1,allowBlockStart:!1,allowBlockEnd:!1,allowObjectStart:!1,allowObjectEnd:!1,allowArrayStart:!1,allowArrayEnd:!1,allowClassStart:!1,allowClassEnd:!1,allowInterfaceStart:!1,allowInterfaceEnd:!1,allowTypeStart:!1,allowTypeEnd:!1,allowEnumStart:!1,allowEnumEnd:!1,allowModuleStart:!1,allowModuleEnd:!1,allowFunctionStart:!1,allowFunctionEnd:!1,ignorePattern:void 0,applyDefaultIgnorePatterns:!0};function ee(e,t){if(e.loc.start.line<=1)return!1;let n=g(e.loc.start.line,t);return n?/\w+=\{$/.test(n):!1}function te(e,t){if(e.loc.start.line<=1)return!1;let n=g(e.loc.start.line,t);if(!n||!(n===`}`||/^\w+=("[^"]*"|'[^']*')$/.test(n)||/^\w+=\{.+\}$/.test(n)||/^<[A-Z]\w*$/.test(n)||/^\w+:$/.test(n)))return!1;let r=_(e.loc.end.line,t);return r?/^\w+=/.test(r)||/^\/?>$/.test(r)||r.startsWith(`/>`)||r.startsWith(`(`)||r.startsWith(`<`):!1}const ne=/(?:,|:|\?|=>|&&|\|\||=|[+*/%&|^<-])$/u;function re(e,t){if(e.loc.start.line<=1)return!1;let n=y(e.loc.start.line,t);return n?ne.test(n):!1}function g(e,t){let n=e-2;for(;n>=0;){let e=t[n];if(e&&e.trim().length>0)return e.trim();n--}return null}function _(e,t){let n=e;for(;n<t.length;){let e=t[n];if(e&&e.trim().length>0)return e.trim();n++}return null}function v(e){return e.startsWith(`//`)||e.startsWith(`/*`)||e.startsWith(`*`)}function y(e,t){let n=e-2;for(;n>=0;){let e=t[n];if(e&&e.trim().length>0&&!v(e.trim()))return e.trim();n--}return null}function b(e,t){let n=t[e.loc.start.line-1];return n?n.slice(0,e.loc.start.column).trim().length>0:!1}function x(e,t){if(t.length===0)return!1;let n=t[t.length-1];return n?n.loc.end.line+1>=e.loc.start.line:!1}const S=[/^eslint/i,/^jshint/i,/^jslint/i,/^istanbul/i,/^global/i,/^exported/i,/^jscs/i];function C(e,t){let n=e.value.trim();if(t.applyDefaultIgnorePatterns!==!1){for(let e of S)if(e.test(n))return!0}return!!(t.ignorePattern&&new RegExp(t.ignorePattern,`u`).test(n))}function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e,t,n){let r=t[n];typeof r==`boolean`&&(e[n]=r)}function E(e,t){T(e,t,`beforeBlockComment`),T(e,t,`afterBlockComment`),T(e,t,`beforeLineComment`),T(e,t,`afterLineComment`),T(e,t,`allowBlockStart`),T(e,t,`allowBlockEnd`),T(e,t,`allowObjectStart`),T(e,t,`allowObjectEnd`),T(e,t,`allowArrayStart`),T(e,t,`allowArrayEnd`),T(e,t,`allowClassStart`),T(e,t,`allowClassEnd`),T(e,t,`allowInterfaceStart`),T(e,t,`allowInterfaceEnd`),T(e,t,`allowTypeStart`),T(e,t,`allowTypeEnd`),T(e,t,`allowEnumStart`),T(e,t,`allowEnumEnd`),T(e,t,`allowModuleStart`),T(e,t,`allowModuleEnd`),T(e,t,`allowFunctionStart`),T(e,t,`allowFunctionEnd`),T(e,t,`applyDefaultIgnorePatterns`)}function D(e,t,n){let r=t[n];typeof r==`string`&&(e[n]=r)}function O(e){let t={...h};return w(e)&&(E(t,e),D(t,e,`ignorePattern`)),t}function k(e,t){return e<=1||t[e-2]?.trim()===``}function A(e,t){return e>=t.length||t[e]?.trim()===``}function j(e,t){return e.isBlockStart&&(t.allowBlockStart??!1)||e.isObjectStart&&(t.allowObjectStart??!1)||e.isArrayStart&&(t.allowArrayStart??!1)||e.isClassStart&&(t.allowClassStart??!1)||e.isInterfaceStart&&(t.allowInterfaceStart??!1)||e.isTypeStart&&(t.allowTypeStart??!1)||e.isEnumStart&&(t.allowEnumStart??!1)||e.isModuleStart&&(t.allowModuleStart??!1)||e.isFunctionStart&&(t.allowFunctionStart??!1)}function M(e,t){return e.isBlockEnd&&(t.allowBlockEnd??!1)||e.isObjectEnd&&(t.allowObjectEnd??!1)||e.isArrayEnd&&(t.allowArrayEnd??!1)||e.isClassEnd&&(t.allowClassEnd??!1)||e.isInterfaceEnd&&(t.allowInterfaceEnd??!1)||e.isTypeEnd&&(t.allowTypeEnd??!1)||e.isEnumEnd&&(t.allowEnumEnd??!1)||e.isModuleEnd&&(t.allowModuleEnd??!1)||e.isFunctionEnd&&(t.allowFunctionEnd??!1)}function N(e,t,n,r,i){let a=e.type===`Block`;if(a&&n.beforeBlockComment||!a&&n.beforeLineComment){if(j(i,n))return;let o=e.loc.start.line;k(o,t)||r.report({loc:{start:e.loc.start,end:e.loc.start},message:a?`块注释前需要空行`:`行注释前需要空行`,fix:n=>{let r=0;for(let n=0;n<e.loc.start.line-1;n++)r+=(t[n]?.length??0)+1;return n.insertTextBeforeRange([r,r],`
2
+ `)}})}}function P(e,t,n,r,i){let a=e.type===`Block`;if(a&&n.afterBlockComment||!a&&n.afterLineComment){if(M(i,n))return;let o=e.loc.end.line;A(o,t)||r.report({loc:{start:e.loc.end,end:e.loc.end},message:a?`块注释后需要空行`:`行注释后需要空行`,fix:t=>t.insertTextAfterRange([e.range[1],e.range[1]],`
3
+ `)})}}function F(e,t,n,r,i=[],a=!1,o=!1){if(b(e,t)||C(e,n))return;let s=x(e,i),c=m(e,t),l=ee(e,t)||te(e,t),u=re(e,t);!a&&!s&&!l&&!u&&N(e,t,n,r,c),o||P(e,t,n,r,c)}const ie=t({meta:{type:`layout`,fixable:`whitespace`,docs:{description:`要求在注释前后有空行`},schema:[{type:`object`,properties:{beforeBlockComment:{type:`boolean`},afterBlockComment:{type:`boolean`},beforeLineComment:{type:`boolean`},afterLineComment:{type:`boolean`},allowBlockStart:{type:`boolean`},allowBlockEnd:{type:`boolean`},allowObjectStart:{type:`boolean`},allowObjectEnd:{type:`boolean`},allowArrayStart:{type:`boolean`},allowArrayEnd:{type:`boolean`},allowClassStart:{type:`boolean`},allowClassEnd:{type:`boolean`},allowInterfaceStart:{type:`boolean`},allowInterfaceEnd:{type:`boolean`},allowTypeStart:{type:`boolean`},allowTypeEnd:{type:`boolean`},allowEnumStart:{type:`boolean`},allowEnumEnd:{type:`boolean`},allowModuleStart:{type:`boolean`},allowModuleEnd:{type:`boolean`},allowFunctionStart:{type:`boolean`},allowFunctionEnd:{type:`boolean`},ignorePattern:{type:`string`},applyDefaultIgnorePatterns:{type:`boolean`}},additionalProperties:!1}]},createOnce(e){let t=[],n=[];return{Program(){let r=O(e.options?.[0]);t=e.sourceCode.text.split(`
4
+ `),n=[];let i=e.sourceCode.getAllComments();for(let a=0;a<i.length;a++){let o=i[a];if(!o)continue;let s=i[a+1],c=s!==void 0&&s.loc.start.line<=o.loc.end.line+1;F(o,t,r,e,n,!1,c),n.push(o)}}}}}),I=[`eslint`,`oxlint`,`jshint`,`jslint`,`tslint`,`istanbul`,`global`,`exported`,`jscs`],L=[`<reference`,`<amd-module`,`<amd-dependency`,`@ts-`],R=/^\*?\s*$/u,z=/^\s*$/u,B=`禁止双斜杠注释,只允许多行块注释`;function V(e){let t=e.value.trim(),n=t.replace(/^\/+/u,``).trim();return I.some(e=>t.startsWith(e))||L.some(e=>n.startsWith(e))}function H(t){return t.type===`Line`&&e(t.value)!==null}function U(e,t){let n=t[e.loc.start.line-1];if(!n)return` `.repeat(e.loc.start.column);let r=n.slice(0,e.loc.start.column);return r.trim().length>0?` `.repeat(e.loc.start.column):r}function W(e){let t=[];for(let n of e){let e=t[t.length-1];if(e){let t=e[e.length-1];if(t&&t.loc.end.line===n.loc.start.line-1){e.push(n);continue}}t.push([n])}return t}function G(e){return e.map(e=>e.value)}function K(e,t){return`/*\n${e.map(e=>{let n=e.trim();return n?`${t} * ${n}`:`${t} *`}).join(`
5
+ `)}\n${t} */`}function q(e,t){let n=e.trim();return n?`/*\n${t} * ${n}\n${t} */`:`/*\n${t} */`}function J(e,t){let n=e.value.split(`
6
+ `),r=0;for(let e=0;e<t;e++)r+=(n[e]?.length??0)+1;return e.range[0]+2+r}function Y(e,t){let n=[],r=[];for(let i of e)b(i,t)?n.push({message:B,loc:{start:{...i.loc.start},end:{...i.loc.end}}}):r.push(i);for(let e of W(r)){let r=e[0],i=e[e.length-1];if(!r||!i)continue;let a=U(r,t),o=G(e),s=o.some(e=>e.trim().startsWith(`/`));n.push({message:B,loc:{start:{...r.loc.start},end:{...i.loc.end}},fix:s?void 0:{range:[r.range[0],i.range[1]],text:K(o,a)}})}return n}function ae(e,t){let n=[],r=e.value.split(`
7
+ `),i=U(e,t);if(e.loc.start.line===e.loc.end.line)return n.push({message:`禁止单行块注释,注释须为多行星号块形态`,loc:{start:{...e.loc.start},end:{...e.loc.end}},fix:{range:[e.range[0],e.range[1]],text:q(e.value,i)}}),n;let a=r[0]??``;if(!R.test(a)){let t=+!!a.startsWith(`*`);n.push({message:`多行块注释的首行应在 "/*" 后换行`,loc:{start:{...e.loc.start},end:{...e.loc.end}},fix:{range:[e.range[0]+2,e.range[0]+2+t],text:`\n${i} *`}})}for(let t=1;t<r.length-1;t++){let a=r[t]??``,o=a.trim();if(!o||o.startsWith(`*`))continue;let s=J(e,t),c=a.length-a.trimStart().length;n.push({message:`多行注释的中间行应以 "*" 开头`,loc:{start:{line:e.loc.start.line+t,column:0},end:{line:e.loc.start.line+t,column:a.length}},fix:{range:[s,s+c],text:`${i} * `}})}let o=r[r.length-1]??``;return z.test(o)||n.push({message:`多行块注释的末行应在 "*/" 前换行`,loc:{start:{...e.loc.start},end:{...e.loc.end}},fix:{range:[e.range[1]-2,e.range[1]-2],text:`\n${i} `}}),n}function oe(e,t){let n=[],r=[];for(let i of e)i.type!==`Shebang`&&(V(i)||H(i)||(i.type===`Line`?r.push(i):n.push(...ae(i,t))));return n.push(...Y(r,t)),n}const se=t({meta:{type:`layout`,fixable:`code`,docs:{description:`强制多行注释使用星号块样式`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments(),r=e.sourceCode.text,i=oe(n,r==null?[]:r.split(`
8
+ `));for(let t of i){let{fix:n}=t;e.report({loc:t.loc,message:t.message,fix:n?e=>e.replaceTextRange(n.range,n.text):void 0})}}}}});function X(e){return e.type===`ExportNamedDeclaration`||e.type===`ExportDefaultDeclaration`||e.type===`ExportAllDeclaration`}function ce(e,t,n){if(n-t<=1)return!1;for(let r=t+1;r<n;r++)if(e[r-1]?.trim()===``)return!0;return!1}function Z(e){return e.type===`Program`}function le(e,t,n){for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];if(i!==void 0&&a!==void 0&&X(i)&&X(a)){let e=i.loc.end.line,r=a.loc.start.line;ce(t,e,r)||n.report({loc:a.loc.start,message:`export 语句之间需要空行`})}}}const Q={"multiline-comment-style":se,"lines-around-comment":ie,"padding-line-between-statements":t({meta:{type:`layout`,docs:{description:`要求在 export 语句之间有空行`}},createOnce(e){return{Program(t){let n=e.sourceCode.text.split(`
9
+ `),r=Z(t)?t:null;r&&le(r.body,n,e)}}}})},$=n({meta:{name:`@longzai-intelligence-oxlint/stylistic-plugin`},rules:Q});export{$ as default,$ as stylisticPlugin,Q as stylisticRules};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";import{existsSync as n,readFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";const o=[`app.json`,`node.json`,`test.json`],s=[`./tsconfig/app.json`,`./tsconfig/node.json`,`./tsconfig/test.json`];function c(e){let t=e.replace(/\\/g,`/`);return(t.split(`/`).pop()??``)===`tsconfig.json`&&!t.includes(`/tsconfig/`)}function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e,t){return n(e)?!0:(t(`缺少 tsconfig/ 目录。请创建 tsconfig/ 目录并配置子配置文件。`),!1)}function d(e,t){for(let r of o)n(a(e,r))||t(`缺少必需的 tsconfig 子配置文件 tsconfig/${r}。`)}function f(e,t){(!(`files`in e)||!Array.isArray(e.files)||e.files.length>0)&&t(`tsconfig.json 的 files 字段应为空数组 []。根配置仅用于引用子配置。`)}function p(e){return l(e)&&`path`in e}function m(e,t){if(!(`references`in e)||!Array.isArray(e.references)){t(`tsconfig.json 必须包含 references 字段。请配置项目引用。`);return}let n=new Set(e.references.map(e=>p(e)?String(e.path):``));for(let e of s)n.has(e)||t(`tsconfig.json 缺少必需的引用 "${e}"。`)}function h(e,t){let n=JSON.parse(e);l(n)?(f(n,t),m(n,t)):t(`tsconfig.json 内容不是有效的对象。`)}function g(e,t){try{let n=r(e,`utf-8`),o=a(i(e),`tsconfig`);if(!u(o,t))return;d(o,t),h(n,t)}catch{}}const _=e({meta:{type:`problem`,docs:{description:`检查 tsconfig.json 是否正确使用 references 配置`}},createOnce(e){return{before(){if(!c(e.filename))return!1},Program(t){g(e.filename,n=>{e.report({node:t,message:n})})}}}}),v=t({meta:{name:`@longzai-intelligence-oxlint/tsconfig-plugin`},rules:{"tsconfig-references":_}});export{v as default,v as tsconfigPlugin,_ as tsconfigReferencesRule};
@@ -0,0 +1,13 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";import*as n from"zod/mini";const r=[/^\s*(const|let|var)\s+\w+\s*=/,/^\s*function\s+\w+\s*\(/,/^\s*class\s+\w+/,/^\s*interface\s+\w+/,/^\s*type\s+\w+\s*=/,/^\s*enum\s+\w+/,/^\s*import\s+.*from\s+['"]/,/^\s*export\s+(default\s+)?(function|class|const|let|var|interface|type|enum)/,/^\s*return\s+/,/^\s*if\s*\(/,/^\s*for\s*\(/,/^\s*while\s*\(/,/^\s*switch\s*\(/,/^\s*try\s*\{/,/^\s*catch\s*\(/,/^\s*throw\s+/,/^\s*console\.(log|error|warn|info|debug)\s*\(/,/^\s*\w+\s*\(\s*\)\s*;?\s*$/];function i(e){let t=e.trim();if(t.length===0)return!1;for(let e of r)if(e.test(t))return!0;return!1}function a(e){let t=e.split(`
2
+ `),n=0,r=0;for(let e of t){let t=e.trim();t.length!==0&&t!==`*`&&(r++,i(t.replace(/^\*\s*/,``))&&n++)}return r>0&&n/r>=.5}function o(e){return i(e.trim())}const s=e({meta:{type:`suggestion`,docs:{description:`禁止注释掉的代码`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n)r.type===`Block`?!r.value.startsWith(`*`)&&a(r.value)&&e.report({node:t,message:`检测到注释掉的代码,请删除或恢复该代码`}):r.type===`Line`&&o(r.value)&&e.report({node:t,message:`检测到注释掉的代码,请删除或恢复该代码`})}}}}),c=/* @__PURE__ */ new Map,l=1e3;function u(e){let t=e.match(/^\{([^}]*)\}\s*(\S+)?\s*(.*)/);if(t)return{type:t[1]??``,name:t[2]||``,description:t[3]||``};let n=e.match(/^(\S+)\s*(.*)/);return n?{name:n[1]??``,description:n[2]||``,type:``}:{name:``,description:``,type:``}}function ee(e){let t=e.match(/^\{([^}]*)\}\s*(.*)/);return t?{type:t[1]??``,description:t[2]||``}:{description:e,type:``}}function te(e){let t=e.match(/^\{@link\s+([^}]+)\}\s*(.*)/);return t?{type:(t[1]??``).trim(),description:t[2]||``}:{description:e,type:``}}function ne(e,t){if(e===`param`||e===`typeParam`||e===`template`){let n=u(t);return{tag:e,name:n.name,description:n.description,type:n.type}}if(e===`returns`||e===`return`){let n=ee(t);return{tag:e,name:``,description:n.description,type:n.type}}if(e===`throws`||e===`throw`){let n=te(t);return{tag:e,name:``,description:n.description,type:n.type}}return{tag:e,name:``,description:t,type:``}}function re(){if(c.size<=l)return;let e=Array.from(c.entries()).sort((e,t)=>e[1].lastAccess-t[1].lastAccess),t=e.slice(0,e.length-l);for(let[e]of t)c.delete(e)}function d(e){let t=c.get(e);if(t)return t.lastAccess=Date.now(),t.result;let n=ie(e);return c.set(e,{result:n,lastAccess:Date.now()}),re(),n}function f(e){return/^`{3,}/.test(e)}function ie(e){let t=e.trim();if(!t.startsWith(`*`))return null;let n=t.split(`
3
+ `),r=[],i=[],a=null,o=!0,s=!1;for(let e=0;e<n.length;e++){let t=n[e];if(t){if(t=t.trim(),t.startsWith(`*`)&&(t=t.slice(1).trim()),f(t)&&(s=!s),s||f(t))o?(t||r.length>0)&&r.push(t):a&&(a.description+=(a.description?`
4
+ `:``)+t);else if(t.startsWith(`@`)){o=!1,a&&i.push(a);let e=t.match(/^@(\w+)\s*(.*)/);if(e){let t=e[1];if(!t)continue;a=ne(t,e[2]??``)}}else o?(t||r.length>0)&&r.push(t):a&&(a.description+=(a.description?`
5
+ `:``)+t)}}return a&&i.push(a),{description:r.join(`
6
+ `).trim(),tags:i}}function p(e){return e.tags.filter(e=>e.tag===`param`)}function m(e){return e.tags.find(e=>e.tag===`returns`||e.tag===`return`)}function h(e){return e.description.trim().length>0}function g(e){let t=e.description.trim();return t.length!==0&&t!==`-`&&t!==`--`}function _(e){return p(e).map(e=>e.name.split(`.`)[0]).filter(e=>typeof e==`string`)}const ae=e({meta:{type:`suggestion`,docs:{description:`禁止使用 description 标签`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);i&&i.tags.some(e=>e.tag===`description`)&&e.report({node:t,message:`请勿使用 description 标签,直接书写描述文本即可`})}}}}});n.object({type:n.string(),range:n.tuple([n.number(),n.number()])});const oe=n.object({init:n.unknown()}),se=n.object({type:n.string()});n.object({name:n.unknown()}),n.object({left:n.unknown(),right:n.unknown()}),n.object({id:n.object({name:n.string()})}),n.object({key:n.object({name:n.string()})}),n.object({declarations:n.array(n.object({id:n.optional(n.object({name:n.optional(n.string())}))}))}),n.object({type:n.literal(`ThrowStatement`),argument:n.unknown()}),n.object({type:n.literal(`NewExpression`),callee:n.unknown()}),n.object({type:n.literal(`Identifier`),name:n.unknown()}),n.object({consequent:n.array(n.unknown())}),n.object({consequent:n.unknown(),alternate:n.unknown()}),n.object({block:n.unknown(),handler:n.unknown()}),n.object({cases:n.unknown()}),n.object({body:n.array(n.unknown())});const ce=n.record(n.string(),n.unknown()),le=n.object({type:n.enum([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`])});n.object({type:n.string(),params:n.array(n.unknown())});const ue=n.object({range:n.tuple([n.number(),n.number()])}),de=n.object({range:n.tuple([n.number(),n.number()])}),fe=n.object({range:n.tuple([n.number(),n.number()])}),pe=n.object({id:n.object({name:n.string()})}),me=n.object({key:n.object({name:n.string()})}),he=n.object({declarations:n.array(n.unknown())}),ge=n.object({typeParameters:n.object({params:n.array(n.record(n.string(),n.unknown()))})}),_e=n.object({params:n.array(n.unknown())}),ve=n.object({value:n.unknown()}),ye=n.object({declarations:n.array(n.unknown())});function v(e){return ue.safeParse(e).success}function be(e){return de.safeParse(e).success}function y(e){return fe.safeParse(e).success}function xe(e){if(!v(e))return-1;if(`decorators`in e&&Array.isArray(e.decorators)&&e.decorators.length>0){let t=e.decorators[0];if(y(t))return t.range[0]}if(`parent`in e&&e.parent&&typeof e.parent==`object`){let t=e.parent;if(v(t)&&`type`in t&&typeof t.type==`string`){if(t.type===`MethodDefinition`){if(`decorators`in t&&Array.isArray(t.decorators)&&t.decorators.length>0){let e=t.decorators[0];if(y(e))return e.range[0]}return t.range[0]}if(t.type===`Property`)return t.range[0];if(t.type===`VariableDeclarator`){let e=`parent`in t?t.parent:void 0;if(v(e)&&`type`in e&&typeof e.type==`string`&&e.type===`VariableDeclaration`){if(`parent`in e&&e.parent){let t=e.parent;if(v(t)&&`type`in t&&typeof t.type==`string`&&[`ExportNamedDeclaration`,`ExportDefaultDeclaration`].includes(t.type))return t.range[0]}return e.range[0]}}if([`ExportNamedDeclaration`,`ExportDefaultDeclaration`].includes(t.type))return t.range[0]}}return e.range[0]}function Se(e,t,n,r){let i=e.range[1],a=xe(t);if(a<0)return!1;let o=n.filter(e=>e.range[0]>=i&&e.range[1]<=a),s=[];if(v(t)&&`decorators`in t){let e=t.decorators;if(Array.isArray(e))for(let t of e)y(t)&&s.push(t.range)}let c=[...o.map(e=>e.range),...s].sort((e,t)=>e[0]-t[0]),l=[],u=i;for(let e of c)e[0]>u&&l.push(r.slice(u,e[0])),u=Math.max(u,e[1]);u<a&&l.push(r.slice(u,a));for(let e of l)if(e.trim().length>0)return!1;return!0}function b(e,t,n){if(!be(t))return null;let r=xe(t),i=r>=0?r:t.range[0],a=null;for(let t of e)t.type===`Block`&&t.value.startsWith(`*`)&&t.range[1]<=i&&(a===null||t.range[1]>a.range[1])&&(a={value:t.value,range:t.range});return a&&n&&!Se(a,t,e,n)?null:a}const x={description:`[待填写描述]`,functionDescription:`[待填写函数描述]`,methodDescription:`[待填写方法描述]`,classDescription:`[待填写类描述]`,variableDescription:`[待填写变量描述]`,paramDescription:`[待填写参数描述]`,returnsDescription:`[待填写返回值描述]`,typeParamDescription:`[待填写类型参数描述]`},Ce=[/^\s*\*\s*描述\s*$/m,/^\s*\*\s*函数描述\s*$/m,/^\s*\*\s*方法描述\s*$/m,/^\s*\*\s*类描述\s*$/m,/^\s*\*\s*变量描述\s*$/m,/@param\s+\w+\s*-\s*参数描述/,/@returns\s+返回值描述/,/@typeParam\s+\w+\s*-\s*类型参数描述/];function we(e){return Object.values(x).some(t=>e.includes(t))?!0:Ce.some(t=>t.test(e))}function S(e,t){let n=t[0];for(;n>0&&e[n-1]!==`
7
+ `;)n--;return e.slice(n,t[0])}function C(e,t,n,r){let i=t.range[1]-2,a=t.range[0]+2+t.value.replace(/\s+$/,``).length,o=`${n}\n${r} `;return e.replaceTextRange([a,i],o)}function w(e,t,n,r,i){let a=t.range[0]+2,o=t.range[1]-2,s=n[0].replace(/\s+$/,``).length,c=a+(n.index??0)+s,l=`${r}\n${i} `;return e.replaceTextRange([c,o],l)}function Te(e,t,n,r){let i=`\n${r} * @param ${n} - ${x.paramDescription}`,a=t.value.match(/@param[^@]*$/);return a&&a.index!==void 0?w(e,t,a,i,r):C(e,t,i,r)}function Ee(e,t,n){let r=`\n${n} * @returns ${x.returnsDescription}`,i=t.value.match(/@\w+[^@]*$/);return i&&i.index!==void 0?w(e,t,i,r,n):C(e,t,r,n)}function De(e,t,n,r){let i=`\n${r} * @typeParam ${n} - ${x.typeParamDescription}`,a=t.value,o=a.match(/@typeParam[^@]*$/);if(o&&o.index!==void 0)return w(e,t,o,i,r);let s=a.match(/@param[^@]*$/);return s&&s.index!==void 0?w(e,t,s,i,r):C(e,t,i,r)}function Oe(e,t,n){let r=t.value;return r.trim()===`*`?e.replaceTextRange(t.range,`/**\n${n} * ${x.description}\n${n} */`):e.replaceTextRange(t.range,`/*${r}*/`)}function T(e,t,n){return e.slice(t).includes(`
8
+ `)?``:`\n${n} `}function ke(e,t,n,r){let i=t.value,a=RegExp(`@param\\s+${E(n)}\\s*$`,`m`),o=a.exec(i);if(o){let s=T(i,o.index+o[0].length,r),c=i.replace(a,`@param ${n} - ${x.paramDescription}${s}`);return e.replaceTextRange(t.range,`/*${c}*/`)}return e.replaceTextRange(t.range,`/*${i}*/`)}function Ae(e,t,n){let r=t.value,i=/@returns\s*$/m,a=i.exec(r);if(a){let o=T(r,a.index+a[0].length,n),s=r.replace(i,`@returns ${x.returnsDescription}${o}`);return e.replaceTextRange(t.range,`/*${s}*/`)}return e.replaceTextRange(t.range,`/*${r}*/`)}function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const D=n.object({type:n.optional(n.string()),name:n.optional(n.string()),left:n.optional(n.object({name:n.optional(n.string())}))}),je=n.object({type:n.string(),name:n.optional(n.string()),left:n.optional(D),argument:n.optional(D),parameter:n.optional(D)});function Me(e){return _e.safeParse(e).success}function O(e){return Me(e)?e.params.map(e=>{let t=je.safeParse(e);if(!t.success)return``;let n=t.data;switch(n.type){case`Identifier`:return n.name??``;case`AssignmentPattern`:return n.left?.name??``;case`RestElement`:return n.argument?.name??``;case`ObjectPattern`:return Ne(n)??`options`;case`ArrayPattern`:return`args`;case`TSParameterProperty`:return n.parameter?.name??n.parameter?.left?.name??``;default:return``}}).filter(e=>!!e):[]}function Ne(e){return null}const Pe=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`禁止多余的 @param 标签`}},createOnce(e){let t=[];function n(n){let r=b(t,n,e.sourceCode.text);if(!r)return;let i=d(r.value);if(!i)return;let a=O(n),o=_(i).filter(e=>!a.includes(e));for(let t of o)e.report({node:n,message:`@param "${t}" 在函数签名中不存在`,fix:e=>{let n=r.value,i=RegExp(`\\n\\s*\\*\\s*@param\\s+${E(t)}\\b[^\\n]*`),a=n.replace(i,``);return e.replaceTextRange(r.range,`/*${a}*/`)}})}return{Program(){t=e.sourceCode.getAllComments()},FunctionDeclaration(e){n(e)},FunctionExpression(e){n(e)},ArrowFunctionExpression(e){if(`parent`in e&&e.parent){let t=e.parent.type;if(t===`CallExpression`||t===`Property`)return}n(e)}}}}),Fe=[`file`,`module`,`author`,`since`];function Ie(e){return Fe.includes(e)}function Le(e,t,n,r){let i=e.split(`
9
+ `),a=-1;for(let e=0;e<i.length;e++){let n=i[e];if(n&&n.trim().startsWith(`* @${t}`)){a=e;break}}if(a===-1)return n.replaceTextRange(r,`/*${e}*/`);let o=i.filter((e,t)=>t!==a).join(`
10
+ `);return n.replaceTextRange(r,`/*${o}*/`)}const Re=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`禁止使用旧版 JSDoc 标签`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);if(i)for(let a of i.tags)Ie(a.tag)&&e.report({node:t,message:`禁止使用旧版 JSDoc 标签 @${a.tag},该标签在 TSDoc 中已不推荐使用`,fix:e=>Le(n,a.tag,e,r.range)})}}}}}),ze=[...Object.values(x),`参数描述`,`返回值描述`,`函数描述`,`方法描述`,`类描述`,`变量描述`,`类型参数描述`,`描述`];function k(e){let t=e.trim();t.startsWith(`-`)&&(t=t.slice(1).trim());for(let e of ze)if(t===e)return e;return null}function Be(e){let t=k(e);return t?`禁止使用占位描述 "${t}",请提供有意义的描述`:null}function Ve(e){let t=[],n=p(e);for(let e of n){let n=k(e.description);n&&t.push(`@param 标签禁止使用占位描述 "${n}",请提供有意义的描述`)}let r=m(e);if(r){let e=k(r.description);e&&t.push(`@returns 标签禁止使用占位描述 "${e}",请提供有意义的描述`)}let i=e.tags.filter(e=>e.tag===`typeParam`||e.tag===`template`);for(let e of i){let n=k(e.description);n&&t.push(`@typeParam 标签禁止使用占位描述 "${n}",请提供有意义的描述`)}return t}const He=e({meta:{type:`suggestion`,docs:{description:`禁止使用占位描述文本`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);if(!i)continue;let a=Be(i.description);a&&e.report({node:t,message:a});let o=Ve(i);for(let n of o)e.report({node:t,message:n})}}}}});function Ue(e){return e?e.trim().startsWith(`-`):!1}const We=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:"要求参数描述使用 `-` 分隔"}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);if(!i)continue;let a=p(i);for(let i of a)Ue(i.description)||e.report({node:t,message:`参数 "${i.name}" 的描述应该使用 \`-\` 分隔,格式:@param ${i.name} - 描述`,fix:e=>{let t=RegExp(`(@param\\s+${E(i.name)}\\s+)([^\\-\\s].*?)(\\n|$)`,`g`),a=n.replace(t,`$1- $2$3`);return e.replaceTextRange(r.range,`/*${a}*/`)}})}}}}});function Ge(e){let t=e.split(`
11
+ `),n=-1,r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(!i)continue;let a=i.trim();if(f(a.startsWith(`*`)?a.slice(1).trim():a))r=!r;else if(!r&&a.startsWith(`*`)&&a.slice(1).trim().startsWith(`@`)){n=e;break}}if(n===-1||n===0)return!0;let i=t[n-1];if(!i)return!0;let a=i.trim();return a===`*`||a===``}const Ke=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求标签前有空行`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);i&&i.tags.length>0&&h(i)&&(Ge(n)||e.report({node:t,message:`标签前应有一个空行`,fix:e=>{let t=n.replace(/([ \t]*)(\* [^\n@]+)\n([ \t]*)(\* @)/g,(e,t,n,r,i)=>`${t}${n}\n${t||r}*\n${r}${i}`);return e.replaceTextRange(r.range,`/*${t}*/`)}}))}}}}}),qe=[/使用\s+\S+\s+代替/,/请使用\s+\S+/,/use\s+\S+\s+instead/i,/replaced\s+by\s+\S+/i];function Je(e){if(!e)return!1;let t=e.trim();if(t.length===0)return!1;for(let e of qe)if(e.test(t))return!0;return t.length>10}const Ye=e({meta:{type:`suggestion`,docs:{description:`要求 @deprecated 标签有替代方案说明`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);if(!i)continue;let a=i.tags.find(e=>e.tag===`deprecated`);a&&(Je(a.description)||e.report({node:t,message:`@deprecated 标签应该包含替代方案说明,例如:@deprecated 使用 newMethod 代替`}))}}}}}),Xe=[`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ClassDeclaration`,`VariableDeclaration`,`MethodDefinition`,`TSInterfaceDeclaration`,`TSTypeAliasDeclaration`,`TSEnumDeclaration`,`PropertyDefinition`,`TSPropertySignature`,`TSEnumMember`],Ze=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求 TSDoc 注释有描述文本`}},createOnce(e){let t=[];function n(n){let r=b(t,n,e.sourceCode.text);if(!r)return;let i=d(r.value);i&&(h(i)||e.report({node:n,message:`TSDoc 注释缺少描述`,fix:t=>{let n=S(e.sourceCode.text,r.range);return Oe(t,r,n)}}))}let r={Program(){t=e.sourceCode.getAllComments()}};for(let e of Xe)r[e]=e=>n(e);return r}});function A(e){return pe.safeParse(e).success}function j(e){return me.safeParse(e).success}function M(e){return he.safeParse(e).success}function Qe(e){if(!Array.isArray(e)||e.length===0)return null;let t=e[0];if(!t||typeof t!=`object`)return null;let n=t;if(`type`in n&&n.type===`Property`&&`key`in n){let e=n.key;if(e&&typeof e==`object`&&`name`in e&&typeof e.name==`string`)return e.name}if(`type`in n&&n.type===`RestElement`&&`argument`in n){let e=n.argument;if(e&&typeof e==`object`&&`name`in e&&typeof e.name==`string`)return e.name}return null}function $e(e){if(!Array.isArray(e)||e.length===0)return null;let t=e[0];return t&&typeof t==`object`&&`name`in t&&typeof t.name==`string`?t.name:null}function et(e){if(!e||typeof e!=`object`)return null;let t=e;return`type`in t&&t.type===`ObjectPattern`&&`properties`in t?Qe(t.properties):`type`in t&&t.type===`ArrayPattern`&&`elements`in t?$e(t.elements):null}function tt(e){if(!M(e)||e.declarations.length===0)return null;let t=e.declarations[0];if(!t||typeof t!=`object`||!t||!(`id`in t)||!t.id)return null;let n=t.id;if(typeof n==`object`&&`type`in n){let e=n;if(e.type===`Identifier`&&`name`in e)return typeof e.name==`string`?e.name:null;if(e.type===`ObjectPattern`||e.type===`ArrayPattern`)return et(n)}return A(t)?t.id?.name??null:null}function N(e){if(!e||typeof e!=`object`||!(`type`in e))return null;let t=e.type;if(typeof t!=`string`)return null;switch(t){case`FunctionDeclaration`:case`ClassDeclaration`:case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:case`TSEnumDeclaration`:case`TSEnumMember`:return A(e)?e.id?.name??null:null;case`MethodDefinition`:case`PropertyDefinition`:case`TSPropertySignature`:return j(e)?e.key?.name??null:null;case`VariableDeclaration`:return tt(e);default:return null}}const nt={FunctionDeclaration:`函数`,MethodDefinition:`方法`,ClassDeclaration:`类`,VariableDeclaration:`变量`,TSInterfaceDeclaration:`接口`,TSTypeAliasDeclaration:`类型别名`,TSEnumDeclaration:`枚举`,PropertyDefinition:`类属性`,TSPropertySignature:`接口属性`,TSEnumMember:`枚举成员`};function P(e){return nt[e]||e}function F(e){return ge.safeParse(e).success}function rt(e){return F(e)?e.typeParameters.params.map(e=>e.name&&typeof e.name==`object`&&`name`in e.name?String(e.name.name):``).filter(Boolean):[]}function it(e){return!e.trim().includes(`
12
+ `)}function at(e){return j(e)?e.key.name:A(e)?e.id.name:`(匿名)`}const ot=e({meta:{type:`suggestion`,docs:{description:`要求接口属性、类属性、枚举成员使用多行 TSDoc 注释格式`}},createOnce(e){return{TSPropertySignature(t){I(t,e)},PropertyDefinition(t){I(t,e)},TSEnumMember(t){I(t,e)}}}});function I(e,t){let n=b(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!n)return;let r=n.value;if(it(r)){let n=at(e);t.report({node:e,message:`"${n}"的注释应使用多行 TSDoc 格式,当前为单行格式`})}}const st=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求 @param 标签有描述`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);if(!i)continue;let a=p(i);for(let n of a)g(n)||e.report({node:t,message:`参数 "${n.name}" 缺少描述`,fix:t=>ke(t,r,n.name,S(e.sourceCode.text,r.range))})}}}}}),ct=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求函数参数有 @param 标签`}},createOnce(e){let t=[];function n(n){let r=b(t,n,e.sourceCode.text);if(!r)return;let i=O(n);if(i.length===0)return;let a=d(r.value);if(!a)return;let o=_(a),s=i.filter(e=>!o.includes(e));for(let t of s)e.report({node:n,message:`参数 "${t}" 缺少 @param 标签`,fix:n=>{let i=S(e.sourceCode.text,r.range);return Te(n,r,t,i)}})}return{Program(){t=e.sourceCode.getAllComments()},FunctionDeclaration(e){n(e)},FunctionExpression(e){n(e)},ArrowFunctionExpression(e){if(`parent`in e&&e.parent){let t=e.parent.type;if(t===`CallExpression`||t===`Property`)return}n(e)}}}}),lt=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求 @returns 标签有描述`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Block`)continue;let n=r.value;if(!n.startsWith(`*`))continue;let i=d(n);if(!i)continue;let a=m(i);a&&!g(a)&&e.report({node:t,message:`@returns 标签缺少描述`,fix:t=>Ae(t,r,S(e.sourceCode.text,r.range))})}}}}});function L(e){return typeof e!=`object`||!e||!(`type`in e)?!1:typeof e.type==`string`}function ut(e){return L(e)&&e.type===`ReturnStatement`&&`argument`in e}function dt(e){return typeof e==`object`&&!!e&&`body`in e}function ft(e){return typeof e==`object`&&!!e&&`returnType`in e}function pt(e){return L(e)?[`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`].includes(e.type):!1}function R(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(t.has(n))return!1;if(t.add(n),ut(n))return!0;if(pt(n))return!1;for(let e of Object.keys(n)){let r=Object.getOwnPropertyDescriptor(n,e);if(!r||!(`value`in r))continue;let i=r.value;if(i&&typeof i==`object`){if(Array.isArray(i)){for(let e of i)if(R(e,t))return!0}else if(`type`in i&&R(i,t))return!0}}return!1}function z(e){if(typeof e!=`object`||!e||!dt(e)||!e.body)return!1;let t=e.body;return typeof t!=`object`||!t?!1:!(`type`in t)||t.type!==`BlockStatement`||R(t,/* @__PURE__ */ new WeakSet)}function B(e){if(typeof e!=`object`||!e||!ft(e)||!e.returnType)return!1;let t=e.returnType;if(!t||typeof t!=`object`||!(`typeAnnotation`in t)||!t.typeAnnotation)return!1;let n=t.typeAnnotation;if(typeof n!=`object`||!(`type`in n))return!1;if(n.type===`TSVoidKeyword`)return!0;if(n.type===`TSTypeReference`){let e=`typeName`in n?n.typeName:null;if(e&&typeof e==`object`&&`name`in e&&e.name===`Promise`){let e=`typeArguments`in n?n.typeArguments:null;if(e&&typeof e==`object`&&`params`in e&&Array.isArray(e.params)&&e.params.length>0){let t=e.params[0];if(L(t))return t.type===`TSVoidKeyword`}}}return!1}function mt(e){return z(e)?!B(e):!1}const ht=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求有返回值的函数有 @returns 标签`}},createOnce(e){return{FunctionDeclaration(t){V(t,e)},FunctionExpression(t){V(t,e)},ArrowFunctionExpression(t){if(`parent`in t&&t.parent){let e=t.parent.type;if(e===`CallExpression`||e===`Property`)return}V(t,e)}}}});function V(e,t){if(!mt(e))return;let n=b(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!n)return;let r=d(n.value);r&&(m(r)||t.report({node:e,message:`缺少 @returns 文档`,fix:e=>{let r=S(t.sourceCode.text,n.range);return Ee(e,n,r)}}))}function gt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&`range`in t&&Array.isArray(t.range)}const _t=e({meta:{type:`suggestion`,docs:{description:`要求 @throws 标签有异常类型`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let t of n){if(t.type!==`Block`)continue;let n=t.value;if(!n.startsWith(`*`))continue;let r=d(n);if(!r)continue;let i=r.tags.filter(e=>e.tag===`throws`||e.tag===`throw`);for(let n of i)!n.type&&gt(t)&&e.report({node:t,message:`@throws 标签应使用 {@link Type} 格式声明异常类型,例如:@throws {@link Error} 描述`})}}}}});function H(e){if(typeof e!=`object`||!e)return!1;let t=e;return`body`in t&&Array.isArray(t.body)}function vt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&t.type===`ThrowStatement`&&`argument`in t}function yt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&t.type===`NewExpression`&&`callee`in t}function U(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&t.type===`Identifier`&&`name`in t}function bt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`consequent`in t&&`alternate`in t}function xt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`block`in t&&`handler`in t}function St(e){return typeof e!=`object`||!e?!1:`cases`in e}function Ct(e){if(typeof e!=`object`||!e||!(`consequent`in e))return!1;let t=e;return Array.isArray(t.consequent)}function wt(e){let t=e.argument;if(yt(t)){let e=t.callee;if(U(e))return e.name}return U(t)?t.name:`Error`}function W(e,t){if(!H(e))return;let n=e;if(Array.isArray(n.body))for(let e of n.body)G(e,t)}function G(e,t){if(!e||typeof e!=`object`)return;let n=e;if(`type`in n&&n.type===`ThrowStatement`&&vt(n)){let e=wt(n);t.push({typeName:e})}else`type`in n&&n.type===`IfStatement`&&bt(n)?(G(n.consequent,t),n.alternate&&G(n.alternate,t)):`type`in n&&n.type===`TryStatement`&&xt(n)?Tt(n,t):`type`in n&&n.type===`SwitchStatement`&&St(n)?Et(n,t):`type`in n&&n.type===`BlockStatement`&&H(n)&&W(n,t)}function Tt(e,t){H(e.block)&&W(e.block,t),e.handler&&typeof e.handler==`object`&&`body`in e.handler&&e.handler.body&&H(e.handler.body)&&W(e.handler.body,t)}function Et(e,t){for(let n of e.cases)if(Ct(n))for(let e of n.consequent)G(e,t)}function Dt(e){if(!e||typeof e!=`object`||!(`body`in e)||!e.body)return[];let t=e.body;if(typeof t!=`object`||!t||!(`type`in t)||t.type!==`BlockStatement`)return[];let n=[];return W(t,n),n}const Ot=e({meta:{type:`suggestion`,docs:{description:`要求抛出异常的函数有 @throws 标签`}},createOnce(e){return{FunctionDeclaration(t){K(t,e)},FunctionExpression(t){K(t,e)},ArrowFunctionExpression(t){if(`parent`in t&&t.parent){let e=t.parent.type;if(e===`CallExpression`||e===`Property`)return}K(t,e)}}}});function K(e,t){let n=Dt(e);if(n.length===0)return;let r=b(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!r){q(e,t,n);return}let i=d(r.value);i?i.tags.filter(e=>e.tag===`throws`||e.tag===`throw`).length===0&&q(e,t,n):q(e,t,n)}function q(e,t,n){let r=[...new Set(n.map(e=>e.typeName))],i=r[0]||`Error`;t.report({node:e,message:`函数抛出异常但没有 @throws 标签。抛出的异常类型: ${r.join(`, `)}。正确用法: @throws {@link ${i}} 异常描述`})}function kt(e){return le.safeParse(e).success}function At(e){return ce.safeParse(e).success}function jt(e){return oe.safeParse(e).success}function Mt(e){return se.safeParse(e).success}function Nt(e){return ve.safeParse(e).success}function Pt(e){return ye.safeParse(e).success}function Ft(e,t){return e.type===`FunctionDeclaration`||e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`?It(e,t):e.type===`MethodDefinition`&&Nt(e)&&e.value?Lt(e.value,t):e.type===`ClassDeclaration`?Rt(t):e.type===`VariableDeclaration`&&Pt(e)?zt(e.declarations,t):J(t)}function It(e,t){let n=O(e),r=z(e),i=B(e),a=[];a.push(`/**`),a.push(` * ${x.functionDescription}`);for(let e of n)a.push(` * @param ${e} - ${x.paramDescription}`);return r&&!i&&a.push(` * @returns ${x.returnsDescription}`),a.push(` */`),`\n${t}`+a.join(`\n${t}`)+`\n${t}`}function Lt(e,t){if(!e||typeof e!=`object`||!kt(e))return J(t);let n=e,r=O(n),i=z(n),a=B(n),o=[];o.push(`/**`),o.push(` * ${x.methodDescription}`);for(let e of r)o.push(` * @param ${e} - ${x.paramDescription}`);return i&&!a&&o.push(` * @returns ${x.returnsDescription}`),o.push(` */`),`\n${t}`+o.join(`\n${t}`)+`\n${t}`}function Rt(e){let t=[];return t.push(`/**`),t.push(` * ${x.classDescription}`),t.push(` */`),`\n${e}`+t.join(`\n${e}`)+`\n${e}`}function zt(e,t){let n=e[0];if(!n||!At(n))return J(t);let r=jt(n)?n.init:void 0;if(r&&typeof r==`object`&&Mt(r)){let e=r.type;if(e===`ArrowFunctionExpression`||e===`FunctionExpression`)return J(t)}let i=[];return i.push(`/**`),i.push(` * ${x.variableDescription}`),i.push(` */`),`\n${t}`+i.join(`\n${t}`)+`\n${t}`}function J(e){let t=[];return t.push(`/**`),t.push(` * ${x.description}`),t.push(` */`),`\n${e}`+t.join(`\n${e}`)+`\n${e}`}function Y(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function X(e){return typeof e==`object`&&!!e&&`parent`in e}function Bt(e){return typeof e==`object`&&!!e&&`init`in e}function Z(e){return typeof e==`object`&&!!e}const Vt=[`FunctionDeclaration`,`MethodDefinition`,`ClassDeclaration`,`VariableDeclaration`,`TSInterfaceDeclaration`,`TSTypeAliasDeclaration`,`TSEnumDeclaration`,`PropertyDefinition`,`TSEnumMember`];function Ht(e){if(!Z(e)||e.type!==`TSPropertySignature`)return!1;let t=e.key;return Z(t)&&t.type===`Identifier`&&`name`in t&&typeof t.name==`string`?t.name===`null`||t.name===`undefined`:!1}function Ut(e,t){if(X(e)&&e.parent&&typeof e.parent==`object`&&Y(e.parent)&&[`ForStatement`,`ForInStatement`,`ForOfStatement`].includes(e.parent.type))return!0;if(e.type===`VariableDeclaration`){if(t)return!1;if(M(e)&&e.declarations.length>0){let t=e.declarations[0];if(!t)return!0;if(Bt(t)&&t.init&&typeof t.init==`object`&&Y(t.init)&&(t.init.type===`ArrowFunctionExpression`||t.init.type===`FunctionExpression`))return!1}return!0}return!!Ht(e)}function Wt(e){return e.includes(`/**`)}function Gt(e){if(`decorators`in e&&Array.isArray(e.decorators)&&e.decorators.length>0){let t=e.decorators[0];if(Z(t)){let e=t.range;if(Array.isArray(e)&&e.length>=1&&typeof e[0]==`number`)return[e[0],e[0]]}}if(X(e)&&e.parent&&typeof e.parent==`object`){let t=e.parent;if(Y(t)&&Z(t)&&[`ExportNamedDeclaration`,`ExportDefaultDeclaration`].includes(t.type)){let e=t.range;if(Array.isArray(e)&&e.length>=1&&typeof e[0]==`number`)return[e[0],e[0]]}}return[e.range[0],e.range[0]]}function Kt(e,t){if(!e)return``;let n=t;for(;n>0&&e[n-1]!==`
13
+ `;)n--;return e.slice(n,t)}function qt(e,t,n){if(t.skipFile||Ut(e,t.checkAllVariables))return;let r=b(t.commentsCache,e,n.sourceCode.text);if(!r){let t=P(e.type),r=N(e);n.report({node:e,message:`${t}"${r}"缺少 TSDoc 注释`,fix:t=>{let r=Gt(e),i=Ft(e,Kt(n.sourceCode.text,r[0]));return t.insertTextBeforeRange(r,i)}});return}let i=r.value;if(we(i)){let t=P(e.type),r=N(e);n.report({node:e,message:`${t}"${r}"的 TSDoc 注释包含占位描述,请填写实际描述`})}}function Jt(e,t){let n=e.getAllComments(),r=e.text;if(r!=null){if(!Wt(r))return t.skipFile=!0,n}else if(!n.some(e=>e.type===`Block`&&e.value.startsWith(`*`)))return t.skipFile=!0,n;return n}function Yt(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e;if(`checkAllVariables`in t&&typeof t.checkAllVariables==`boolean`)return t.checkAllVariables}return!1}const Xt=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求 TSDoc 注释存在`},schema:[{type:`object`,properties:{contexts:{type:`array`,items:{type:`string`}},checkAllVariables:{type:`boolean`}},additionalProperties:!1}]},createOnce(e){let t={commentsCache:[],checkAllVariables:!1,skipFile:!1},n={Program(n){t.skipFile=!1,t.checkAllVariables=!1,t.commentsCache=Jt(e.sourceCode,t);let r=e.options?.[0];t.checkAllVariables=Yt(r)}};for(let r of Vt)n[r]=n=>qt(n,t,e);return n}});function Zt(e){return e.tags.filter(e=>e.tag===`typeParam`||e.tag===`template`).map(e=>e.name)}const Qt=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求泛型有 @typeParam 标签`}},createOnce(e){return{FunctionDeclaration(t){Q(t,e)},FunctionExpression(t){Q(t,e)},ArrowFunctionExpression(t){if(`parent`in t&&t.parent){let e=t.parent.type;if(e===`CallExpression`||e===`Property`)return}Q(t,e)},ClassDeclaration(t){Q(t,e)},TSInterfaceDeclaration(t){Q(t,e)},TSTypeAliasDeclaration(t){Q(t,e)}}}});function Q(e,t){if(!F(e))return;let n=rt(e);if(n.length===0)return;let r=b(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!r)return;let i=d(r.value);if(!i)return;let a=Zt(i),o=n.filter(e=>!a.includes(e));for(let n of o)t.report({node:e,message:`缺少类型参数 "${n}" 的 @typeParam 文档`,fix:e=>{let i=S(t.sourceCode.text,r.range);return De(e,r,n,i)}})}const $t=/^(=+)\s+(.+?)\s+(=+)$/;function en(e){let t=e.trim().match($t);return t?{leadingEquals:t[1]??``,text:t[2]??``,trailingEquals:t[3]??``}:null}const tn=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求代码块分隔符使用规范格式`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let r of n){if(r.type!==`Line`)continue;let n=en(r.value.trim());if(n&&(n.leadingEquals.length!==20||n.trailingEquals.length!==20)){let i=`=`.repeat(20);e.report({node:t,message:`代码块分隔符格式不正确,应为:// ${i} ${n.text} ${i}`,fix:e=>{let t=`// ${i} ${n.text} ${i}`;return e.replaceTextRange(r.range,t)}})}}}}}}),nn=/\bTODO(?:\(([^)]+)\))?:?\s*(.*)/i;function rn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const an={requireAuthor:!1,requireDescription:!0};function on(e){return/\bTODO\b/i.test(e)}function sn(e){let t={...an};if(rn(e)){let n=e;typeof n.requireAuthor==`boolean`&&(t.requireAuthor=n.requireAuthor),typeof n.requireDescription==`boolean`&&(t.requireDescription=n.requireDescription)}return t}function cn(e){let t=e.match(nn);return t?{author:t[1]??``,description:(t[2]??``).trim()}:null}const ln={"no-commented-code":s,"no-description-tag":ae,"no-extra-param":Pe,"no-legacy-jsdoc-tags":Re,"no-placeholder-description":He,"param-hyphen-format":We,"require-blank-line-before-tags":Ke,"require-deprecated-alternative":Ye,"require-description":Ze,"require-multiline-property-comment":ot,"require-param":ct,"require-param-description":st,"require-returns":ht,"require-returns-description":lt,"require-throws":Ot,"require-throws-type":_t,"require-tsdoc":Xt,"require-type-param":Qt,"separator-format":tn,"todo-format":e({meta:{type:`suggestion`,docs:{description:`要求 TODO 注释有描述和作者`}},createOnce(e){let t=sn(e.options?.[0]);return{Program(n){let r=e.sourceCode.getAllComments();for(let i of r){let r=i.value;if(!on(r))continue;let a=cn(r);a&&(t.requireAuthor&&!a.author&&e.report({node:n,message:`TODO 注释缺少作者信息,格式:TODO(author): 描述`}),t.requireDescription&&!a.description&&e.report({node:n,message:`TODO 注释缺少描述说明`}))}}}}})},$=t({meta:{name:`@longzai-intelligence-oxlint/tsdoc-plugin`},rules:ln});export{$t as SEPARATOR_PATTERN,$ as default,$ as tsdocPlugin,en as parseSeparatorComment,ln as tsdocRules};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";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};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";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);t&&n.forbiddenExportNames.includes(t)&&(r===`tsup`?e.report({node:i,message:`禁止从 tsup 包导入 "${t}"。应使用 ${n.correctExportName} 从 "${n.configPackagePath}" 导入`}):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};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return typeof e!=`object`||!e?!1:`value`in e}const r=/* @__PURE__ */ new Set([`ManyToOne`,`OneToMany`,`OneToOne`,`ManyToMany`]);function i(e){if(e.type!==`CallExpression`)return!1;let t=e.callee;return t.type===`Identifier`&&r.has(t.name)}function a(e){if(e.type!==`Literal`||!n(e))return null;let t=e.value;return typeof t==`string`?t:null}const o=e({meta:{type:`problem`,docs:{description:`禁止 TypeORM 关系装饰器(@ManyToOne/@OneToMany/@OneToOne/@ManyToMany)使用字符串类名引用,生产构建 minify 会压缩类名导致运行时关系解析失败`}},createOnce(e){return{Decorator(t){if(!i(t.expression))return;let n=t.expression.arguments[0];if(n===void 0)return;let r=a(n);if(r===null)return;let o=t.expression.callee.type===`Identifier`?t.expression.callee.name:``;e.report({node:n,message:`@${o} 的第一个参数禁止使用字符串类名 "${r}"。生产构建 minify 会压缩类名(如 ${r} → y),导致 TypeORM 运行时抛出 "Entity metadata for y#<属性> was not found"。请改用箭头函数引用类:@${o}(() => ${r}, ...)。`})}}}}),s=/* @__PURE__ */ new Set([`find`,`findAndCount`]);function c(e){if(e.type!==`CallExpression`)return!1;let t=e.callee;if(t.type!==`MemberExpression`)return!1;let n=t.property;return n.type===`Identifier`&&s.has(n.name)}function l(e){let t=null,n=!1;for(let r of e.properties){if(r.type===`SpreadElement`)return null;if(r.type!==`Property`)continue;let e=u(r.key);e!==null&&(e===`skip`?t=r:e===`take`&&(n=!0))}return t!==null&&!n?t:null}function u(e){if(e.type===`Identifier`)return e.name;if(e.type===`Literal`&&n(e)){let t=e.value;if(typeof t==`string`)return t}return null}const d=e({meta:{type:`problem`,docs:{description:`禁止 TypeORM Repository.find/findAndCount 只传 skip 不传 take。MySQL 系 driver 对 OFFSET 不带 LIMIT 抛 OffsetWithoutLimitNotSupportedError,该错误仅在运行时、针对 MySQL 方言触发,类型系统与 SQLite 方言测试均无法捕获。`}},createOnce(e){return{CallExpression(t){if(!c(t))return;let n=t.arguments[0];if(n===void 0||n.type!==`ObjectExpression`)return;let r=l(n);if(r===null)return;let i=t.callee.type===`MemberExpression`&&t.callee.property.type===`Identifier`?t.callee.property.name:``;e.report({node:r,message:`${i} 的 FindManyOptions 含 skip 但缺少 take。MySQL 系 driver 对 OFFSET 不带 LIMIT 抛 OffsetWithoutLimitNotSupportedError(仅运行时、仅 MySQL 方言触发,类型系统与 SQLite 测试无法捕获)。请配对设置 take(分页场景用 @longzai-intelligence-pagination/typeorm 的 paginateWithRepository 等工具,它们强制 skip+take 成对;批量删除场景改用 QueryBuilder.delete().limit() 在 SQL 层直接删除)。`})}}}}),f=t({meta:{name:`@longzai-intelligence-oxlint/typeorm-plugin`},rules:{"no-string-entity-ref":o,"require-take-with-skip":d}});export{s as PAGINATED_QUERY_METHODS,r as RELATION_DECORATORS,f as default,f as typeormPlugin,o as noStringEntityRefRule,d as requireTakeWithSkipRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return typeof e==`object`&&!!e&&`typeAnnotation`in e&&e.typeAnnotation!==null&&typeof e.typeAnnotation==`object`}function r(e){return typeof e==`object`&&!!e}function i(e){return typeof e==`object`&&!!e}function a(e){if(!r(e)||!(`type`in e)||e.type!==`TSTypeReference`||!(`typeName`in e)||e.typeName===null||typeof e.typeName!=`object`)return!1;let t=e.typeName;return i(t)?`name`in t&&t.name===`const`:!1}function o(e){return!r(e)||!(`type`in e)?!1:e.type===`TSTypeLiteral`}function s(e,t,r){if(!n(e))return;let i=e.typeAnnotation;if(r.assertionStyle===`never`){if(a(i))return;t.report({node:e,message:`禁止使用 as 类型断言,请使用类型守卫或 Zod 进行类型验证`})}else if(r.assertionStyle===`angle-bracket`){if(a(i)||r.objectLiteralTypeAssertions&&o(i))return;t.report({node:e,message:`应使用尖括号断言而非 as 断言`})}}function c(e,t,r){if(r.assertionStyle===`never`)t.report({node:e,message:`禁止使用尖括号类型断言,请使用类型守卫或 Zod 进行类型验证`});else if(r.assertionStyle===`as`){if(n(e)&&r.objectLiteralTypeAssertions&&o(e.typeAnnotation))return;t.report({node:e,message:`应使用 as 断言而非尖括号断言`})}}function l(e,t,n){n.assertionStyle===`never`&&t.report({node:e,message:`禁止使用非空断言 (!),请使用类型守卫或 Zod 进行类型验证`})}function u(e){return e===`never`||e===`as`||e===`angle-bracket`}function d(e){return typeof e==`object`&&!!e}function f(e){return!d(e)||!(`assertionStyle`in e)?!1:u(e.assertionStyle)}function p(e){let t={assertionStyle:`never`,objectLiteralTypeAssertions:!1};if(!Array.isArray(e)||e.length===0)return t;let n=e[0];return f(n)?{assertionStyle:n.assertionStyle,objectLiteralTypeAssertions:n.objectLiteralTypeAssertions??!1}:t}const m=e({meta:{type:`suggestion`,docs:{description:`禁止使用类型断言,强制使用类型守卫或 Zod 进行类型验证`}},createOnce(e){let t=p(e.options);return{TSAsExpression(n){s(n,e,t)},TSTypeAssertion(n){c(n,e,t)},TSNonNullExpression(n){l(n,e,t)}}}}),h={"consistent-type-assertions":m},g=t({meta:{name:`@longzai-intelligence-oxlint/typescript-eslint-plugin`},rules:h});export{m as consistentTypeAssertionsRule,g as default,g as typescriptEslintPlugin,h as typescriptEslintRules};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=[],r=[],i=[],a=[];function o(e){if(typeof e!=`object`||!e)return!1;if(`configPackagePaths`in e){let t=Object.getOwnPropertyDescriptor(e,`configPackagePaths`)?.value;if(t!==void 0&&!Array.isArray(t))return!1}if(`allowedExportNames`in e){let t=Object.getOwnPropertyDescriptor(e,`allowedExportNames`)?.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}if(`excludedPaths`in e){let t=Object.getOwnPropertyDescriptor(e,`excludedPaths`)?.value;if(t!==void 0&&!Array.isArray(t))return!1}return!0}function s(e){let t=Array.isArray(e)?e[0]:e;return o(t)?{configPackagePaths:t.configPackagePaths??n,allowedExportNames:t.allowedExportNames??r,forbiddenExportNames:t.forbiddenExportNames??i,excludedPaths:t.excludedPaths??a}:{configPackagePaths:n,allowedExportNames:r,forbiddenExportNames:i,excludedPaths:a}}function c(e){return e.replace(/\\/g,`/`).endsWith(`/vitest.config.ts`)}function l(e,t){return t.some(t=>e.includes(t))}function u(e){if(typeof e!=`object`||!e||!(`type`in e)||!(`callee`in e)||Object.getOwnPropertyDescriptor(e,`type`)?.value!==`CallExpression`)return null;let t=Object.getOwnPropertyDescriptor(e,`callee`)?.value;if(typeof t!=`object`||!t)return null;let n=Object.getOwnPropertyDescriptor(t,`type`)?.value,r=Object.getOwnPropertyDescriptor(t,`name`)?.value;return{type:`CallExpression`,callee:{type:typeof n==`string`?n:``,name:typeof r==`string`?r:void 0}}}function d(e){return typeof e==`object`&&!!e&&`type`in e&&Object.getOwnPropertyDescriptor(e,`type`)?.value===`ObjectExpression`}function f(){return{hasValidImport:!1,hasForbiddenImport:!1,hasExportDefault:!1,forbiddenImportName:``}}function p(e){return e.source.type===`Literal`&&typeof e.source.value==`string`?e.source.value:null}function m(e){return e.imported?.type===`Identifier`?e.imported.name??null:null}function h(e){return`必须使用共享配置函数(${e.allowedExportNames.join(`, `)})从 ${e.configPackagePaths.join(` 或 `)} 导入`}function g(e,t,n){c(t)?(e.resolvedOptions=s(n),e.resolvedOptions.configPackagePaths.length===0||e.resolvedOptions.allowedExportNames.length===0||l(t,e.resolvedOptions.excludedPaths)?e.isActive=!1:(e.isActive=!0,e.state.hasValidImport=!1,e.state.hasForbiddenImport=!1,e.state.hasExportDefault=!1,e.state.forbiddenImportName=``)):e.isActive=!1}function _(e,t,n){if(e.isActive&&e.resolvedOptions&&t)for(let r of n){if(r.type!==`ImportSpecifier`)continue;let n=m(r);n&&(t===`vitest`&&e.resolvedOptions.forbiddenExportNames.includes(n)?(e.state.hasForbiddenImport=!0,e.state.forbiddenImportName=n):e.resolvedOptions.configPackagePaths.includes(t)&&e.resolvedOptions.allowedExportNames.includes(n)&&(e.state.hasValidImport=!0))}}function v(e,t,n){if(!e.isActive||!e.resolvedOptions)return;if(e.state.hasExportDefault=!0,e.state.hasForbiddenImport){n(`禁止从 vitest 包导入 "${e.state.forbiddenImportName}"。应使用共享配置函数(${e.resolvedOptions.allowedExportNames.join(`, `)})从 ${e.resolvedOptions.configPackagePaths.join(` 或 `)} 导入`);return}let r=u(t);r?r.callee.type===`Identifier`&&r.callee.name&&!e.resolvedOptions.allowedExportNames.includes(r.callee.name)&&!e.state.hasValidImport&&n(h(e.resolvedOptions)):d(t)&&(e.state.hasValidImport||n(h(e.resolvedOptions)))}function y(e,t){e.isActive&&e.resolvedOptions&&(e.state.hasExportDefault||t(`vitest.config.ts 必须使用共享配置函数(${e.resolvedOptions.allowedExportNames.join(`, `)})从 ${e.resolvedOptions.configPackagePaths.join(` 或 `)} 导入`))}const b=e({meta:{type:`problem`,docs:{description:`强制执行 vitest.config.ts 文件中的配置导入规范,必须使用共享配置函数`},schema:[{type:`object`,properties:{configPackagePaths:{type:`array`,items:{type:`string`}},allowedExportNames:{type:`array`,items:{type:`string`}},forbiddenExportNames:{type:`array`,items:{type:`string`}},excludedPaths:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){let t={resolvedOptions:null,state:f(),isActive:!1};return{Program(n){g(t,e.filename,e.options)},ImportDeclaration(e){_(t,p(e),e.specifiers)},ExportDefaultDeclaration(n){n.type===`ExportDefaultDeclaration`&&n.declaration&&typeof n.declaration==`object`&&v(t,n.declaration,t=>{e.report({node:n,message:t})})},"Program:exit"(n){y(t,t=>{e.report({node:n,message:t})})}}}}),x=t({meta:{name:`@longzai-intelligence-oxlint/vitest-config-plugin`},rules:{"require-vitest-config-import":b}});export{x as default,x as vitestConfigPlugin,b as requireVitestConfigImportRule};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return e.callee?.type===`MemberExpression`&&r(e.callee)}function r(e){return e.object?.type===`Identifier`&&e.object.name===`z`&&e.property?.type===`Identifier`}function i(e){if(e.callee?.type!==`MemberExpression`)return!1;let t=e.callee.object;for(;t.type===`CallExpression`;){if(n(t))return!0;if(t.callee?.type===`MemberExpression`)t=t.callee.object;else break}return t.type===`Identifier`&&t.name===`z`}function a(e){if(n(e)||i(e))return!0;if(e.callee?.type===`MemberExpression`&&e.callee.object?.type===`Identifier`){let t=e.callee.object.name.toLowerCase();return t.endsWith(`schema`)||t===`schema`||t===`validator`||t===`zodschema`}return!1}function o(e){if(e.property?.type===`Identifier`)return e.property.name}function s(e){if(e.type===`Identifier`){let t=e.name.toLowerCase();return t===`error`||t===`err`||t===`e`||t===`zoderror`||t===`validationerror`}return e.type===`MemberExpression`&&o(e)===`error`}const c=[`parse`,`parseAsync`,`safeParse`,`safeParseAsync`,`spa`,`encode`,`encodeAsync`,`decode`,`decodeAsync`,`safeEncode`,`safeEncodeAsync`,`safeDecode`,`safeDecodeAsync`,`codec`,`treeifyError`,`prettifyError`,`formatError`,`flattenError`];function l(e){let t=e;for(;t!==null;)if(t.type===`CallExpression`){if(n(t)){let e=t.callee.type===`MemberExpression`&&t.callee.property?.type===`Identifier`?t.callee.property.name:void 0;if(e&&!c.includes(e))return!0;break}if(i(t))return!0;if(t.callee?.type===`MemberExpression`)t=t.callee;else break}else if(t.type===`MemberExpression`){if(t.object?.type===`CallExpression`)t=t.object;else if(t.object?.type===`MemberExpression`)t=t.object;else break}else break;return!1}const u=e({meta:{type:`suggestion`,docs:{description:`强制 Zod schema 变量命名约定`}},createOnce(e){return{VariableDeclarator(t){if(t.id?.type!==`Identifier`)return;let n=t.init;if(n?.type!==`CallExpression`||!l(n))return;let r=t.id.name;r.endsWith(`Schema`)||e.report({node:t.id,message:`Zod schema 变量 "${r}" 应遵循命名约定:后缀 "Schema"。`})}}}}),d=e({meta:{type:`suggestion`,docs:{description:`禁止使用 z.any()`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`any`&&e.report({node:t,message:`禁止使用 z.any()。z.any() 不提供任何类型安全,请使用 z.unknown() 或更具体的类型替代。`})}}}}),f=e({meta:{type:`problem`,docs:{description:`禁止使用 .deepPartial()(Zod v4 已移除)`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`deepPartial`){if(!a(t))return;e.report({node:t,message:`禁止使用 .deepPartial()。Zod v4 中已移除,应手动实现深度可选。`})}}}}}),p=[`invalid_type_error`,`required_error`],m=e({meta:{type:`problem`,docs:{description:`禁止使用 invalid_type_error/required_error 参数`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`){for(let n of t.arguments||[])if(n?.type===`ObjectExpression`)for(let t of n.properties||[])t?.type===`Property`&&t.key?.type===`Identifier`&&p.includes(t.key.name)&&e.report({node:t,message:`禁止使用 ${t.key.name} 参数。Zod v4 中已移除,请使用 error 参数替代。`})}}}}}),h=[`format`,`flatten`],g=e({meta:{type:`problem`,docs:{description:`禁止在 ZodError 上使用 .format()/.flatten()(Zod v4 已移除)`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&h.includes(t.callee.property.name)&&s(t.callee.object)&&e.report({node:t,message:`禁止在 ZodError 上使用 .${t.callee.property.name}()。Zod v4 中已移除,请使用 z.treeifyError() 替代。`})}}}}),_={strict:`z.strictObject()`,passthrough:`z.looseObject()`,strip:`z.object(schema.shape)`},v=e({meta:{type:`problem`,docs:{description:`禁止使用 .strict()/.passthrough()/.strip()(Zod v4 已废弃)`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`){let n=t.callee.property.name;if(!Object.hasOwn(_,n)||!a(t))return;let r=_[n];e.report({node:t,message:`禁止使用 .${n}()。Zod v4 中已废弃,请使用 ${r} 替代。`})}}}}}),y=e({meta:{type:`problem`,docs:{description:`禁止访问 .errors 属性,推荐使用 .issues`}},createOnce(e){return{MemberExpression(t){t.property?.type===`Identifier`&&t.property.name===`errors`&&s(t.object)&&e.report({node:t,message:`禁止访问 .errors 属性。Zod v4 中已移除,请使用 .issues 替代。`})}}}}),b=e({meta:{type:`problem`,docs:{description:`禁止使用 .merge(),推荐使用 .extend()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`merge`){if(!a(t))return;e.report({node:t,message:`禁止使用 .merge()。Zod v4 中已废弃,请使用 .extend() 或展开语法替代。`})}}}}}),x=e({meta:{type:`problem`,docs:{description:`禁止使用 z.nativeEnum(),推荐使用 z.enum()`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`nativeEnum`&&e.report({node:t,message:`禁止使用 z.nativeEnum()。Zod v4 中已废弃,请使用 z.enum() 替代。`})}}}});function S(e){let t=e.object;for(;t?.type===`CallExpression`;){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`number`)return!0;if(t.callee?.type===`MemberExpression`)t=t.callee.object;else break}return!1}const C=e({meta:{type:`problem`,docs:{description:`禁止使用 .finite()(Zod v4 默认不允许无限值)`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`finite`&&S(t.callee)&&e.report({node:t,message:`禁止使用 .finite()。Zod v4 中 z.number() 默认不允许无限值,此方法已不再需要。`})}}}}),w=e({meta:{type:`problem`,docs:{description:`禁止使用 z.number().int(),推荐使用 z.int()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`int`){let n=t.callee.object;n?.type===`CallExpression`&&n.callee?.type===`MemberExpression`&&n.callee.object?.type===`Identifier`&&n.callee.object.name===`z`&&n.callee.property?.type===`Identifier`&&n.callee.property.name===`number`&&e.report({node:t,message:`禁止使用 z.number().int()。Zod v4 中已废弃,请使用 z.int() 替代。`})}}}}});function T(e){let t=e;for(;t?.type===`CallExpression`;){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`number`)return!0;if(t.callee?.type===`MemberExpression`)t=t.callee.object;else break}return!1}const E=e({meta:{type:`problem`,docs:{description:`禁止访问 .isFinite 属性(Zod v4 始终为 true)`}},createOnce(e){return{MemberExpression(t){if(t.property?.type===`Identifier`&&t.property.name===`isFinite`){let n=t.object;n?.type===`CallExpression`&&T(n)&&e.report({node:t,message:`禁止访问 .isFinite 属性。Zod v4 中此属性始终为 true,已无意义。`})}}}}});function D(e){let t=e;for(;t?.type===`CallExpression`;){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`number`)return!0;if(t.callee?.type===`MemberExpression`)t=t.callee.object;else break}return!1}const O=e({meta:{type:`problem`,docs:{description:`禁止访问 .isInt 属性(Zod v4 已废弃)`}},createOnce(e){return{MemberExpression(t){if(t.property?.type===`Identifier`&&t.property.name===`isInt`){let n=t.object;n?.type===`CallExpression`&&D(n)&&e.report({node:t,message:`禁止访问 .isInt 属性。Zod v4 中已废弃,应检查 format 属性替代。`})}}}}});function k(e){let t=e.object;for(;t?.type===`CallExpression`;){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`number`)return!0;if(t.callee?.type===`MemberExpression`)t=t.callee.object;else break}return!1}const A=e({meta:{type:`problem`,docs:{description:`禁止使用 .safe(),推荐使用 z.int()`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`safe`&&k(t.callee)&&e.report({node:t,message:`禁止使用 .safe()。Zod v4 中已废弃,请使用 z.int() 替代。`})}}}});function j(e){let t=e.object;for(;t?.type===`CallExpression`;){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`number`)return!0;if(t.callee?.type===`MemberExpression`)t=t.callee.object;else break}return!1}const M=e({meta:{type:`problem`,docs:{description:`禁止使用 .step(),推荐使用 .multipleOf()`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`step`&&j(t.callee)&&e.report({node:t,message:`禁止使用 .step()。Zod v4 中已废弃,请使用 .multipleOf() 替代。`})}}}});function N(e){let t=[],n=e;for(;n!==null&&!(n.callee?.type!==`MemberExpression`||n.callee.property?.type!==`Identifier`||(t.push(n.callee.property.name),n.callee.object?.type!==`CallExpression`));)n=n.callee.object;return t}const P=e({meta:{type:`problem`,docs:{description:`禁止同时使用 .optional() 和 .default()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`){if(!a(t))return;let n=N(t),r=n.includes(`optional`),i=n.includes(`default`);r&&i&&e.report({node:t,message:`禁止同时使用 .optional() 和 .default()。.default() 已隐含可选语义,请移除 .optional()。`})}}}}}),F=e({meta:{type:`problem`,docs:{description:`禁止使用 z.promise()`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`promise`&&e.report({node:t,message:`禁止使用 z.promise()。Zod v4 中已移除,应在解析前使用 await。`})}}}}),I=e({meta:{type:`problem`,docs:{description:`要求 z.record() 必须有两个参数`}},createOnce(e){return{CallExpression(t){t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`record`&&t.arguments?.length===1&&e.report({node:t,message:`z.record() 必须提供两个参数(key schema 和 value schema)。Zod v4 不再支持单参数形式。`})}}}}),L=e({meta:{type:`problem`,docs:{description:`禁止使用 .superRefine(),推荐使用 .check()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`superRefine`){if(!a(t))return;e.report({node:t,message:`禁止使用 .superRefine()。Zod v4 中已废弃,请使用 .check() 替代。`})}}}}}),R=[`refine`,`superRefine`,`transform`],z=e({meta:{type:`problem`,docs:{description:`禁止在 refine 回调中使用 throw 语句`}},createOnce(e){return{ThrowStatement(t){let n=t.parent;for(;n;){if(n.type===`TryStatement`)return;if(n.type===`FunctionExpression`||n.type===`ArrowFunctionExpression`){let r=n.parent;if(r?.type===`CallExpression`&&r.callee?.type===`MemberExpression`&&r.callee.property?.type===`Identifier`&&R.includes(r.callee.property.name)){if(!a(r))return;let n={refine:`禁止在 .refine() 回调中使用 throw 语句。应返回 falsy 值来表示验证失败。`,superRefine:`禁止在 .superRefine() 回调中使用 throw 语句。应使用 ctx.addIssue() 报告错误。`,transform:`禁止在 .transform() 回调中使用 throw 语句。应使用 ctx.issues.push() 并返回 z.NEVER。`}[r.callee.property.name];n&&e.report({node:t,message:n})}return}if(n.type===`FunctionDeclaration`||n.type===`Program`)return;n=n.parent}}}}}),B=e({meta:{type:`suggestion`,docs:{description:`优先使用 z.enum() 替代全字符串字面量的 z.union()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`union`){let n=t.arguments?.[0];if(n?.type!==`ArrayExpression`)return;let r=!0;for(let e of n.elements||[]){if(!e||e.type!==`CallExpression`||e.callee?.type!==`MemberExpression`||e.callee.object?.type!==`Identifier`||e.callee.object.name!==`z`||e.callee.property?.type!==`Identifier`||e.callee.property.name!==`literal`){r=!1;break}let t=e.arguments?.[0];if(t?.type!==`Literal`||typeof t.value!=`string`){r=!1;break}}r&&(n.elements?.length??0)>0&&e.report({node:t,message:`优先使用 z.enum() 替代全字符串字面量的 z.union()。`})}}}}}),V=e({meta:{type:`suggestion`,docs:{description:`推荐使用 error 参数替代 message 参数`}},createOnce(e){return{CallExpression(t){if((t.callee?.type!==`MemberExpression`||t.callee.object?.type!==`Identifier`||t.callee.object.name!==`z`||t.callee.property?.type!==`Identifier`||t.callee.property.name!==`object`)&&t.callee?.type===`MemberExpression`&&t.callee.object?.type===`Identifier`&&t.callee.object.name===`z`){for(let n of t.arguments||[])if(n?.type===`ObjectExpression`)for(let t of n.properties||[])t?.type===`Property`&&t.key?.type===`Identifier`&&t.key.name===`message`&&e.report({node:t,message:`推荐使用 error 参数替代 message 参数。Zod v4 中 message 参数已废弃。`})}}}}}),H=e({meta:{type:`suggestion`,docs:{description:`推荐使用 .meta() 替代 .describe()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`describe`){if(!a(t))return;e.report({node:t,message:`推荐使用 .meta() 替代 .describe()。Zod v4 中 .describe() 已废弃,.meta() 提供更丰富的元数据支持。`})}}}}}),U=e({meta:{type:`suggestion`,docs:{description:`推荐使用 .safeParse() 替代 .parse()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type===`MemberExpression`&&t.callee.property?.type===`Identifier`&&t.callee.property.name===`parse`){if(!a(t))return;e.report({node:t,message:`推荐使用 .safeParse() 替代 .parse()。.safeParse() 不会抛出异常,是更安全的验证方式。`})}}}}}),W={email:`email`,uuid:`uuid`,url:`url`,uri:`uri`,date:`date`,time:`time`,datetime:`datetime`,duration:`duration`,ipv4:`ipv4`,ipv6:`ipv6`,cidrv4:`cidrv4`,cidrv6:`cidrv6`,base64:`base64`,base64url:`base64url`,json:`json`,regex:`regex`,hostname:`hostname`},G=e({meta:{type:`suggestion`,docs:{description:`优先使用顶层字符串格式 schema 替代 z.string().<format>()`}},createOnce(e){return{CallExpression(t){if(t.callee?.type!==`MemberExpression`||t.callee.property?.type!==`Identifier`)return;let n=t.callee.property.name;if(!Object.hasOwn(W,n))return;let r=t.callee.object;if(r?.type===`CallExpression`&&r.callee?.type===`MemberExpression`&&r.callee.object?.type===`Identifier`&&r.callee.object.name===`z`&&r.callee.property?.type===`Identifier`&&r.callee.property.name===`string`){let r=W[n];e.report({node:t,message:`禁止使用 z.string().${n}()。Zod v4 中已废弃,请使用 z.${r}() 替代。`})}}}}}),K=e({meta:{type:`suggestion`,docs:{description:`强制使用命名空间导入 zod`}},createOnce(e){return{ImportDeclaration(t){let n=t.source?.value;if(n===`zod`||n?.startsWith(`zod/`))for(let n of t.specifiers||[])n.type===`ImportDefaultSpecifier`&&e.report({node:n,message:`请使用命名空间导入 zod(import * as z from "zod")代替默认导入。`}),n.type===`ImportSpecifier`&&n.imported?.type===`Identifier`&&n.imported.name===`z`&&e.report({node:n,message:`请使用命名空间导入 zod(import * as z from "zod")代替命名导入。`})}}}});function q(e){let t=e.callee?.type===`MemberExpression`&&e.callee.property?.type===`Identifier`&&e.callee.property.name===`refine`;if(t&&!a(e))return!1;let n=e.callee?.type===`MemberExpression`&&e.callee.object?.type===`Identifier`&&e.callee.object.name===`z`&&e.callee.property?.type===`Identifier`&&e.callee.property.name===`custom`;return t||n}function J(e,t){if(!e.arguments||e.arguments.length<2){t.report({node:e,message:`.refine() 和 z.custom() 必须包含错误消息(error 属性)。`});return}let n=e.arguments[1];if((n?.type!==`Literal`||typeof n.value!=`string`)&&n?.type===`ObjectExpression`){let r=(n.properties||[]).some(e=>e?.type===`Property`&&e.key?.type===`Identifier`&&e.key.name===`error`),i=(n.properties||[]).some(e=>e?.type===`Property`&&e.key?.type===`Identifier`&&e.key.name===`message`);if(i&&!r){for(let e of n.properties||[])e?.type===`Property`&&e.key?.type===`Identifier`&&e.key.name===`message`&&t.report({node:e,message:`请将 message 属性替换为 error 属性。Zod v4 中 message 已废弃。`});return}!r&&!i&&t.report({node:e,message:`.refine() 和 z.custom() 必须包含错误消息(error 属性)。`})}}const Y=e({meta:{type:`suggestion`,docs:{description:`要求 refine 包含错误消息`}},createOnce(e){return{CallExpression(t){q(t)&&J(t,e)}}}}),X=t({meta:{name:`@longzai-intelligence-oxlint/zod-plugin`},rules:{"no-native-enum":x,"no-promise-schema":F,"no-deep-partial":f,"no-record-single-arg":I,"no-merge-method":b,"no-errors-property":y,"no-deprecated-object-methods":v,"no-deprecated-format-methods":g,"no-deprecated-error-params":m,"no-superrefine":L,"prefer-safe-parse":U,"prefer-error-param":V,"no-throw-in-refine":z,"no-any-schema":d,"no-optional-and-default-together":P,"prefer-enum-over-literal-union":B,"prefer-meta":H,"require-error-message":Y,"consistent-schema-var-name":u,"prefer-top-level-string-formats":G,"prefer-zod-namespace":K,"no-number-schema-with-int":w,"no-number-schema-with-finite":C,"no-number-schema-with-safe":A,"no-number-schema-with-step":M,"no-number-schema-with-is-finite":E,"no-number-schema-with-is-int":O}});export{X as default,X as zodPlugin};
@@ -1,4 +1,4 @@
1
- import { OxlintConfigOverride, OxlintRules } from "@longzai-intelligence-oxlint/core";
1
+ import { i as OxlintRules, n as OxlintConfigOverride } from "./index-eNRova_s.js";
2
2
  //#region src/types/preset-options.types.d.ts
3
3
  /**
4
4
  * 预设选项
package/dist/react.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { t as PresetOptions } from "./index-Cu6dVxg4.js";
2
- import { OxlintConfig, OxlintConfig as OxlintConfig$1, OxlintConfigOverride } from "@longzai-intelligence-oxlint/core";
1
+ import "./rolldown-runtime-BqT_7tdF.js";
2
+ import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-eNRova_s.js";
3
+ import { t as PresetOptions } from "./preset-options.types-Czyi-DdY.js";
3
4
  //#region src/entries/react.entry.d.ts
4
5
  /**
5
6
  * 创建 Oxlint React 配置
@@ -7,10 +8,10 @@ import { OxlintConfig, OxlintConfig as OxlintConfig$1, OxlintConfigOverride } fr
7
8
  * @param options - 预设选项,包含额外的规则、覆盖和忽略模式
8
9
  * @returns 包含 React 和 JSX a11y 插件的 Oxlint 配置对象
9
10
  */
10
- declare function defineConfig(options?: PresetOptions): OxlintConfig$1;
11
+ declare function defineConfig(options?: PresetOptions): OxlintConfig;
11
12
  /**
12
13
  * 默认 Oxlint React 配置实例
13
14
  */
14
- declare const oxlintReactConfig: OxlintConfig$1;
15
+ declare const oxlintReactConfig: OxlintConfig;
15
16
  //#endregion
16
17
  export { type OxlintConfig, type OxlintConfigOverride, oxlintReactConfig as default, defineConfig };
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{a as e,t}from"./base.entry-BsfLhCnW.js";function n(n){let r=t();return{extends:[r],plugins:[`react`,`jsx-a11y`],...n,ignorePatterns:e([...r.ignorePatterns??[],...n?.ignorePatterns??[]])}}const r=n();export{r as default,n as defineConfig};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{o as e,t}from"./base.entry-BRRJVhQW.js";function n(n){let r=t();return{extends:[r],plugins:[`react`,`jsx-a11y`],...n,ignorePatterns:e([...r.ignorePatterns??[],...n?.ignorePatterns??[]])}}const r=n();export{r as default,n as defineConfig};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
package/dist/rules.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import { a as ESLINT_CORE_RULES, i as TYPESCRIPT_RECOMMENDED_RULES, n as ESLINT_RECOMMENDED_RULES, r as TYPESCRIPT_PROJECT_RULES, t as UNICORN_RULES } from "./unicorn.rules-BzgL7xpu.js";
1
+ import "./rolldown-runtime-BqT_7tdF.js";
2
+ import { a as ESLINT_CORE_RULES, i as TYPESCRIPT_RECOMMENDED_RULES, n as ESLINT_RECOMMENDED_RULES, r as TYPESCRIPT_PROJECT_RULES, t as UNICORN_RULES } from "./unicorn.rules-CoZq5SQL.js";
2
3
  export { ESLINT_CORE_RULES, ESLINT_RECOMMENDED_RULES, TYPESCRIPT_PROJECT_RULES, TYPESCRIPT_RECOMMENDED_RULES, UNICORN_RULES };
package/dist/rules.js CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./typescript-eslint.rules-W6xcPWv3.js";import{n as r,t as i}from"./unicorn.rules-EOaLfd_c.js";export{r as ESLINT_CORE_RULES,n as ESLINT_RECOMMENDED_RULES,e as TYPESCRIPT_PROJECT_RULES,t as TYPESCRIPT_RECOMMENDED_RULES,i as UNICORN_RULES};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{n as e,r as t,t as n}from"./typescript-eslint.rules-j0Y80OGu.js";import{n as r,t as i}from"./unicorn.rules-0a_FuIjL.js";export{r as ESLINT_CORE_RULES,n as ESLINT_RECOMMENDED_RULES,e as TYPESCRIPT_PROJECT_RULES,t as TYPESCRIPT_RECOMMENDED_RULES,i as UNICORN_RULES};
package/dist/taro.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import { a as TARO_FILE_NAMING_EXEMPT_PATTERNS, i as oxlintTaroConfig, n as OxlintConfigOverride, o as TARO_SPECIAL_FILE_PATTERNS, r as defineConfig, t as OxlintConfig } from "./taro.entry-BrMnYd7F.js";
1
+ import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-eNRova_s.js";
2
+ import { i as TARO_SPECIAL_FILE_PATTERNS, n as oxlintTaroConfig, r as TARO_FILE_NAMING_EXEMPT_PATTERNS, t as defineConfig } from "./taro.entry-DuohnWen.js";
2
3
  export { type OxlintConfig, type OxlintConfigOverride, TARO_FILE_NAMING_EXEMPT_PATTERNS, TARO_SPECIAL_FILE_PATTERNS, oxlintTaroConfig as default, defineConfig };
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{o as e}from"./base.entry-BRRJVhQW.js";import{defineConfig as t}from"./react.js";const n=[`src/app.ts`,`config/dev.ts`,`config/prod.ts`],r=[`src/app.tsx`];function i(i){let a=[...i?.typeSuffixBaseSkipPatterns??[],...n],o=[...i?.fileNamingBaseSkipPatterns??[],...r],s={files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":[`error`,{skipPatterns:a}]}},c={files:[`**/*.tsx`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/file-naming":[`error`,{skipPatterns:o}]}},l=t();return{extends:[l],overrides:[s,c,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:e([...l.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{n as i,a as n,r,i as t};
@@ -1,5 +1,6 @@
1
- import { t as PresetOptions } from "./index-Cu6dVxg4.js";
2
- import { OxlintConfig, OxlintConfig as OxlintConfig$1, OxlintConfigOverride as OxlintConfigOverride$1 } from "@longzai-intelligence-oxlint/core";
1
+ import "./rolldown-runtime-BqT_7tdF.js";
2
+ import { t as OxlintConfig } from "./index-eNRova_s.js";
3
+ import { t as PresetOptions } from "./preset-options.types-Czyi-DdY.js";
3
4
  //#region src/defaults/taro.patterns.d.ts
4
5
  /**
5
6
  * Taro 预设 - 框架约定文件模式
@@ -57,4 +58,4 @@ declare function defineConfig(options?: TaroPresetOptions): OxlintConfig;
57
58
  */
58
59
  declare const oxlintTaroConfig: OxlintConfig;
59
60
  //#endregion
60
- export { TARO_FILE_NAMING_EXEMPT_PATTERNS as a, oxlintTaroConfig as i, OxlintConfigOverride$1 as n, TARO_SPECIAL_FILE_PATTERNS as o, defineConfig as r, OxlintConfig$1 as t };
61
+ export { TARO_SPECIAL_FILE_PATTERNS as i, oxlintTaroConfig as n, TARO_FILE_NAMING_EXEMPT_PATTERNS as r, defineConfig as t };
package/dist/taro.js CHANGED
@@ -1 +1 @@
1
- import"./react.js";export{r as TARO_FILE_NAMING_EXEMPT_PATTERNS,i as TARO_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./taro.entry-B0YhHlhV.js";
1
+ import"./react.js";export{r as TARO_FILE_NAMING_EXEMPT_PATTERNS,i as TARO_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./taro.entry-CHCKR0fA.js";
@@ -0,0 +1 @@
1
+ import"node:path";import"node:path/win32";import"node:url";const e={"max-lines":[`error`,{max:400,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":[`error`,{max:200,skipBlankLines:!0,skipComments:!0}],"no-useless-rename":`error`,"sort-imports":[`error`,{ignoreDeclarationSort:!0,ignoreMemberSort:!1,ignoreCase:!0}]},t={"typescript/no-explicit-any":`error`,"typescript/no-non-null-assertion":`error`,"typescript/no-extra-non-null-assertion":`error`,"typescript/no-misused-new":`error`,"typescript/no-this-alias":`error`,"typescript/no-unnecessary-type-constraint":`error`,"typescript/no-unsafe-argument":`error`,"typescript/no-unsafe-assignment":`error`,"typescript/no-unsafe-call":`error`,"typescript/no-unsafe-member-access":`error`,"typescript/no-unsafe-return":`error`,"typescript/no-require-imports":`error`,"typescript/triple-slash-reference":`error`},n=[{files:[`**/*.cjs`],rules:{"typescript/no-require-imports":`off`}}],r={"unicorn/prefer-node-protocol":`error`,"unicorn/no-empty-file":`error`},i=[`**/node_modules/**`,`**/dist/**`,`**/out/**`,`**/.next/**`,`**/coverage/**`,`**/.bun/**`,`**/tailwind/*.mjs`,`**/tsup.config.bundled_*.mjs`],a={...e,...t,...r},o=[`typescript`,`unicorn`,`import`],s=[...n];function c(e={}){let{rules:t,overrides:n,ignorePatterns:r,plugins:c,jsPlugins:l}=e;return{ignorePatterns:[...i,...r??[]],plugins:[...o,...c??[]],jsPlugins:l??[...o],rules:{...a,...t},overrides:[...s,...n??[]]}}const l={"no-cond-assign":`error`,"no-constant-condition":`error`,"no-control-regex":`error`,"no-debugger":`error`,"no-dupe-keys":`error`,"no-empty":`error`,"no-empty-character-class":`error`,"no-extra-boolean-cast":`error`,"no-func-assign":`error`,"no-global-assign":`error`,"no-invalid-regexp":`error`,"no-irregular-whitespace":`error`,"no-obj-calls":`error`,"no-prototype-builtins":`error`,"no-sparse-arrays":`error`,"no-unreachable":`error`,"no-unsafe-finally":`error`,"no-unsafe-negation":`error`,"use-isnan":`error`,"valid-typeof":`error`},u=t,d={"no-unused-vars":[`error`,{argsIgnorePattern:`^_`,varsIgnorePattern:`^_`,caughtErrorsIgnorePattern:`^_`,destructuredArrayIgnorePattern:`^_`,ignoreRestSiblings:!0}],"typescript/consistent-type-definitions":[`error`,`type`],"typescript/no-deprecated":`error`};export{r as a,c as i,d as n,e as o,u as r,l as t};
@@ -0,0 +1 @@
1
+ import{a as e,o as t}from"./typescript-eslint.rules-j0Y80OGu.js";const n=t,r=e;export{n,r as t};
@@ -1,4 +1,4 @@
1
- import { OxlintRules } from "@longzai-intelligence-oxlint/core";
1
+ import { i as OxlintRules, r as OxlintRuleConfig } from "./index-eNRova_s.js";
2
2
  //#region src/rules/eslint-core.rules.d.ts
3
3
  /**
4
4
  * Oxlint 原生规则配置 - eslint-core 规则
@@ -15,7 +15,7 @@ import { OxlintRules } from "@longzai-intelligence-oxlint/core";
15
15
  *
16
16
  * 默认值来源:@longzai-intelligence-oxlint/core 的 oxlintDefaults
17
17
  */
18
- declare const ESLINT_CORE_RULES: Record<string, import("@longzai-intelligence-oxlint/core").OxlintRuleConfig>;
18
+ declare const ESLINT_CORE_RULES: Record<string, OxlintRuleConfig>;
19
19
  //#endregion
20
20
  //#region src/rules/typescript-eslint.rules.d.ts
21
21
  /**
@@ -57,6 +57,6 @@ declare const TYPESCRIPT_PROJECT_RULES: OxlintRules;
57
57
  *
58
58
  * 默认值来源:@longzai-intelligence-oxlint/core 的 unicornDefaults
59
59
  */
60
- declare const UNICORN_RULES: Record<string, import("@longzai-intelligence-oxlint/core").OxlintRuleConfig>;
60
+ declare const UNICORN_RULES: Record<string, OxlintRuleConfig>;
61
61
  //#endregion
62
62
  export { ESLINT_CORE_RULES as a, TYPESCRIPT_RECOMMENDED_RULES as i, ESLINT_RECOMMENDED_RULES as n, TYPESCRIPT_PROJECT_RULES as r, UNICORN_RULES as t };