@longzai-intelligence-oxlint/presets 0.2.5 → 0.2.7
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 +2 -1
- package/dist/{base.entry-BRRJVhQW.js → base.entry-GfFoGhD4.js} +1 -1
- package/dist/base.js +1 -1
- package/dist/{electron.entry-DGTGFrW5.js → electron.entry-BdBy0sHm.js} +1 -1
- package/dist/electron.js +1 -1
- package/dist/elysia.js +1 -1
- package/dist/expo.js +1 -1
- package/dist/{fumadocs.entry-oZq7iczh.js → fumadocs.entry-R3nQdrSK.js} +1 -1
- package/dist/fumadocs.js +1 -1
- package/dist/hono.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/{library.entry-CRtfr5d4.js → library.entry-DF17Goqu.js} +1 -1
- package/dist/library.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{nest.entry-DHYBO2a1.js → nest.entry-Bd-wek_a.js} +1 -1
- package/dist/nest.js +1 -1
- package/dist/{next.entry-BAw82S0g.js → next.entry-u0f_TOE0.js} +1 -1
- package/dist/next.js +1 -1
- package/dist/node.js +1 -1
- package/dist/plugins/file-naming.js +1 -1
- package/dist/plugins/zod.js +1 -1
- package/dist/react.js +1 -1
- package/dist/root.d.ts +3 -0
- package/dist/root.entry-D3HRGFNj.d.ts +27 -0
- package/dist/root.entry-DoqVpDFS.js +1 -0
- package/dist/root.js +1 -0
- package/dist/{taro.entry-CHCKR0fA.js → taro.entry-D437bUY3.js} +1 -1
- package/dist/taro.js +1 -1
- package/package.json +33 -29
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`,"no-warning-comments":[`error`,{terms:[`TODO`],location:`anywhere`}]},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-
|
|
1
|
+
export{n as default,t as defineConfig}from"./base.entry-GfFoGhD4.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t}from"./base.entry-GfFoGhD4.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-
|
|
1
|
+
import"./react.js";export{n as default,t as defineConfig}from"./electron.entry-BdBy0sHm.js";
|
package/dist/elysia.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t,t as n}from"./base.entry-GfFoGhD4.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-
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-GfFoGhD4.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-GfFoGhD4.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-
|
|
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-R3nQdrSK.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-
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-GfFoGhD4.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 "./
|
|
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-
|
|
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-GfFoGhD4.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-u0f_TOE0.js";import{t as l}from"./taro.entry-D437bUY3.js";import{i as u,r as d,t as f}from"./fumadocs.entry-R3nQdrSK.js";import"./expo.js";import{t as p}from"./nest.entry-Bd-wek_a.js";import{t as m}from"./electron.entry-BdBy0sHm.js";import{t as h}from"./library.entry-DF17Goqu.js";import{r as g,t as _}from"./root.entry-DoqVpDFS.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,
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t,t as n}from"./base.entry-GfFoGhD4.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-
|
|
1
|
+
export{n as default,t as defineConfig}from"./library.entry-DF17Goqu.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-
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-GfFoGhD4.js";import"./node.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{a as e,s as t,t as n}from"./base.entry-GfFoGhD4.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-
|
|
1
|
+
import"./node.js";export{n as default,t as defineConfig}from"./nest.entry-Bd-wek_a.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-GfFoGhD4.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-
|
|
1
|
+
import"./react.js";export{r as NEXTJS_SPECIAL_FILE_PATTERNS,n as default,t as defineConfig}from"./next.entry-u0f_TOE0.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-
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";export{n as default,t as defineConfig}from"./base.entry-GfFoGhD4.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`,`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`?`脚本文件应以动词直接命名且不带后缀,如 migrate.ts、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};
|
|
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};
|
package/dist/plugins/zod.js
CHANGED
|
@@ -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{
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e,t}from"./base.entry-GfFoGhD4.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,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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{o as e,s as t,t as n}from"./base.entry-GfFoGhD4.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};
|
package/dist/root.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{r as ROOT_WHITELIST_PATTERNS,n as default,t as defineConfig}from"./root.entry-DoqVpDFS.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-GfFoGhD4.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-
|
|
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-D437bUY3.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-oxlint/presets",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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.
|
|
104
|
+
"zod": "^4.6.7"
|
|
101
105
|
},
|
|
102
106
|
"devDependencies": {
|
|
103
|
-
"@longzai-intelligence-oxlint/architecture-core-plugin": "0.2.
|
|
104
|
-
"@longzai-intelligence-oxlint/architecture-electron-plugin": "0.2.
|
|
105
|
-
"@longzai-intelligence-oxlint/architecture-library-plugin": "0.2.
|
|
106
|
-
"@longzai-intelligence-oxlint/code-style-plugin": "0.2.
|
|
107
|
-
"@longzai-intelligence-oxlint/composer-plugin": "0.2.
|
|
108
|
-
"@longzai-intelligence-oxlint/core": "0.2.
|
|
109
|
-
"@longzai-intelligence-oxlint/design-rules-plugin": "0.2.
|
|
110
|
-
"@longzai-intelligence-oxlint/elysia-route-plugin": "0.2.
|
|
111
|
-
"@longzai-intelligence-oxlint/eslint-config-plugin": "0.2.
|
|
112
|
-
"@longzai-intelligence-oxlint/file-naming-plugin": "0.2.
|
|
113
|
-
"@longzai-intelligence-oxlint/lzi-builder-config-plugin": "0.2.
|
|
114
|
-
"@longzai-intelligence-oxlint/lzi-config-plugin": "0.2.
|
|
115
|
-
"@longzai-intelligence-oxlint/nestjs-route-plugin": "0.2.
|
|
116
|
-
"@longzai-intelligence-oxlint/package-json-plugin": "0.2.
|
|
117
|
-
"@longzai-intelligence-oxlint/perfectionist-plugin": "0.2.
|
|
118
|
-
"@longzai-intelligence-oxlint/react-plugin": "0.2.
|
|
119
|
-
"@longzai-intelligence-oxlint/schema-type-separation-plugin": "0.2.
|
|
120
|
-
"@longzai-intelligence-oxlint/stylistic-plugin": "0.2.
|
|
121
|
-
"@longzai-intelligence-oxlint/tsconfig-plugin": "0.2.
|
|
122
|
-
"@longzai-intelligence-oxlint/tsdoc-plugin": "0.2.
|
|
123
|
-
"@longzai-intelligence-oxlint/tsdown-config-plugin": "0.2.
|
|
124
|
-
"@longzai-intelligence-oxlint/tsup-config-plugin": "0.2.
|
|
125
|
-
"@longzai-intelligence-oxlint/typeorm-plugin": "0.2.
|
|
126
|
-
"@longzai-intelligence-oxlint/typescript-eslint-plugin": "0.2.
|
|
127
|
-
"@longzai-intelligence-oxlint/utils": "0.2.
|
|
128
|
-
"@longzai-intelligence-oxlint/vitest-config-plugin": "0.2.
|
|
129
|
-
"@longzai-intelligence-oxlint/zod-plugin": "0.2.
|
|
107
|
+
"@longzai-intelligence-oxlint/architecture-core-plugin": "0.2.7",
|
|
108
|
+
"@longzai-intelligence-oxlint/architecture-electron-plugin": "0.2.7",
|
|
109
|
+
"@longzai-intelligence-oxlint/architecture-library-plugin": "0.2.7",
|
|
110
|
+
"@longzai-intelligence-oxlint/code-style-plugin": "0.2.7",
|
|
111
|
+
"@longzai-intelligence-oxlint/composer-plugin": "0.2.7",
|
|
112
|
+
"@longzai-intelligence-oxlint/core": "0.2.7",
|
|
113
|
+
"@longzai-intelligence-oxlint/design-rules-plugin": "0.2.7",
|
|
114
|
+
"@longzai-intelligence-oxlint/elysia-route-plugin": "0.2.7",
|
|
115
|
+
"@longzai-intelligence-oxlint/eslint-config-plugin": "0.2.7",
|
|
116
|
+
"@longzai-intelligence-oxlint/file-naming-plugin": "0.2.7",
|
|
117
|
+
"@longzai-intelligence-oxlint/lzi-builder-config-plugin": "0.2.7",
|
|
118
|
+
"@longzai-intelligence-oxlint/lzi-config-plugin": "0.2.7",
|
|
119
|
+
"@longzai-intelligence-oxlint/nestjs-route-plugin": "0.2.7",
|
|
120
|
+
"@longzai-intelligence-oxlint/package-json-plugin": "0.2.7",
|
|
121
|
+
"@longzai-intelligence-oxlint/perfectionist-plugin": "0.2.7",
|
|
122
|
+
"@longzai-intelligence-oxlint/react-plugin": "0.2.7",
|
|
123
|
+
"@longzai-intelligence-oxlint/schema-type-separation-plugin": "0.2.7",
|
|
124
|
+
"@longzai-intelligence-oxlint/stylistic-plugin": "0.2.7",
|
|
125
|
+
"@longzai-intelligence-oxlint/tsconfig-plugin": "0.2.7",
|
|
126
|
+
"@longzai-intelligence-oxlint/tsdoc-plugin": "0.2.7",
|
|
127
|
+
"@longzai-intelligence-oxlint/tsdown-config-plugin": "0.2.7",
|
|
128
|
+
"@longzai-intelligence-oxlint/tsup-config-plugin": "0.2.7",
|
|
129
|
+
"@longzai-intelligence-oxlint/typeorm-plugin": "0.2.7",
|
|
130
|
+
"@longzai-intelligence-oxlint/typescript-eslint-plugin": "0.2.7",
|
|
131
|
+
"@longzai-intelligence-oxlint/utils": "0.2.7",
|
|
132
|
+
"@longzai-intelligence-oxlint/vitest-config-plugin": "0.2.7",
|
|
133
|
+
"@longzai-intelligence-oxlint/zod-plugin": "0.2.7",
|
|
130
134
|
"@vitest/coverage-v8": "^4.1.10"
|
|
131
135
|
},
|
|
132
136
|
"peerDependencies": {
|