@longzai-intelligence-oxlint/presets 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,8 @@ Longzai Intelligence Oxlint 的通用预设包,为不同技术栈项目提供
8
8
 
9
9
  ## 能力
10
10
 
11
- - 多技术栈预设 defineConfig 入口:base、node、react、nest、electron、library、next、hono、mcp、taro、expo 等
11
+ - 多技术栈预设 defineConfig 入口:base、node、react、nest、electron、library、next、hono、mcp、taro、expo、root 等
12
12
  - 各预设的默认插件、规则覆盖与特殊文件模式(如 Next.js 特殊文件)
13
+ - monorepo 根目录预设 root:白名单模式默认只检查根目录固定配置文件与 `lzi-*.config.ts` 全族
13
14
  - 原生规则集聚合导出:eslint-core、typescript-eslint、unicorn、import 等,供外部按需引用
14
15
  - 预设间经共享 base 派生
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";import"./rolldown-runtime-BqT_7tdF-BqT_7tdF.js";import"./rolldown-runtime-BqT_7tdF-DsHBzDG-.js";import"./rolldown-runtime-BqT_7tdF-BT7sSRF3.js";import{i as e,n as t}from"./typescript-eslint.rules-j0Y80OGu.js";import{existsSync as n,readFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";import{fileURLToPath as o}from"node:url";import{VITEST_CONFIG_EXPORT_NAMES as s}from"@longzai-intelligence-vitest/config/meta";const c=[`!lzi-*.config.ts`,`!lzi-*.config.mts`];function l(e){return[...e.filter(e=>!c.includes(e)),...c]}const u=[{files:[`**/*.d.ts`],rules:{"typescript/consistent-type-definitions":`off`}},{files:[`**/*.tsx`],rules:{"max-lines-per-function":[`error`,{max:100,skipBlankLines:!0,skipComments:!0}]}},{files:[`**/*.test.ts`,`**/*.test.tsx`,`**/*.spec.ts`,`**/*.spec.tsx`,`test/**/*.ts`,`test/**/*.tsx`,`**/__tests__/**/*.ts`,`**/__tests__/**/*.tsx`,`**/__mocks__/**/*.ts`,`**/__mocks__/**/*.tsx`,`**/vitest.setup.ts`],rules:{"max-lines":[`error`,{max:750,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":`off`,"@longzai-intelligence-oxlint/typescript-eslint-plugin/consistent-type-assertions":`off`,"typescript/no-non-null-assertion":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-tsdoc":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-param":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-param-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-type-param":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-description-tag":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/param-hyphen-format":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-blank-line-before-tags":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/separator-format":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/todo-format":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws-type":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-deprecated-alternative":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-legacy-jsdoc-tags":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-placeholder-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-commented-code":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-multiline-property-comment":`off`}},{files:[`**/lzi-kol-markdown.config.ts`,`**/lzi-rss-markdown.config.ts`,`**/lzi-nation-data.config.ts`,`**/lzi-youtube.config.ts`,`**/lzi-task.config.ts`,`**/lzi-okr.config.ts`,`**/lzi-roadmap.config.ts`],rules:{"@longzai-intelligence-oxlint/lzi-config-plugin/require-define-config":`off`}},{files:[`**/__tests__/helpers/setup.ts`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`off`}},{files:[`**/scripts/**`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`off`}}],d=[{shortName:`code-style`,packageName:`@longzai-intelligence-oxlint/code-style-plugin`},{shortName:`composer`,packageName:`@longzai-intelligence-oxlint/composer-plugin`},{shortName:`design-rules`,packageName:`@longzai-intelligence-oxlint/design-rules-plugin`},{shortName:`package-json`,packageName:`@longzai-intelligence-oxlint/package-json-plugin`},{shortName:`schema-type-separation`,packageName:`@longzai-intelligence-oxlint/schema-type-separation-plugin`},{shortName:`architecture-core`,packageName:`@longzai-intelligence-oxlint/architecture-core-plugin`},{shortName:`architecture-library`,packageName:`@longzai-intelligence-oxlint/architecture-library-plugin`},{shortName:`react`,packageName:`@longzai-intelligence-oxlint/react-plugin`},{shortName:`tsdoc`,packageName:`@longzai-intelligence-oxlint/tsdoc-plugin`},{shortName:`stylistic`,packageName:`@longzai-intelligence-oxlint/stylistic-plugin`},{shortName:`perfectionist`,packageName:`@longzai-intelligence-oxlint/perfectionist-plugin`},{shortName:`typescript-eslint`,packageName:`@longzai-intelligence-oxlint/typescript-eslint-plugin`},{shortName:`typeorm`,packageName:`@longzai-intelligence-oxlint/typeorm-plugin`},{shortName:`zod`,packageName:`@longzai-intelligence-oxlint/zod-plugin`},{shortName:`file-naming`,packageName:`@longzai-intelligence-oxlint/file-naming-plugin`},{shortName:`tsconfig`,packageName:`@longzai-intelligence-oxlint/tsconfig-plugin`},{shortName:`eslint-config`,packageName:`@longzai-intelligence-oxlint/eslint-config-plugin`},{shortName:`lzi-builder-config`,packageName:`@longzai-intelligence-oxlint/lzi-builder-config-plugin`},{shortName:`lzi-config`,packageName:`@longzai-intelligence-oxlint/lzi-config-plugin`},{shortName:`tsdown-config`,packageName:`@longzai-intelligence-oxlint/tsdown-config-plugin`},{shortName:`tsup-config`,packageName:`@longzai-intelligence-oxlint/tsup-config-plugin`},{shortName:`vitest-config`,packageName:`@longzai-intelligence-oxlint/vitest-config-plugin`},{shortName:`architecture-electron`,packageName:`@longzai-intelligence-oxlint/architecture-electron-plugin`},{shortName:`elysia-route`,packageName:`@longzai-intelligence-oxlint/elysia-route-plugin`},{shortName:`nestjs-route`,packageName:`@longzai-intelligence-oxlint/nestjs-route-plugin`}],f=[`code-style`,`composer`,`design-rules`,`package-json`,`schema-type-separation`,`architecture-core`,`architecture-library`,`react`,`tsdoc`,`stylistic`,`perfectionist`,`typescript-eslint`,`typeorm`,`zod`,`file-naming`,`tsconfig`,`eslint-config`,`lzi-builder-config`,`lzi-config`,`tsdown-config`,`tsup-config`,`vitest-config`],p=`@longzai-intelligence-oxlint/presets`;function m(e){let t=i(o(e));for(;;){let e=a(t,`package.json`);if(n(e))try{if(JSON.parse(r(e,`utf8`)).name===p)return t}catch{}let o=i(t);if(o===t)throw Error(`未能定位 \`${p}\` 包根,内置插件路径解析失败`);t=o}}const h=m(import.meta.url);function g(e){if(!d.some(t=>t.shortName===e))throw Error(`未登记的内置插件短名 \`${e}\`,请先补录 bundled-plugins 清单`);return a(h,`dist`,`plugins`,`${e}.js`)}function _(){return f.map(e=>g(e))}const v=_(),y={"import/no-relative-parent-imports":`error`},b={"@longzai-intelligence-oxlint/tsup-config-plugin/require-tsup-config-import":[`error`,{configPackagePath:`@longzai-intelligence-config/core/tsup`}],"@longzai-intelligence-oxlint/tsdown-config-plugin/require-tsdown-config-import":[`error`,{configPackagePath:`@longzai-intelligence-tsdown/core`,correctPresetNames:[`defineDomainImplementationConfig`,`defineDomainContractConfig`,`defineSharedKernelConfig`,`defineReactComponentsConfig`,`defineConfigPackageConfig`,`definePackageConfig`]}],"@longzai-intelligence-oxlint/vitest-config-plugin/require-vitest-config-import":[`error`,{configPackagePaths:[`@longzai-intelligence-config/core/vitest`,`@longzai-intelligence-vitest/config`],allowedExportNames:s,forbiddenExportNames:[`defineConfig`],excludedPaths:[`infrastructure/configs/vitest/vitest.config.ts`]}],"@longzai-intelligence-oxlint/eslint-config-plugin/require-eslint-config-import":[`error`,{configPackagePath:`@longzai-intelligence-config/core/eslint`,allowedCreateFunctions:[`createLibraryConfig`,`createDomainConfig`,`createReactConfig`,`createReactPluginConfig`,`createElectronConfig`,`createNextConfig`,`createNodeConfig`,`createMcpConfig`,`createNestConfig`,`createHonoConfig`,`createExpoConfig`],forbiddenDefaultExports:[`coreConfig`,`createCoreConfig`,`libraryConfig`,`domainConfig`,`reactConfig`,`electronConfig`,`nextConfig`,`nodeConfig`,`mcpConfig`,`nestConfig`,`honoConfig`,`expoConfig`]}]},x={"@longzai-intelligence-oxlint/architecture-core-plugin/business-leak":`off`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-cross-package-relative-import":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/implementation-export-control":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-implementation-import-in-apps":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/domain-export-compliance":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/dependency-direction":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-raw-network-call-in-ui":`error`},S={"@longzai-intelligence-oxlint/code-style-plugin/no-inline-type-definition":`error`,"@longzai-intelligence-oxlint/code-style-plugin/prefer-split-export-const":`off`,"@longzai-intelligence-oxlint/code-style-plugin/require-interface-naming":`off`,"@longzai-intelligence-oxlint/code-style-plugin/require-dto-naming":`error`,"@longzai-intelligence-oxlint/code-style-plugin/require-class-suffix":`error`,"@longzai-intelligence-oxlint/code-style-plugin/no-class-suffix-alias":`error`,"@longzai-intelligence-oxlint/code-style-plugin/no-console":`error`,"@longzai-intelligence-oxlint/code-style-plugin/no-handwritten-shebang":`error`},C={"@longzai-intelligence-oxlint/composer-plugin/define-capability-validity":`error`,"@longzai-intelligence-oxlint/composer-plugin/inject-graph-acyclic":`error`},w={"@longzai-intelligence-oxlint/design-rules-plugin/no-hardcoded-color":`error`,"@longzai-intelligence-oxlint/design-rules-plugin/no-hardcoded-spacing":`error`,"@longzai-intelligence-oxlint/design-rules-plugin/no-magic-z-index":`error`},T={"@longzai-intelligence-oxlint/eslint-config-plugin/require-eslint-config-import":`error`},E={"@longzai-intelligence-oxlint/file-naming-plugin/file-naming":`error`,"@longzai-intelligence-oxlint/file-naming-plugin/require-type-naming":`error`,"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`error`},D={"@longzai-intelligence-oxlint/lzi-builder-config-plugin/require-bin-banner":`error`,"@longzai-intelligence-oxlint/lzi-builder-config-plugin/require-version-injection":`error`},O={"@longzai-intelligence-oxlint/lzi-config-plugin/no-empty-define-config":`error`,"@longzai-intelligence-oxlint/lzi-config-plugin/require-define-config":`error`},k={"@longzai-intelligence-oxlint/package-json-plugin/no-app-infrastructure-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-bare-tsgo-invocation":`warn`,"@longzai-intelligence-oxlint/package-json-plugin/no-domain-layer-subpath-export":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-hoistable-dev-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-mit-license":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-sibling-implementation-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-src-exports":`warn`,"@longzai-intelligence-oxlint/package-json-plugin/no-ui-domain-package-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/require-full-project-bin-name":`warn`},A={"@longzai-intelligence-oxlint/perfectionist-plugin/sort-imports":`error`,"@longzai-intelligence-oxlint/perfectionist-plugin/sort-named-imports":`error`},j={"@longzai-intelligence-oxlint/react-plugin/no-incorrect-hook-naming":`error`},M={"@longzai-intelligence-oxlint/schema-type-separation-plugin/no-type-in-schema":`off`,"@longzai-intelligence-oxlint/schema-type-separation-plugin/no-schema-in-types":`off`},N={"@longzai-intelligence-oxlint/stylistic-plugin/multiline-comment-style":`error`,"@longzai-intelligence-oxlint/stylistic-plugin/lines-around-comment":[`error`,{beforeBlockComment:!0,beforeLineComment:!1,allowBlockStart:!0,allowBlockEnd:!0,allowObjectStart:!0,allowObjectEnd:!0,allowArrayStart:!0,allowArrayEnd:!0,allowClassStart:!0,allowClassEnd:!0,allowInterfaceStart:!0,allowInterfaceEnd:!0,allowTypeStart:!0,allowTypeEnd:!0,allowEnumStart:!0,allowEnumEnd:!0,allowModuleStart:!0,allowModuleEnd:!0}],"@longzai-intelligence-oxlint/stylistic-plugin/padding-line-between-statements":`error`},P={"@longzai-intelligence-oxlint/tsconfig-plugin/tsconfig-references":`error`},F={"@longzai-intelligence-oxlint/tsdoc-plugin/require-tsdoc":[`error`,{checkAllVariables:!0}],"@longzai-intelligence-oxlint/tsdoc-plugin/require-param":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-param-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-type-param":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-description-tag":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/param-hyphen-format":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-blank-line-before-tags":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/separator-format":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/todo-format":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws-type":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-deprecated-alternative":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-legacy-jsdoc-tags":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-placeholder-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-commented-code":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-extra-param":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-multiline-property-comment":`error`},I={"@longzai-intelligence-oxlint/tsdown-config-plugin/require-tsdown-config-import":`error`},L={"@longzai-intelligence-oxlint/tsup-config-plugin/require-tsup-config-import":`error`},R={"@longzai-intelligence-oxlint/typeorm-plugin/no-string-entity-ref":`error`,"@longzai-intelligence-oxlint/typeorm-plugin/require-take-with-skip":`error`},z={"@longzai-intelligence-oxlint/typescript-eslint-plugin/consistent-type-assertions":`error`},B={"@longzai-intelligence-oxlint/vitest-config-plugin/require-vitest-config-import":`error`},V={"@longzai-intelligence-oxlint/zod-plugin/prefer-top-level-string-formats":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-int":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-finite":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-safe":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-step":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-is-finite":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-is-int":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-record-single-arg":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deprecated-error-params":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deprecated-format-methods":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-merge-method":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-superrefine":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-errors-property":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deprecated-object-methods":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-native-enum":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deep-partial":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-promise-schema":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-error-param":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-zod-namespace":`warn`,"@longzai-intelligence-oxlint/zod-plugin/consistent-schema-var-name":`warn`,"@longzai-intelligence-oxlint/zod-plugin/no-any-schema":`warn`,"@longzai-intelligence-oxlint/zod-plugin/no-throw-in-refine":`warn`,"@longzai-intelligence-oxlint/zod-plugin/prefer-safe-parse":`warn`,"@longzai-intelligence-oxlint/zod-plugin/prefer-meta":`warn`,"@longzai-intelligence-oxlint/zod-plugin/require-error-message":`warn`,"@longzai-intelligence-oxlint/zod-plugin/no-optional-and-default-together":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-enum-over-literal-union":`error`},H={...S,...C,...w,...k,...M,...x,...j,...F,...N,...A,...z,...R,...V,...E,...P,...T,...D,...O,...I,...L,...B},U={"@longzai-intelligence-oxlint/perfectionist-plugin/sort-imports":`off`,"@longzai-intelligence-oxlint/perfectionist-plugin/sort-named-imports":`off`,"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-top-level-string-formats":`off`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-int":`off`},W={...t,...y,...H,...b,...U};function G(t){return e({rules:{...W,...t?.rules},overrides:[...u,...t?.overrides??[]],jsPlugins:[...v],ignorePatterns:l(t?.ignorePatterns??[])})}const K=G();export{g as a,H as i,K as n,l as o,W as r,G as t};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import"./rolldown-runtime-BqT_7tdF-BqT_7tdF.js";import"./rolldown-runtime-BqT_7tdF-DsHBzDG-.js";import"./rolldown-runtime-BqT_7tdF-BT7sSRF3.js";import{i as e,n as t}from"./typescript-eslint.rules-j0Y80OGu.js";import{existsSync as n,readFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";import{fileURLToPath as o}from"node:url";import{VITEST_CONFIG_EXPORT_NAMES as s}from"@longzai-intelligence-vitest/config/meta";const c=[`!lzi-*.config.ts`,`!lzi-*.config.mts`];function l(e){return[...e.filter(e=>!c.includes(e)),...c]}const u=[{files:[`**/*.d.ts`],rules:{"typescript/consistent-type-definitions":`off`}},{files:[`**/*.tsx`],rules:{"max-lines-per-function":[`error`,{max:100,skipBlankLines:!0,skipComments:!0}]}},{files:[`**/*.test.ts`,`**/*.test.tsx`,`**/*.spec.ts`,`**/*.spec.tsx`,`test/**/*.ts`,`test/**/*.tsx`,`**/__tests__/**/*.ts`,`**/__tests__/**/*.tsx`,`**/__mocks__/**/*.ts`,`**/__mocks__/**/*.tsx`,`**/vitest.setup.ts`],rules:{"max-lines":[`error`,{max:750,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":`off`,"@longzai-intelligence-oxlint/typescript-eslint-plugin/consistent-type-assertions":`off`,"typescript/no-non-null-assertion":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-tsdoc":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-param":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-param-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-type-param":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-description-tag":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/param-hyphen-format":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-blank-line-before-tags":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/separator-format":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/todo-format":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws-type":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-deprecated-alternative":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-legacy-jsdoc-tags":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-placeholder-description":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-commented-code":`off`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-multiline-property-comment":`off`}},{files:[`**/lzi-kol-markdown.config.ts`,`**/lzi-rss-markdown.config.ts`,`**/lzi-nation-data.config.ts`,`**/lzi-youtube.config.ts`,`**/lzi-task.config.ts`,`**/lzi-okr.config.ts`,`**/lzi-roadmap.config.ts`],rules:{"@longzai-intelligence-oxlint/lzi-config-plugin/require-define-config":`off`}},{files:[`**/__tests__/helpers/setup.ts`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`off`}},{files:[`**/scripts/**`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`off`}}],d=[{shortName:`code-style`,packageName:`@longzai-intelligence-oxlint/code-style-plugin`},{shortName:`composer`,packageName:`@longzai-intelligence-oxlint/composer-plugin`},{shortName:`design-rules`,packageName:`@longzai-intelligence-oxlint/design-rules-plugin`},{shortName:`package-json`,packageName:`@longzai-intelligence-oxlint/package-json-plugin`},{shortName:`schema-type-separation`,packageName:`@longzai-intelligence-oxlint/schema-type-separation-plugin`},{shortName:`architecture-core`,packageName:`@longzai-intelligence-oxlint/architecture-core-plugin`},{shortName:`architecture-library`,packageName:`@longzai-intelligence-oxlint/architecture-library-plugin`},{shortName:`react`,packageName:`@longzai-intelligence-oxlint/react-plugin`},{shortName:`tsdoc`,packageName:`@longzai-intelligence-oxlint/tsdoc-plugin`},{shortName:`stylistic`,packageName:`@longzai-intelligence-oxlint/stylistic-plugin`},{shortName:`perfectionist`,packageName:`@longzai-intelligence-oxlint/perfectionist-plugin`},{shortName:`typescript-eslint`,packageName:`@longzai-intelligence-oxlint/typescript-eslint-plugin`},{shortName:`typeorm`,packageName:`@longzai-intelligence-oxlint/typeorm-plugin`},{shortName:`zod`,packageName:`@longzai-intelligence-oxlint/zod-plugin`},{shortName:`file-naming`,packageName:`@longzai-intelligence-oxlint/file-naming-plugin`},{shortName:`tsconfig`,packageName:`@longzai-intelligence-oxlint/tsconfig-plugin`},{shortName:`eslint-config`,packageName:`@longzai-intelligence-oxlint/eslint-config-plugin`},{shortName:`lzi-builder-config`,packageName:`@longzai-intelligence-oxlint/lzi-builder-config-plugin`},{shortName:`lzi-config`,packageName:`@longzai-intelligence-oxlint/lzi-config-plugin`},{shortName:`tsdown-config`,packageName:`@longzai-intelligence-oxlint/tsdown-config-plugin`},{shortName:`tsup-config`,packageName:`@longzai-intelligence-oxlint/tsup-config-plugin`},{shortName:`vitest-config`,packageName:`@longzai-intelligence-oxlint/vitest-config-plugin`},{shortName:`architecture-electron`,packageName:`@longzai-intelligence-oxlint/architecture-electron-plugin`},{shortName:`elysia-route`,packageName:`@longzai-intelligence-oxlint/elysia-route-plugin`},{shortName:`nestjs-route`,packageName:`@longzai-intelligence-oxlint/nestjs-route-plugin`}],f=[`code-style`,`composer`,`design-rules`,`package-json`,`schema-type-separation`,`architecture-core`,`architecture-library`,`react`,`tsdoc`,`stylistic`,`perfectionist`,`typescript-eslint`,`typeorm`,`zod`,`file-naming`,`tsconfig`,`eslint-config`,`lzi-builder-config`,`lzi-config`,`tsdown-config`,`tsup-config`,`vitest-config`],p=`@longzai-intelligence-oxlint/presets`;function m(e){let t=i(o(e));for(;;){let e=a(t,`package.json`);if(n(e))try{if(JSON.parse(r(e,`utf8`)).name===p)return t}catch{}let o=i(t);if(o===t)throw Error(`未能定位 \`${p}\` 包根,内置插件路径解析失败`);t=o}}const h=m(import.meta.url);function g(e){if(!d.some(t=>t.shortName===e))throw Error(`未登记的内置插件短名 \`${e}\`,请先补录 bundled-plugins 清单`);return a(h,`dist`,`plugins`,`${e}.js`)}function _(){return f.map(e=>g(e))}const v=_(),y={"import/no-relative-parent-imports":`error`},b={"@longzai-intelligence-oxlint/tsup-config-plugin/require-tsup-config-import":[`error`,{configPackagePath:`@longzai-intelligence-config/core/tsup`}],"@longzai-intelligence-oxlint/tsdown-config-plugin/require-tsdown-config-import":[`error`,{configPackagePath:`@longzai-intelligence-tsdown/core`,correctPresetNames:[`defineDomainImplementationConfig`,`defineDomainContractConfig`,`defineSharedKernelConfig`,`defineReactComponentsConfig`,`defineConfigPackageConfig`,`definePackageConfig`]}],"@longzai-intelligence-oxlint/vitest-config-plugin/require-vitest-config-import":[`error`,{configPackagePaths:[`@longzai-intelligence-config/core/vitest`,`@longzai-intelligence-vitest/config`],allowedExportNames:s,forbiddenExportNames:[`defineConfig`],excludedPaths:[`infrastructure/configs/vitest/vitest.config.ts`]}],"@longzai-intelligence-oxlint/eslint-config-plugin/require-eslint-config-import":[`error`,{configPackagePath:`@longzai-intelligence-config/core/eslint`,allowedCreateFunctions:[`createLibraryConfig`,`createDomainConfig`,`createReactConfig`,`createReactPluginConfig`,`createElectronConfig`,`createNextConfig`,`createNodeConfig`,`createMcpConfig`,`createNestConfig`,`createHonoConfig`,`createExpoConfig`],forbiddenDefaultExports:[`coreConfig`,`createCoreConfig`,`libraryConfig`,`domainConfig`,`reactConfig`,`electronConfig`,`nextConfig`,`nodeConfig`,`mcpConfig`,`nestConfig`,`honoConfig`,`expoConfig`]}]},x={"@longzai-intelligence-oxlint/architecture-core-plugin/business-leak":`off`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-cross-package-relative-import":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/implementation-export-control":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-implementation-import-in-apps":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/domain-export-compliance":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/dependency-direction":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-raw-network-call-in-ui":`error`},S={"@longzai-intelligence-oxlint/code-style-plugin/no-inline-type-definition":`error`,"@longzai-intelligence-oxlint/code-style-plugin/prefer-split-export-const":`off`,"@longzai-intelligence-oxlint/code-style-plugin/require-interface-naming":`off`,"@longzai-intelligence-oxlint/code-style-plugin/require-dto-naming":`error`,"@longzai-intelligence-oxlint/code-style-plugin/require-class-suffix":`error`,"@longzai-intelligence-oxlint/code-style-plugin/no-class-suffix-alias":`error`,"@longzai-intelligence-oxlint/code-style-plugin/no-console":`error`,"@longzai-intelligence-oxlint/code-style-plugin/no-handwritten-shebang":`error`},C={"@longzai-intelligence-oxlint/composer-plugin/define-capability-validity":`error`,"@longzai-intelligence-oxlint/composer-plugin/inject-graph-acyclic":`error`},w={"@longzai-intelligence-oxlint/design-rules-plugin/no-hardcoded-color":`error`,"@longzai-intelligence-oxlint/design-rules-plugin/no-hardcoded-spacing":`error`,"@longzai-intelligence-oxlint/design-rules-plugin/no-magic-z-index":`error`},T={"@longzai-intelligence-oxlint/eslint-config-plugin/require-eslint-config-import":`error`},E={"@longzai-intelligence-oxlint/file-naming-plugin/file-naming":`error`,"@longzai-intelligence-oxlint/file-naming-plugin/require-type-naming":`error`,"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`error`},D={"@longzai-intelligence-oxlint/lzi-builder-config-plugin/require-bin-banner":`error`,"@longzai-intelligence-oxlint/lzi-builder-config-plugin/require-version-injection":`error`},O={"@longzai-intelligence-oxlint/lzi-config-plugin/no-empty-define-config":`error`,"@longzai-intelligence-oxlint/lzi-config-plugin/require-define-config":`error`},k={"@longzai-intelligence-oxlint/package-json-plugin/no-app-infrastructure-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-bare-tsgo-invocation":`warn`,"@longzai-intelligence-oxlint/package-json-plugin/no-domain-layer-subpath-export":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-hoistable-dev-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-mit-license":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-sibling-implementation-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/no-src-exports":`warn`,"@longzai-intelligence-oxlint/package-json-plugin/no-ui-domain-package-dependency":`error`,"@longzai-intelligence-oxlint/package-json-plugin/require-full-project-bin-name":`warn`},A={"@longzai-intelligence-oxlint/perfectionist-plugin/sort-imports":`error`,"@longzai-intelligence-oxlint/perfectionist-plugin/sort-named-imports":`error`},j={"@longzai-intelligence-oxlint/react-plugin/no-incorrect-hook-naming":`error`},M={"@longzai-intelligence-oxlint/schema-type-separation-plugin/no-type-in-schema":`off`,"@longzai-intelligence-oxlint/schema-type-separation-plugin/no-schema-in-types":`off`},N={"@longzai-intelligence-oxlint/stylistic-plugin/multiline-comment-style":`error`,"@longzai-intelligence-oxlint/stylistic-plugin/lines-around-comment":[`error`,{beforeBlockComment:!0,beforeLineComment:!1,allowBlockStart:!0,allowBlockEnd:!0,allowObjectStart:!0,allowObjectEnd:!0,allowArrayStart:!0,allowArrayEnd:!0,allowClassStart:!0,allowClassEnd:!0,allowInterfaceStart:!0,allowInterfaceEnd:!0,allowTypeStart:!0,allowTypeEnd:!0,allowEnumStart:!0,allowEnumEnd:!0,allowModuleStart:!0,allowModuleEnd:!0}],"@longzai-intelligence-oxlint/stylistic-plugin/padding-line-between-statements":`error`},P={"@longzai-intelligence-oxlint/tsconfig-plugin/tsconfig-references":`error`},F={"@longzai-intelligence-oxlint/tsdoc-plugin/require-tsdoc":[`error`,{checkAllVariables:!0}],"@longzai-intelligence-oxlint/tsdoc-plugin/require-param":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-param-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-returns-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-type-param":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-description-tag":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/param-hyphen-format":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-blank-line-before-tags":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/separator-format":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/todo-format":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-throws-type":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-deprecated-alternative":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-legacy-jsdoc-tags":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-placeholder-description":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-commented-code":`warn`,"@longzai-intelligence-oxlint/tsdoc-plugin/no-extra-param":`error`,"@longzai-intelligence-oxlint/tsdoc-plugin/require-multiline-property-comment":`error`},I={"@longzai-intelligence-oxlint/tsdown-config-plugin/require-tsdown-config-import":`error`},L={"@longzai-intelligence-oxlint/tsup-config-plugin/require-tsup-config-import":`error`},R={"@longzai-intelligence-oxlint/typeorm-plugin/no-string-entity-ref":`error`,"@longzai-intelligence-oxlint/typeorm-plugin/require-take-with-skip":`error`},z={"@longzai-intelligence-oxlint/typescript-eslint-plugin/consistent-type-assertions":`error`},B={"@longzai-intelligence-oxlint/vitest-config-plugin/require-vitest-config-import":`error`},V={"@longzai-intelligence-oxlint/zod-plugin/prefer-top-level-string-formats":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-int":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-finite":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-safe":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-step":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-is-finite":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-number-schema-with-is-int":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-record-single-arg":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deprecated-error-params":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deprecated-format-methods":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-merge-method":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-superrefine":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-errors-property":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deprecated-object-methods":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-native-enum":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-deep-partial":`error`,"@longzai-intelligence-oxlint/zod-plugin/no-promise-schema":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-error-param":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-zod-namespace":`warn`,"@longzai-intelligence-oxlint/zod-plugin/consistent-schema-var-name":`warn`,"@longzai-intelligence-oxlint/zod-plugin/no-any-schema":`warn`,"@longzai-intelligence-oxlint/zod-plugin/no-throw-in-refine":`warn`,"@longzai-intelligence-oxlint/zod-plugin/prefer-safe-parse":`warn`,"@longzai-intelligence-oxlint/zod-plugin/prefer-meta":`warn`,"@longzai-intelligence-oxlint/zod-plugin/require-error-message":`warn`,"@longzai-intelligence-oxlint/zod-plugin/no-optional-and-default-together":`error`,"@longzai-intelligence-oxlint/zod-plugin/prefer-enum-over-literal-union":`error`},H={...S,...C,...w,...k,...M,...x,...j,...F,...N,...A,...z,...R,...V,...E,...P,...T,...D,...O,...I,...L,...B},U={"@longzai-intelligence-oxlint/perfectionist-plugin/sort-imports":`off`,"@longzai-intelligence-oxlint/perfectionist-plugin/sort-named-imports":`off`,"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":`error`},W={...t,...y,...H,...b,...U};function G(t){return e({rules:{...W,...t?.rules},overrides:[...u,...t?.overrides??[]],jsPlugins:[...v],ignorePatterns:l(t?.ignorePatterns??[])})}const K=G();export{g as a,H as i,K as n,c as o,W as r,l as s,G as t};
package/dist/base.js CHANGED
@@ -1 +1 @@
1
- export{n as default,t as defineConfig}from"./base.entry-BRRJVhQW.js";
1
+ export{n as default,t as defineConfig}from"./base.entry-bAMXAIU8.js";
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";import{a as e,o as t}from"./base.entry-BRRJVhQW.js";import{defineConfig as n}from"./react.js";const r=[{files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/architecture-electron-plugin/no-custom-ipc-utility":`error`,"@longzai-intelligence-oxlint/architecture-electron-plugin/no-implementation-in-renderer":`error`,"@longzai-intelligence-oxlint/architecture-electron-plugin/platform-leak":`error`}}];function i(i){let a=n();return{extends:[a],jsPlugins:[e(`architecture-electron`)],overrides:[...r,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:t([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as n,i as t};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t}from"./base.entry-bAMXAIU8.js";import{defineConfig as n}from"./react.js";const r=[{files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/architecture-electron-plugin/no-custom-ipc-utility":`error`,"@longzai-intelligence-oxlint/architecture-electron-plugin/no-implementation-in-renderer":`error`,"@longzai-intelligence-oxlint/architecture-electron-plugin/platform-leak":`error`}}];function i(i){let a=n();return{extends:[a],jsPlugins:[e(`architecture-electron`)],overrides:[...r,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:t([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as n,i as t};
package/dist/electron.js CHANGED
@@ -1 +1 @@
1
- import"./react.js";export{n as default,t as defineConfig}from"./electron.entry-DGTGFrW5.js";
1
+ import"./react.js";export{n as default,t as defineConfig}from"./electron.entry-BWHoM-tJ.js";
package/dist/elysia.js CHANGED
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";import{a as e,o as t,t as n}from"./base.entry-BRRJVhQW.js";import"./node.js";const r=[{files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/elysia-route-plugin/no-bare-route-path":`error`}}];function i(i){let a=n();return{extends:[a],jsPlugins:[e(`elysia-route`)],overrides:[...r,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:t([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as default,i as defineConfig};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t,t as n}from"./base.entry-bAMXAIU8.js";import"./node.js";const r=[{files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/elysia-route-plugin/no-bare-route-path":`error`}}];function i(i){let a=n();return{extends:[a],jsPlugins:[e(`elysia-route`)],overrides:[...r,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:t([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as default,i as defineConfig};
package/dist/expo.js CHANGED
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-BRRJVhQW.js";
1
+ import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-bAMXAIU8.js";
@@ -1 +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=[`app/routes.ts`,`app/routes/**`],r=[`app/root.tsx`,`app/routes/**`];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
+ import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-bAMXAIU8.js";import{defineConfig as t}from"./react.js";const n=[`app/routes.ts`,`app/routes/**`],r=[`app/root.tsx`,`app/routes/**`];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};
package/dist/fumadocs.js CHANGED
@@ -1 +1 @@
1
- import"./react.js";export{r as FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS,i as FUMADOCS_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./fumadocs.entry-oZq7iczh.js";
1
+ import"./react.js";export{r as FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS,i as FUMADOCS_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./fumadocs.entry-C1vWVCGC.js";
package/dist/hono.js CHANGED
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-BRRJVhQW.js";import"./node.js";
1
+ import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-bAMXAIU8.js";import"./node.js";
package/dist/index.d.ts CHANGED
@@ -8,7 +8,8 @@ import { defineConfig as defineConfig$3 } from "./library.js";
8
8
  import { defineConfig as defineConfig$4 } from "./nest.js";
9
9
  import { r as NEXTJS_SPECIAL_FILE_PATTERNS, t as defineConfig$5 } from "./next.entry-moZEmUkw.js";
10
10
  import { defineConfig as defineConfig$6 } from "./react.js";
11
- import { t as defineConfig$7 } from "./taro.entry-DuohnWen.js";
11
+ import { r as ROOT_WHITELIST_PATTERNS, t as defineConfig$7 } from "./root.entry-D3HRGFNj.js";
12
+ import { t as defineConfig$8 } from "./taro.entry-DuohnWen.js";
12
13
  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";
13
14
  //#region src/defaults/base.rules.d.ts
14
15
  /**
@@ -25,4 +26,4 @@ declare const PLUGIN_DEFAULTS: OxlintRules;
25
26
  */
26
27
  declare const ALL_RULES: OxlintRules;
27
28
  //#endregion
28
- export { ALL_RULES, ESLINT_CORE_RULES, ESLINT_RECOMMENDED_RULES, FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS, FUMADOCS_SPECIAL_FILE_PATTERNS, NEXTJS_SPECIAL_FILE_PATTERNS, type OxlintConfig, type OxlintConfigOverride, type OxlintRuleConfig, type OxlintRules, PLUGIN_DEFAULTS, type PresetOptions, TYPESCRIPT_PROJECT_RULES, TYPESCRIPT_RECOMMENDED_RULES, UNICORN_RULES, defineConfig as defineBaseConfig, defineConfig as defineExpoConfig, defineConfig as defineHonoConfig, defineConfig as defineMcpConfig, defineConfig as defineNodeConfig, defineConfig$1 as defineElectronConfig, defineConfig$2 as defineFumadocsConfig, defineConfig$3 as defineLibraryConfig, defineConfig$4 as defineNestConfig, defineConfig$5 as defineNextConfig, defineConfig$6 as defineReactConfig, defineConfig$7 as defineTaroConfig };
29
+ export { ALL_RULES, ESLINT_CORE_RULES, ESLINT_RECOMMENDED_RULES, FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS, FUMADOCS_SPECIAL_FILE_PATTERNS, NEXTJS_SPECIAL_FILE_PATTERNS, type OxlintConfig, type OxlintConfigOverride, type OxlintRuleConfig, type OxlintRules, PLUGIN_DEFAULTS, type PresetOptions, ROOT_WHITELIST_PATTERNS, TYPESCRIPT_PROJECT_RULES, TYPESCRIPT_RECOMMENDED_RULES, UNICORN_RULES, defineConfig as defineBaseConfig, defineConfig as defineExpoConfig, defineConfig as defineHonoConfig, defineConfig as defineMcpConfig, defineConfig as defineNodeConfig, defineConfig$1 as defineElectronConfig, defineConfig$2 as defineFumadocsConfig, defineConfig$3 as defineLibraryConfig, defineConfig$4 as defineNestConfig, defineConfig$5 as defineNextConfig, defineConfig$6 as defineReactConfig, defineConfig$7 as defineRootConfig, defineConfig$8 as defineTaroConfig };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";import{n as e,r as t,t as n}from"./typescript-eslint.rules-j0Y80OGu.js";import{i as r,r as i,t as a}from"./base.entry-BRRJVhQW.js";import"./node.js";import{defineConfig as o}from"./react.js";import"./hono.js";import"./mcp.js";import{r as s,t as c}from"./next.entry-BAw82S0g.js";import{t as l}from"./taro.entry-CHCKR0fA.js";import{i as u,r as d,t as f}from"./fumadocs.entry-oZq7iczh.js";import"./expo.js";import{t as p}from"./nest.entry-DHYBO2a1.js";import{t as m}from"./electron.entry-DGTGFrW5.js";import{t as h}from"./library.entry-CRtfr5d4.js";import{n as g,t as _}from"./unicorn.rules-0a_FuIjL.js";export{i as ALL_RULES,g as ESLINT_CORE_RULES,n as ESLINT_RECOMMENDED_RULES,d as FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS,u as FUMADOCS_SPECIAL_FILE_PATTERNS,s as NEXTJS_SPECIAL_FILE_PATTERNS,r as PLUGIN_DEFAULTS,e as TYPESCRIPT_PROJECT_RULES,t as TYPESCRIPT_RECOMMENDED_RULES,_ as UNICORN_RULES,a as defineBaseConfig,a as defineExpoConfig,a as defineHonoConfig,a as defineMcpConfig,a as defineNodeConfig,m as defineElectronConfig,f as defineFumadocsConfig,h as defineLibraryConfig,p as defineNestConfig,c as defineNextConfig,o as defineReactConfig,l as defineTaroConfig};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{n as e,r as t,t as n}from"./typescript-eslint.rules-j0Y80OGu.js";import{i as r,r as i,t as a}from"./base.entry-bAMXAIU8.js";import"./node.js";import{defineConfig as o}from"./react.js";import"./hono.js";import"./mcp.js";import{r as s,t as c}from"./next.entry-BgpZ3pCS.js";import{t as l}from"./taro.entry-CmsbeE26.js";import{i as u,r as d,t as f}from"./fumadocs.entry-C1vWVCGC.js";import"./expo.js";import{t as p}from"./nest.entry-tQzm7oCQ.js";import{t as m}from"./electron.entry-BWHoM-tJ.js";import{t as h}from"./library.entry-D6WP-Es6.js";import{r as g,t as _}from"./root.entry-BBvHr7IZ.js";import{n as v,t as y}from"./unicorn.rules-0a_FuIjL.js";export{i as ALL_RULES,v as ESLINT_CORE_RULES,n as ESLINT_RECOMMENDED_RULES,d as FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS,u as FUMADOCS_SPECIAL_FILE_PATTERNS,s as NEXTJS_SPECIAL_FILE_PATTERNS,r as PLUGIN_DEFAULTS,g as ROOT_WHITELIST_PATTERNS,e as TYPESCRIPT_PROJECT_RULES,t as TYPESCRIPT_RECOMMENDED_RULES,y as UNICORN_RULES,a as defineBaseConfig,a as defineExpoConfig,a as defineHonoConfig,a as defineMcpConfig,a as defineNodeConfig,m as defineElectronConfig,f as defineFumadocsConfig,h as defineLibraryConfig,p as defineNestConfig,c as defineNextConfig,o as defineReactConfig,_ as defineRootConfig,l as defineTaroConfig};
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";import{a as e,o as t,t as n}from"./base.entry-BRRJVhQW.js";const r={"@longzai-intelligence-oxlint/architecture-library-plugin/test-file-placement":`error`,"@longzai-intelligence-oxlint/architecture-library-plugin/no-non-test-files-in-tests-directory":`error`,"@longzai-intelligence-oxlint/architecture-library-plugin/test-file-matches-source":`error`},i={"@longzai-intelligence-oxlint/architecture-library-plugin/test-file-matches-source":[`error`,{testTypeSubdirs:[`unit`,`integration`,`e2e`],enableGlobalSearch:!0}]};function a(a){let o={files:[`**/*.ts`],rules:{...r,...i,...a?.rules}},s=n();return{extends:[s],jsPlugins:[e(`architecture-library`)],overrides:[o,...a?.overrides??[]],ignorePatterns:t([...s.ignorePatterns??[],...a?.ignorePatterns??[]])}}const o=a();export{o as n,a as t};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t,t as n}from"./base.entry-bAMXAIU8.js";const r={"@longzai-intelligence-oxlint/architecture-library-plugin/test-file-placement":`error`,"@longzai-intelligence-oxlint/architecture-library-plugin/no-non-test-files-in-tests-directory":`error`,"@longzai-intelligence-oxlint/architecture-library-plugin/test-file-matches-source":`error`},i={"@longzai-intelligence-oxlint/architecture-library-plugin/test-file-matches-source":[`error`,{testTypeSubdirs:[`unit`,`integration`,`e2e`],enableGlobalSearch:!0}]};function a(a){let o={files:[`**/*.ts`],rules:{...r,...i,...a?.rules}},s=n();return{extends:[s],jsPlugins:[e(`architecture-library`)],overrides:[o,...a?.overrides??[]],ignorePatterns:t([...s.ignorePatterns??[],...a?.ignorePatterns??[]])}}const o=a();export{o as n,a as t};
package/dist/library.js CHANGED
@@ -1 +1 @@
1
- export{n as default,t as defineConfig}from"./library.entry-CRtfr5d4.js";
1
+ export{n as default,t as defineConfig}from"./library.entry-D6WP-Es6.js";
package/dist/mcp.js CHANGED
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-BRRJVhQW.js";import"./node.js";
1
+ import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-bAMXAIU8.js";import"./node.js";
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";import{a as e,o as t,t as n}from"./base.entry-BRRJVhQW.js";import"./node.js";const r=[{files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/nestjs-route-plugin/order":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/no-duplicates":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/require-route-constant":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/prefer-typed-controller":`warn`,"@longzai-intelligence-oxlint/nestjs-route-plugin/require-typed-response":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/enforce-typed-handler-return":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-restricted-import-in-paths":[`error`,{restrictions:[{importSource:`@nestjs/common`,importNames:[`BadRequestException`,`NotFoundException`,`ForbiddenException`,`UnauthorizedException`,`ConflictException`,`HttpException`],forbiddenPaths:[`*.service.ts`],message:`Service 层禁止导入 NestJS HTTP 异常,请使用 Result<T, DomainError> 透传领域错误,由 Handler 层解包`}]}]}}];function i(i){let a=n();return{extends:[a],jsPlugins:[e(`nestjs-route`)],overrides:[...r,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:t([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as n,i as t};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t,t as n}from"./base.entry-bAMXAIU8.js";import"./node.js";const r=[{files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/nestjs-route-plugin/order":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/no-duplicates":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/require-route-constant":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/prefer-typed-controller":`warn`,"@longzai-intelligence-oxlint/nestjs-route-plugin/require-typed-response":`error`,"@longzai-intelligence-oxlint/nestjs-route-plugin/enforce-typed-handler-return":`error`,"@longzai-intelligence-oxlint/architecture-core-plugin/no-restricted-import-in-paths":[`error`,{restrictions:[{importSource:`@nestjs/common`,importNames:[`BadRequestException`,`NotFoundException`,`ForbiddenException`,`UnauthorizedException`,`ConflictException`,`HttpException`],forbiddenPaths:[`*.service.ts`],message:`Service 层禁止导入 NestJS HTTP 异常,请使用 Result<T, DomainError> 透传领域错误,由 Handler 层解包`}]}]}}];function i(i){let a=n();return{extends:[a],jsPlugins:[e(`nestjs-route`)],overrides:[...r,...i?.overrides??[]],...i?.rules?{rules:i.rules}:{},ignorePatterns:t([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as n,i as t};
package/dist/nest.js CHANGED
@@ -1 +1 @@
1
- import"./node.js";export{n as default,t as defineConfig}from"./nest.entry-DHYBO2a1.js";
1
+ import"./node.js";export{n as default,t as defineConfig}from"./nest.entry-tQzm7oCQ.js";
@@ -1 +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=[`**/page.ts`,`**/layout.ts`,`**/loading.ts`,`**/error.ts`,`**/not-found.ts`,`**/template.ts`,`**/default.ts`,`**/global-error.ts`,`**/middleware.ts`,`**/route.ts`,`**/instrumentation.ts`],r=[`**/page.tsx`,`**/layout.tsx`,`**/loading.tsx`,`**/error.tsx`,`**/not-found.tsx`,`**/template.tsx`,`**/default.tsx`,`**/global-error.tsx`],i=[...n,...r];function a(n){let r=[...n?.typeSuffixBaseSkipPatterns??[],...i],a=[...n?.fileNamingBaseSkipPatterns??[],...i],o={files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":[`error`,{skipPatterns:r}]}},s={files:[`**/*.tsx`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/file-naming":[`error`,{skipPatterns:a}]}},c=t();return{extends:[c],plugins:[`nextjs`],overrides:[o,s,...n?.overrides??[]],...n?.rules?{rules:n.rules}:{},ignorePatterns:e([...c.ignorePatterns??[],...n?.ignorePatterns??[]])}}const o=a();export{o as n,i as r,a as t};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-bAMXAIU8.js";import{defineConfig as t}from"./react.js";const n=[`**/page.ts`,`**/layout.ts`,`**/loading.ts`,`**/error.ts`,`**/not-found.ts`,`**/template.ts`,`**/default.ts`,`**/global-error.ts`,`**/middleware.ts`,`**/route.ts`,`**/instrumentation.ts`],r=[`**/page.tsx`,`**/layout.tsx`,`**/loading.tsx`,`**/error.tsx`,`**/not-found.tsx`,`**/template.tsx`,`**/default.tsx`,`**/global-error.tsx`],i=[...n,...r];function a(n){let r=[...n?.typeSuffixBaseSkipPatterns??[],...i],a=[...n?.fileNamingBaseSkipPatterns??[],...i],o={files:[`**/*.ts`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/require-type-suffix":[`error`,{skipPatterns:r}]}},s={files:[`**/*.tsx`],rules:{"@longzai-intelligence-oxlint/file-naming-plugin/file-naming":[`error`,{skipPatterns:a}]}},c=t();return{extends:[c],plugins:[`nextjs`],overrides:[o,s,...n?.overrides??[]],...n?.rules?{rules:n.rules}:{},ignorePatterns:e([...c.ignorePatterns??[],...n?.ignorePatterns??[]])}}const o=a();export{o as n,i as r,a as t};
package/dist/next.js CHANGED
@@ -1 +1 @@
1
- import"./react.js";export{r as NEXTJS_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./next.entry-BAw82S0g.js";
1
+ import"./react.js";export{r as NEXTJS_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./next.entry-BgpZ3pCS.js";
package/dist/node.js CHANGED
@@ -1 +1 @@
1
- import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-BRRJVhQW.js";
1
+ import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-bAMXAIU8.js";
@@ -1 +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`,`bootstrap.ts`,`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};
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`,`scripts`,`script`],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===`scripts`||i===`script`?`脚本文件应以动词直接命名且不带后缀,置于包级 scripts 目录,如 scripts/migrate.ts、scripts/seed.ts`:`.${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`,`scripts`,`script`],H=/* @__PURE__ */ new Set([`index.ts`,`index.tsx`,`main.ts`,`main.tsx`,`App.tsx`,`bootstrap.ts`,`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};
@@ -2,8 +2,8 @@ import"../rolldown-runtime-BqT_7tdF.js";import{parseSeparatorComment as e}from".
2
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
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
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(`
5
+ `)}\n${t} */`}function q(e,t){let n=e.trim(),r=n.startsWith(`*`),i=r?n.slice(1).trim():n,a=r?`/**`:`/*`;return i?`${a}\n${t} * ${i}\n${t} */`:`${a}\n${t} */`}function J(e,t){let n=e.value.split(`
6
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(`
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(`*`),r=e.range[0]+2+t;n.push({message:`多行块注释的首行应在 "/*" 后换行`,loc:{start:{...e.loc.start},end:{...e.loc.end}},fix:{range:[r,r],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
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
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};
@@ -3,11 +3,17 @@ import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugi
3
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
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
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(`
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 ae(e){let t=e.description.trim();return t.length!==0&&t!==`-`&&t!==`--`}function oe(e){return p(e).map(e=>e.name.split(`.`)[0]).filter(e=>typeof e==`string`)}const se=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 ce=n.object({init:n.unknown()}),le=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 ue=n.record(n.string(),n.unknown()),de=n.object({type:n.enum([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`])});n.object({type:n.string(),params:n.array(n.unknown())});const fe=n.object({range:n.tuple([n.number(),n.number()])}),pe=n.object({range:n.tuple([n.number(),n.number()])}),me=n.object({range:n.tuple([n.number(),n.number()])}),he=n.object({id:n.object({name:n.string()})}),ge=n.object({key:n.object({name:n.string()})}),_e=n.object({declarations:n.array(n.unknown())}),ve=n.object({typeParameters:n.object({params:n.array(n.record(n.string(),n.unknown()))})}),ye=n.object({params:n.array(n.unknown())}),be=n.object({value:n.unknown()}),xe=n.object({declarations:n.array(n.unknown())});function g(e){return fe.safeParse(e).success}function _(e){return pe.safeParse(e).success}function v(e){return me.safeParse(e).success}function y(e){if(!g(e))return-1;if(`decorators`in e&&Array.isArray(e.decorators)&&e.decorators.length>0){let t=e.decorators[0];if(v(t))return t.range[0]}if(`parent`in e&&e.parent&&typeof e.parent==`object`){let t=e.parent;if(g(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(v(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(g(e)&&`type`in e&&typeof e.type==`string`&&e.type===`VariableDeclaration`){if(`parent`in e&&e.parent){let t=e.parent;if(g(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 b(e,t,n,r){let i=e.range[1],a=y(t);if(a<0)return!1;let o=n.filter(e=>e.range[0]>=i&&e.range[1]<=a),s=[];if(g(t)&&`decorators`in t){let e=t.decorators;if(Array.isArray(e))for(let t of e)v(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 x(e,t,n){if(!_(t))return null;let r=y(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&&!b(a,t,e,n)?null:a}function Se(e,t,n){if(!_(t))return null;let r=y(t),i=r>=0?r:t.range[0],a=null;for(let t of e)t.type!==`Shebang`&&t.range[1]<=i&&(a===null||t.range[1]>a.range[1])&&(a=t);if(a===null)return null;if(n===void 0)return{comments:[a]};let o=a.range[0];for(;o>0&&n[o-1]!==`
7
+ `;)o--;if(n.slice(o,a.range[0]).trim().length>0||!b(a,t,e,n))return null;if(a.type===`Block`)return{comments:[a]};let s=[a],c=!0;for(;c;){c=!1;let t=s[0];if(!t)break;let r=null;for(let n of e)n.type===`Line`&&n.range[1]<t.range[0]&&(r===null||n.range[1]>r.range[1])&&(r=n);if(r===null)break;let i=n.slice(r.range[1],t.range[0]);if(i.split(`
8
+ `).length!==2||i.trim().length>0)break;let a=r.range[0];for(;a>0&&n[a-1]!==`
9
+ `;)a--;if(n.slice(a,r.range[0]).trim().length>0)break;s.unshift(r),c=!0}return{comments:s}}const S={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(S).some(t=>e.includes(t))?!0:Ce.some(t=>t.test(e))}function C(e,t){let n=t[0];for(;n>0&&e[n-1]!==`
10
+ `;)n--;return e.slice(n,t[0])}function w(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 T(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} - ${S.paramDescription}`,a=t.value.match(/@param[^@]*$/);return a&&a.index!==void 0?T(e,t,a,i,r):w(e,t,i,r)}function Ee(e,t,n){let r=`\n${n} * @returns ${S.returnsDescription}`,i=t.value.match(/@\w+[^@]*$/);return i&&i.index!==void 0?T(e,t,i,r,n):w(e,t,r,n)}function De(e,t,n,r){let i=`\n${r} * @typeParam ${n} - ${S.typeParamDescription}`,a=t.value,o=a.match(/@typeParam[^@]*$/);if(o&&o.index!==void 0)return T(e,t,o,i,r);let s=a.match(/@param[^@]*$/);return s&&s.index!==void 0?T(e,t,s,i,r):w(e,t,i,r)}function Oe(e,t,n){let r=t.value;return r.trim()===`*`?e.replaceTextRange(t.range,`/**\n${n} * ${S.description}\n${n} */`):e.replaceTextRange(t.range,`/*${r}*/`)}function ke(e,t,n){return e.slice(t).includes(`
11
+ `)?``:`\n${n} `}function Ae(e,t,n,r){let i=t.value,a=RegExp(`@param\\s+${E(n)}\\s*$`,`m`),o=a.exec(i);if(o){let s=ke(i,o.index+o[0].length,r),c=i.replace(a,`@param ${n} - ${S.paramDescription}${s}`);return e.replaceTextRange(t.range,`/*${c}*/`)}return e.replaceTextRange(t.range,`/*${i}*/`)}function je(e,t,n){let r=t.value,i=/@returns\s*$/m,a=i.exec(r);if(a){let o=ke(r,a.index+a[0].length,n),s=r.replace(i,`@returns ${S.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())}))}),Me=n.object({type:n.string(),name:n.optional(n.string()),left:n.optional(D),argument:n.optional(D),parameter:n.optional(D)});function Ne(e){return ye.safeParse(e).success}function O(e){return Ne(e)?e.params.map(e=>{let t=Me.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 Pe(n)??`options`;case`ArrayPattern`:return`args`;case`TSParameterProperty`:return n.parameter?.name??n.parameter?.left?.name??``;default:return``}}).filter(e=>!!e):[]}function Pe(e){return null}const Fe=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`禁止多余的 @param 标签`}},createOnce(e){let t=[];function n(n){let r=x(t,n,e.sourceCode.text);if(!r)return;let i=d(r.value);if(!i)return;let a=O(n),o=oe(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)}}}}),Ie=[`file`,`module`,`author`,`since`];function Le(e){return Ie.includes(e)}function Re(e,t,n,r){let i=e.split(`
9
12
  `),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};
13
+ `);return n.replaceTextRange(r,`/*${o}*/`)}const ze=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)Le(a.tag)&&e.report({node:t,message:`禁止使用旧版 JSDoc 标签 @${a.tag},该标签在 TSDoc 中已不推荐使用`,fix:e=>Re(n,a.tag,e,r.range)})}}}}}),Be=[...Object.values(S),`参数描述`,`返回值描述`,`函数描述`,`方法描述`,`类描述`,`变量描述`,`类型参数描述`,`描述`];function k(e){let t=e.trim();t.startsWith(`-`)&&(t=t.slice(1).trim());for(let e of Be)if(t===e)return e;return null}function Ve(e){let t=k(e);return t?`禁止使用占位描述 "${t}",请提供有意义的描述`:null}function He(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 Ue=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=Ve(i.description);a&&e.report({node:t,message:a});let o=He(i);for(let n of o)e.report({node:t,message:n})}}}}});function We(e){return e?e.trim().startsWith(`-`):!1}const Ge=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)We(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 Ke(e){let t=e.split(`
14
+ `),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 qe=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)&&(Ke(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}*/`)}}))}}}}}),Je=[/使用\s+\S+\s+代替/,/请使用\s+\S+/,/use\s+\S+\s+instead/i,/replaced\s+by\s+\S+/i];function Ye(e){if(!e)return!1;let t=e.trim();if(t.length===0)return!1;for(let e of Je)if(e.test(t))return!0;return t.length>10}const Xe=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&&(Ye(a.description)||e.report({node:t,message:`@deprecated 标签应该包含替代方案说明,例如:@deprecated 使用 newMethod 代替`}))}}}}}),Ze=[`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ClassDeclaration`,`VariableDeclaration`,`MethodDefinition`,`TSInterfaceDeclaration`,`TSTypeAliasDeclaration`,`TSEnumDeclaration`,`PropertyDefinition`,`TSPropertySignature`,`TSEnumMember`],Qe=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求 TSDoc 注释有描述文本`}},createOnce(e){let t=[];function n(n){let r=x(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=C(e.sourceCode.text,r.range);return Oe(t,r,n)}}))}let r={Program(){t=e.sourceCode.getAllComments()}};for(let e of Ze)r[e]=e=>n(e);return r}});function A(e){return he.safeParse(e).success}function j(e){return ge.safeParse(e).success}function M(e){return _e.safeParse(e).success}function $e(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 et(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 tt(e){if(!e||typeof e!=`object`)return null;let t=e;return`type`in t&&t.type===`ObjectPattern`&&`properties`in t?$e(t.properties):`type`in t&&t.type===`ArrayPattern`&&`elements`in t?et(t.elements):null}function nt(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 tt(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 nt(e);default:return null}}const rt={FunctionDeclaration:`函数`,MethodDefinition:`方法`,ClassDeclaration:`类`,VariableDeclaration:`变量`,TSInterfaceDeclaration:`接口`,TSTypeAliasDeclaration:`类型别名`,TSEnumDeclaration:`枚举`,PropertyDefinition:`类属性`,TSPropertySignature:`接口属性`,TSEnumMember:`枚举成员`};function P(e){return rt[e]||e}function it(e){return ve.safeParse(e).success}function at(e){return it(e)?e.typeParameters.params.map(e=>e.name&&typeof e.name==`object`&&`name`in e.name?String(e.name.name):``).filter(Boolean):[]}function ot(e){return!e.trim().includes(`
15
+ `)}function st(e){return j(e)?e.key.name:A(e)?e.id.name:`(匿名)`}const ct=e({meta:{type:`suggestion`,docs:{description:`要求接口属性、类属性、枚举成员使用多行 TSDoc 注释格式`}},createOnce(e){return{TSPropertySignature(t){F(t,e)},PropertyDefinition(t){F(t,e)},TSEnumMember(t){F(t,e)}}}});function F(e,t){let n=x(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!n)return;let r=n.value;if(ot(r)){let n=st(e);t.report({node:e,message:`"${n}"的注释应使用多行 TSDoc 格式,当前为单行格式`})}}const lt=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)ae(n)||e.report({node:t,message:`参数 "${n.name}" 缺少描述`,fix:t=>Ae(t,r,n.name,C(e.sourceCode.text,r.range))})}}}}}),ut=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求函数参数有 @param 标签`}},createOnce(e){let t=[];function n(n){let r=x(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=oe(a),s=i.filter(e=>!o.includes(e));for(let t of s)e.report({node:n,message:`参数 "${t}" 缺少 @param 标签`,fix:n=>{let i=C(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)}}}}),dt=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&&!ae(a)&&e.report({node:t,message:`@returns 标签缺少描述`,fix:t=>je(t,r,C(e.sourceCode.text,r.range))})}}}}});function I(e){return typeof e!=`object`||!e||!(`type`in e)?!1:typeof e.type==`string`}function ft(e){return I(e)&&e.type===`ReturnStatement`&&`argument`in e}function pt(e){return typeof e==`object`&&!!e&&`body`in e}function mt(e){return typeof e==`object`&&!!e&&`returnType`in e}function ht(e){return I(e)?[`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`].includes(e.type):!1}function L(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(t.has(n))return!1;if(t.add(n),ft(n))return!0;if(ht(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(L(e,t))return!0}else if(`type`in i&&L(i,t))return!0}}return!1}function R(e){if(typeof e!=`object`||!e||!pt(e)||!e.body)return!1;let t=e.body;return typeof t!=`object`||!t?!1:!(`type`in t)||t.type!==`BlockStatement`||L(t,/* @__PURE__ */ new WeakSet)}function z(e){if(typeof e!=`object`||!e||!mt(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(I(t))return t.type===`TSVoidKeyword`}}}return!1}function gt(e){return R(e)?!z(e):!1}const _t=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求有返回值的函数有 @returns 标签`}},createOnce(e){return{FunctionDeclaration(t){B(t,e)},FunctionExpression(t){B(t,e)},ArrowFunctionExpression(t){if(`parent`in t&&t.parent){let e=t.parent.type;if(e===`CallExpression`||e===`Property`)return}B(t,e)}}}});function B(e,t){if(!gt(e))return;let n=x(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=C(t.sourceCode.text,n.range);return Ee(e,n,r)}}))}function vt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&`range`in t&&Array.isArray(t.range)}const yt=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&&vt(t)&&e.report({node:t,message:`@throws 标签应使用 {@link Type} 格式声明异常类型,例如:@throws {@link Error} 描述`})}}}}});function V(e){if(typeof e!=`object`||!e)return!1;let t=e;return`body`in t&&Array.isArray(t.body)}function bt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&t.type===`ThrowStatement`&&`argument`in t}function xt(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&t.type===`NewExpression`&&`callee`in t}function H(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&t.type===`Identifier`&&`name`in t}function St(e){if(typeof e!=`object`||!e)return!1;let t=e;return`consequent`in t&&`alternate`in t}function Ct(e){if(typeof e!=`object`||!e)return!1;let t=e;return`block`in t&&`handler`in t}function wt(e){return typeof e!=`object`||!e?!1:`cases`in e}function Tt(e){if(typeof e!=`object`||!e||!(`consequent`in e))return!1;let t=e;return Array.isArray(t.consequent)}function Et(e){let t=e.argument;if(xt(t)){let e=t.callee;if(H(e))return e.name}return H(t)?t.name:`Error`}function U(e,t){if(!V(e))return;let n=e;if(Array.isArray(n.body))for(let e of n.body)W(e,t)}function W(e,t){if(!e||typeof e!=`object`)return;let n=e;if(`type`in n&&n.type===`ThrowStatement`&&bt(n)){let e=Et(n);t.push({typeName:e})}else`type`in n&&n.type===`IfStatement`&&St(n)?(W(n.consequent,t),n.alternate&&W(n.alternate,t)):`type`in n&&n.type===`TryStatement`&&Ct(n)?Dt(n,t):`type`in n&&n.type===`SwitchStatement`&&wt(n)?Ot(n,t):`type`in n&&n.type===`BlockStatement`&&V(n)&&U(n,t)}function Dt(e,t){V(e.block)&&U(e.block,t),e.handler&&typeof e.handler==`object`&&`body`in e.handler&&e.handler.body&&V(e.handler.body)&&U(e.handler.body,t)}function Ot(e,t){for(let n of e.cases)if(Tt(n))for(let e of n.consequent)W(e,t)}function kt(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 U(t,n),n}const At=e({meta:{type:`suggestion`,docs:{description:`要求抛出异常的函数有 @throws 标签`}},createOnce(e){return{FunctionDeclaration(t){G(t,e)},FunctionExpression(t){G(t,e)},ArrowFunctionExpression(t){if(`parent`in t&&t.parent){let e=t.parent.type;if(e===`CallExpression`||e===`Property`)return}G(t,e)}}}});function G(e,t){let n=kt(e);if(n.length===0)return;let r=x(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!r){K(e,t,n);return}let i=d(r.value);i?i.tags.filter(e=>e.tag===`throws`||e.tag===`throw`).length===0&&K(e,t,n):K(e,t,n)}function K(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 jt(e){return de.safeParse(e).success}function Mt(e){return ue.safeParse(e).success}function Nt(e){return ce.safeParse(e).success}function Pt(e){return le.safeParse(e).success}function Ft(e){return be.safeParse(e).success}function It(e){return xe.safeParse(e).success}function q(e){return e.type===`FunctionDeclaration`||e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`?zt(e):e.type===`MethodDefinition`&&Ft(e)&&e.value?Bt(e.value):e.type===`ClassDeclaration`?Vt():e.type===`VariableDeclaration`&&It(e)?Ht(e.declarations):J()}function Lt(e,t){return`\n${t}`+e.join(`\n${t}`)+`\n${t}`}function Rt(e,t){return Lt(q(e),t)}function zt(e){let t=O(e),n=R(e),r=z(e),i=[];i.push(`/**`),i.push(` * ${S.functionDescription}`);for(let e of t)i.push(` * @param ${e} - ${S.paramDescription}`);return n&&!r&&i.push(` * @returns ${S.returnsDescription}`),i.push(` */`),i}function Bt(e){if(!e||typeof e!=`object`||!jt(e))return J();let t=e,n=O(t),r=R(t),i=z(t),a=[];a.push(`/**`),a.push(` * ${S.methodDescription}`);for(let e of n)a.push(` * @param ${e} - ${S.paramDescription}`);return r&&!i&&a.push(` * @returns ${S.returnsDescription}`),a.push(` */`),a}function Vt(){let e=[];return e.push(`/**`),e.push(` * ${S.classDescription}`),e.push(` */`),e}function Ht(e){let t=e[0];if(!t||!Mt(t))return J();let n=Nt(t)?t.init:void 0;if(n&&typeof n==`object`&&Pt(n)){let e=n.type;if(e===`ArrowFunctionExpression`||e===`FunctionExpression`)return J()}let r=[];return r.push(`/**`),r.push(` * ${S.variableDescription}`),r.push(` */`),r}function J(){let e=[];return e.push(`/**`),e.push(` * ${S.description}`),e.push(` */`),e}function Ut(e,t){let n=e.map(e=>{let t=e.trim();return t.startsWith(`*`)?t.slice(1).trim():t});for(;n.length>0&&!n[0];)n.shift();for(;n.length>0&&!n[n.length-1];)n.pop();return n.length===0?`/**\n${t} */`:`/**\n${n.map(e=>e?`${t} * ${e}`:`${t} *`).join(`
16
+ `)}\n${t} */`}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 Wt(e){return typeof e==`object`&&!!e&&`init`in e}function Z(e){return typeof e==`object`&&!!e}const Gt=[`FunctionDeclaration`,`MethodDefinition`,`ClassDeclaration`,`VariableDeclaration`,`TSInterfaceDeclaration`,`TSTypeAliasDeclaration`,`TSEnumDeclaration`,`PropertyDefinition`,`TSEnumMember`];function Kt(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 qt(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(Wt(t)&&t.init&&typeof t.init==`object`&&Y(t.init)&&(t.init.type===`ArrowFunctionExpression`||t.init.type===`FunctionExpression`))return!1}return!0}return!!Kt(e)}function Jt(e){return e.includes(`/**`)}function Yt(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 Q(e,t){if(!e)return``;let n=t;for(;n>0&&e[n-1]!==`
17
+ `;)n--;return e.slice(n,t)}function Xt(e,t,n){let r=Yt(t),i=Rt(t,Q(n.sourceCode.text,r[0]));return e.insertTextBeforeRange(r,i)}function Zt(e,t,n){if(t.skipFile||qt(e,t.checkAllVariables))return;let r=x(t.commentsCache,e,n.sourceCode.text);if(!r){let r=P(e.type),i=N(e),a=Se(t.commentsCache,e,n.sourceCode.text);n.report({node:e,message:`${r}"${i}"缺少 TSDoc 注释`,fix:t=>{let r=a?.comments[0],i=a?.comments[a.comments.length-1];if(!r||!i)return Xt(t,e,n);let o=[r.range[0],i.range[1]],s=Q(n.sourceCode.text,o[0]),c=a.comments.flatMap(e=>e.type===`Block`?e.value.split(`
18
+ `):[e.value]),l=c.map(e=>{let t=e.trim();return t.startsWith(`*`)?t.slice(1).trim():t}).every(e=>!e)?q(e).join(`
19
+ `):Ut(c,s);return t.replaceTextRange(o,l)}});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 Qt(e,t){let n=e.getAllComments(),r=e.text;if(r!=null){if(!Jt(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 $t(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 en=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=Qt(e.sourceCode,t);let r=e.options?.[0];t.checkAllVariables=$t(r)}};for(let r of Gt)n[r]=n=>Zt(n,t,e);return n}});function tn(e){return e.tags.filter(e=>e.tag===`typeParam`||e.tag===`template`).map(e=>e.name)}const nn=e({meta:{type:`suggestion`,fixable:`code`,docs:{description:`要求泛型有 @typeParam 标签`}},createOnce(e){return{FunctionDeclaration(t){$(t,e)},FunctionExpression(t){$(t,e)},ArrowFunctionExpression(t){if(`parent`in t&&t.parent){let e=t.parent.type;if(e===`CallExpression`||e===`Property`)return}$(t,e)},ClassDeclaration(t){$(t,e)},TSInterfaceDeclaration(t){$(t,e)},TSTypeAliasDeclaration(t){$(t,e)}}}});function $(e,t){if(!it(e))return;let n=at(e);if(n.length===0)return;let r=x(t.sourceCode.getAllComments(),e,t.sourceCode.text);if(!r)return;let i=d(r.value);if(!i)return;let a=tn(i),o=n.filter(e=>!a.includes(e));for(let n of o)t.report({node:e,message:`缺少类型参数 "${n}" 的 @typeParam 文档`,fix:e=>{let i=C(t.sourceCode.text,r.range);return De(e,r,n,i)}})}const rn=/^(=+)\s+(.+?)\s+(=+)$/;function an(e){let t=e.trim().match(rn);return t?{leadingEquals:t[1]??``,text:t[2]??``,trailingEquals:t[3]??``}:null}const on=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=an(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)}})}}}}}}),sn=/\bTODO(?:\(([^)]+)\))?:?\s*(.*)/i;function cn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ln={requireAuthor:!1,requireDescription:!0};function un(e){return/\bTODO\b/i.test(e)}function dn(e){let t={...ln};if(cn(e)){let n=e;typeof n.requireAuthor==`boolean`&&(t.requireAuthor=n.requireAuthor),typeof n.requireDescription==`boolean`&&(t.requireDescription=n.requireDescription)}return t}function fn(e){let t=e.match(sn);return t?{author:t[1]??``,description:(t[2]??``).trim()}:null}const pn={"no-commented-code":s,"no-description-tag":se,"no-extra-param":Fe,"no-legacy-jsdoc-tags":ze,"no-placeholder-description":Ue,"param-hyphen-format":Ge,"require-blank-line-before-tags":qe,"require-deprecated-alternative":Xe,"require-description":Qe,"require-multiline-property-comment":ct,"require-param":ut,"require-param-description":lt,"require-returns":_t,"require-returns-description":dt,"require-throws":At,"require-throws-type":yt,"require-tsdoc":en,"require-type-param":nn,"separator-format":on,"todo-format":e({meta:{type:`suggestion`,docs:{description:`要求 TODO 注释有描述和作者`}},createOnce(e){let t=dn(e.options?.[0]);return{Program(n){let r=e.sourceCode.getAllComments();for(let i of r){let r=i.value;if(!un(r))continue;let a=fn(r);a&&(t.requireAuthor&&!a.author&&e.report({node:n,message:`TODO 注释缺少作者信息,格式:TODO(author): 描述`}),t.requireDescription&&!a.description&&e.report({node:n,message:`TODO 注释缺少描述说明`}))}}}}})},mn=t({meta:{name:`@longzai-intelligence-oxlint/tsdoc-plugin`},rules:pn});export{rn as SEPARATOR_PATTERN,mn as default,mn as tsdocPlugin,an as parseSeparatorComment,pn as tsdocRules};
@@ -1 +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
+ 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`,url:`url`,jwt:`jwt`,emoji:`emoji`,guid:`guid`,uuid:`uuid`,uuidv4:`uuid`,uuidv6:`uuid`,uuidv7:`uuid`,nanoid:`nanoid`,cuid:`cuid2`,cuid2:`cuid2`,ulid:`ulid`,base64:`base64`,base64url:`base64url`,xid:`xid`,ksuid:`ksuid`,ipv4:`ipv4`,ipv6:`ipv6`,cidrv4:`cidrv4`,cidrv6:`cidrv6`,e164:`e164`,datetime:`iso.datetime`,date:`iso.date`,time:`iso.time`,duration:`iso.duration`},G=e({meta:{type:`suggestion`,docs:{description:`优先使用顶层字符串格式 schema 替代 z.string 实例上已废弃的格式方法链`}},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};
package/dist/react.js CHANGED
@@ -1 +1 @@
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};
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{s as e,t}from"./base.entry-bAMXAIU8.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};
package/dist/root.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-eNRova_s.js";
2
+ import { n as oxlintRootConfig, r as ROOT_WHITELIST_PATTERNS, t as defineConfig } from "./root.entry-D3HRGFNj.js";
3
+ export { type OxlintConfig, type OxlintConfigOverride, ROOT_WHITELIST_PATTERNS, oxlintRootConfig as default, defineConfig };
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{o as e,s as t,t as n}from"./base.entry-bAMXAIU8.js";const r=[`**`,`!package.json`,`!turbo.json`,`!tsconfig.json`,`!oxfmt.config.ts`,...e];function i(e){let i=n();return{extends:[i],...e,ignorePatterns:t([...i.ignorePatterns??[],...r,...e?.ignorePatterns??[]])}}const a=i();export{a as n,r,i as t};
@@ -0,0 +1,27 @@
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";
4
+ //#region src/defaults/root.patterns.d.ts
5
+ /**
6
+ * monorepo 根目录白名单忽略模式全集
7
+ *
8
+ * @remarks
9
+ * 以 `**` 打头吞掉全部路径,固定根文件与 lzi 工具配置全族随后以负向排除重新纳入检查,
10
+ * lzi 模式串复用强制包含单一真源,入口拉平时统一归一化落尾
11
+ */
12
+ declare const ROOT_WHITELIST_PATTERNS: readonly string[];
13
+ //#endregion
14
+ //#region src/entries/root.entry.d.ts
15
+ /**
16
+ * 创建 Oxlint Root 配置
17
+ *
18
+ * @param options - 预设选项,包含额外的规则、覆盖和忽略模式
19
+ * @returns monorepo 根目录白名单模式的 Oxlint 配置对象
20
+ */
21
+ declare function defineConfig(options?: PresetOptions): OxlintConfig;
22
+ /**
23
+ * 默认 Oxlint Root 配置实例
24
+ */
25
+ declare const oxlintRootConfig: OxlintConfig;
26
+ //#endregion
27
+ export { oxlintRootConfig as n, ROOT_WHITELIST_PATTERNS as r, defineConfig as t };
package/dist/root.js ADDED
@@ -0,0 +1 @@
1
+ export{r as ROOT_WHITELIST_PATTERNS,n as default,t as defineConfig}from"./root.entry-BBvHr7IZ.js";
@@ -1 +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
+ import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-bAMXAIU8.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};
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-CHCKR0fA.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-CmsbeE26.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-oxlint/presets",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Longzai Intelligence oxlint 配置预设",
5
5
  "keywords": [
6
6
  "config",
@@ -73,6 +73,10 @@
73
73
  "types": "./dist/expo.d.ts",
74
74
  "import": "./dist/expo.js"
75
75
  },
76
+ "./root": {
77
+ "types": "./dist/root.d.ts",
78
+ "import": "./dist/root.js"
79
+ },
76
80
  "./rules": {
77
81
  "types": "./dist/rules.d.ts",
78
82
  "import": "./dist/rules.js"
@@ -97,36 +101,36 @@
97
101
  "dependencies": {
98
102
  "@longzai-intelligence-vitest/config": "0.0.13",
99
103
  "@oxlint/plugins": "^1.74.0",
100
- "zod": "^4.4.3"
104
+ "zod": "^4.6.7"
101
105
  },
102
106
  "devDependencies": {
103
- "@longzai-intelligence-oxlint/architecture-core-plugin": "0.2.4",
104
- "@longzai-intelligence-oxlint/architecture-electron-plugin": "0.2.4",
105
- "@longzai-intelligence-oxlint/architecture-library-plugin": "0.2.4",
106
- "@longzai-intelligence-oxlint/code-style-plugin": "0.2.4",
107
- "@longzai-intelligence-oxlint/composer-plugin": "0.2.4",
108
- "@longzai-intelligence-oxlint/core": "0.2.4",
109
- "@longzai-intelligence-oxlint/design-rules-plugin": "0.2.4",
110
- "@longzai-intelligence-oxlint/elysia-route-plugin": "0.2.4",
111
- "@longzai-intelligence-oxlint/eslint-config-plugin": "0.2.4",
112
- "@longzai-intelligence-oxlint/file-naming-plugin": "0.2.4",
113
- "@longzai-intelligence-oxlint/lzi-builder-config-plugin": "0.2.4",
114
- "@longzai-intelligence-oxlint/lzi-config-plugin": "0.2.4",
115
- "@longzai-intelligence-oxlint/nestjs-route-plugin": "0.2.4",
116
- "@longzai-intelligence-oxlint/package-json-plugin": "0.2.4",
117
- "@longzai-intelligence-oxlint/perfectionist-plugin": "0.2.4",
118
- "@longzai-intelligence-oxlint/react-plugin": "0.2.4",
119
- "@longzai-intelligence-oxlint/schema-type-separation-plugin": "0.2.4",
120
- "@longzai-intelligence-oxlint/stylistic-plugin": "0.2.4",
121
- "@longzai-intelligence-oxlint/tsconfig-plugin": "0.2.4",
122
- "@longzai-intelligence-oxlint/tsdoc-plugin": "0.2.4",
123
- "@longzai-intelligence-oxlint/tsdown-config-plugin": "0.2.4",
124
- "@longzai-intelligence-oxlint/tsup-config-plugin": "0.2.4",
125
- "@longzai-intelligence-oxlint/typeorm-plugin": "0.2.4",
126
- "@longzai-intelligence-oxlint/typescript-eslint-plugin": "0.2.4",
127
- "@longzai-intelligence-oxlint/utils": "0.2.4",
128
- "@longzai-intelligence-oxlint/vitest-config-plugin": "0.2.4",
129
- "@longzai-intelligence-oxlint/zod-plugin": "0.2.4",
107
+ "@longzai-intelligence-oxlint/architecture-core-plugin": "0.2.6",
108
+ "@longzai-intelligence-oxlint/architecture-electron-plugin": "0.2.6",
109
+ "@longzai-intelligence-oxlint/architecture-library-plugin": "0.2.6",
110
+ "@longzai-intelligence-oxlint/code-style-plugin": "0.2.6",
111
+ "@longzai-intelligence-oxlint/composer-plugin": "0.2.6",
112
+ "@longzai-intelligence-oxlint/core": "0.2.6",
113
+ "@longzai-intelligence-oxlint/design-rules-plugin": "0.2.6",
114
+ "@longzai-intelligence-oxlint/elysia-route-plugin": "0.2.6",
115
+ "@longzai-intelligence-oxlint/eslint-config-plugin": "0.2.6",
116
+ "@longzai-intelligence-oxlint/file-naming-plugin": "0.2.6",
117
+ "@longzai-intelligence-oxlint/lzi-builder-config-plugin": "0.2.6",
118
+ "@longzai-intelligence-oxlint/lzi-config-plugin": "0.2.6",
119
+ "@longzai-intelligence-oxlint/nestjs-route-plugin": "0.2.6",
120
+ "@longzai-intelligence-oxlint/package-json-plugin": "0.2.6",
121
+ "@longzai-intelligence-oxlint/perfectionist-plugin": "0.2.6",
122
+ "@longzai-intelligence-oxlint/react-plugin": "0.2.6",
123
+ "@longzai-intelligence-oxlint/schema-type-separation-plugin": "0.2.6",
124
+ "@longzai-intelligence-oxlint/stylistic-plugin": "0.2.6",
125
+ "@longzai-intelligence-oxlint/tsconfig-plugin": "0.2.6",
126
+ "@longzai-intelligence-oxlint/tsdoc-plugin": "0.2.6",
127
+ "@longzai-intelligence-oxlint/tsdown-config-plugin": "0.2.6",
128
+ "@longzai-intelligence-oxlint/tsup-config-plugin": "0.2.6",
129
+ "@longzai-intelligence-oxlint/typeorm-plugin": "0.2.6",
130
+ "@longzai-intelligence-oxlint/typescript-eslint-plugin": "0.2.6",
131
+ "@longzai-intelligence-oxlint/utils": "0.2.6",
132
+ "@longzai-intelligence-oxlint/vitest-config-plugin": "0.2.6",
133
+ "@longzai-intelligence-oxlint/zod-plugin": "0.2.6",
130
134
  "@vitest/coverage-v8": "^4.1.10"
131
135
  },
132
136
  "peerDependencies": {