@longzai-intelligence-oxlint/presets 0.2.26 → 0.2.28
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/e2e-playwright.d.ts +15 -0
- package/dist/e2e-playwright.entry-D8R3Btl6.js +1 -0
- package/dist/e2e-playwright.js +1 -0
- package/dist/index.d.ts +18 -14
- package/dist/index.js +1 -1
- package/dist/plugins/package-json.js +1 -1
- package/dist/react.d.ts +3 -23
- package/dist/react.js +1 -1
- package/dist/ui-application.d.ts +15 -0
- package/dist/ui-application.js +1 -0
- package/dist/ui-base.d.ts +15 -0
- package/dist/ui-base.js +1 -0
- package/dist/ui-library.d.ts +15 -0
- package/dist/ui-library.js +1 -0
- package/package.json +45 -32
package/README.md
CHANGED
|
@@ -8,8 +8,9 @@ Longzai Intelligence Oxlint 的通用预设包,为不同技术栈项目提供
|
|
|
8
8
|
|
|
9
9
|
## 能力
|
|
10
10
|
|
|
11
|
-
- 多技术栈预设 defineConfig 入口:base、node、react、nest、electron、elysia、library、e2e、sdk、next、hono、mcp、taro、fumadocs、react-native、expo、root
|
|
11
|
+
- 多技术栈预设 defineConfig 入口:base、node、react、ui-base、ui-application、ui-library、nest、electron、elysia、library、e2e、sdk、next、hono、mcp、taro、fumadocs、react-native、expo、root
|
|
12
12
|
- React Native 预设内置 Metro、Babel、Jest 工具链配置文件忽略,expo 预设由 react-native 派生供 Expo 工具链应用使用
|
|
13
|
+
- UI 层预设族由 react 预设派生:ui-base 为形态不执法基座,ui-application 与 ui-library 分别声明工程形与库形三键判据
|
|
13
14
|
- 各预设的默认插件、规则覆盖与特殊文件模式(如 Next.js 特殊文件)
|
|
14
15
|
- monorepo 根目录预设 root:白名单模式默认只检查根目录固定配置文件与 `lzi-*.config.ts` 全族
|
|
15
16
|
- 原生规则集聚合导出:eslint-core、typescript-eslint、unicorn、import 等,供外部按需引用
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import { t as PresetOptions } from "./preset-options.types-BWSmiunG.js";
|
|
3
|
+
import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-lrryBFJ6.js";
|
|
4
|
+
/**
|
|
5
|
+
* 创建 Oxlint E2e Playwright 配置
|
|
6
|
+
*
|
|
7
|
+
* @param options - 预设选项,包含额外的规则、覆盖和忽略模式
|
|
8
|
+
* @returns 含 test 工具链判据注入的 Oxlint 配置对象
|
|
9
|
+
*/
|
|
10
|
+
declare function defineConfig(options?: PresetOptions): OxlintConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 默认 Oxlint E2e Playwright 配置实例
|
|
13
|
+
*/
|
|
14
|
+
declare const oxlintE2ePlaywrightConfig: OxlintConfig;
|
|
15
|
+
export { type OxlintConfig, type OxlintConfigOverride, oxlintE2ePlaywrightConfig as default, defineConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e,t}from"./base.entry-ihV3q_2I.js";import"./node.js";const n={"@longzai-intelligence-oxlint/package-json-plugin/require-test-script-toolchain":[`error`,{test:[`playwright`]}]};function r(r){let i=t();return{extends:[i],rules:{...n,...r?.rules},...r?.overrides?{overrides:r.overrides}:{},ignorePatterns:e([...i.ignorePatterns??[],...r?.ignorePatterns??[]])}}const i=r();export{i as n,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./node.js";export{n as default,t as defineConfig}from"./e2e-playwright.entry-D8R3Btl6.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
2
|
import { defineConfig } from "./base.js";
|
|
3
|
-
import { defineConfig as defineConfig$
|
|
4
|
-
import { defineConfig as defineConfig$
|
|
5
|
-
import { defineConfig as defineConfig$
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { r as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { defineConfig as defineConfig$
|
|
3
|
+
import { defineConfig as defineConfig$11 } from "./react.js";
|
|
4
|
+
import { defineConfig as defineConfig$17 } from "./ui-base.js";
|
|
5
|
+
import { defineConfig as defineConfig$16 } from "./ui-application.js";
|
|
6
|
+
import { defineConfig as defineConfig$18 } from "./ui-library.js";
|
|
7
|
+
import { defineConfig as defineConfig$6 } from "./hono.js";
|
|
8
|
+
import { defineConfig as defineConfig$8 } from "./mcp.js";
|
|
9
|
+
import { r as NEXTJS_SPECIAL_FILE_PATTERNS, t as defineConfig$10 } from "./next.entry-Ne8_XqK0.js";
|
|
10
|
+
import { t as defineConfig$15 } from "./taro.entry-BCmIDclj.js";
|
|
11
|
+
import { i as FUMADOCS_SPECIAL_FILE_PATTERNS, r as FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS, t as defineConfig$5 } from "./fumadocs.entry-8pmrxlhS.js";
|
|
12
|
+
import { r as REACT_NATIVE_TOOLCHAIN_IGNORE_PATTERNS, t as defineConfig$12 } from "./react-native.entry-Cj2-RwM6.js";
|
|
13
|
+
import { defineConfig as defineConfig$4 } from "./expo.js";
|
|
14
|
+
import { defineConfig as defineConfig$9 } from "./nest.js";
|
|
15
|
+
import { defineConfig as defineConfig$3 } from "./electron.js";
|
|
16
|
+
import { defineConfig as defineConfig$7 } from "./library.js";
|
|
14
17
|
import { defineConfig as defineConfig$1 } from "./e2e.js";
|
|
15
|
-
import {
|
|
16
|
-
import { r as
|
|
18
|
+
import { defineConfig as defineConfig$2 } from "./e2e-playwright.js";
|
|
19
|
+
import { r as SDK_GENERATED_PATTERNS, t as defineConfig$14 } from "./sdk.entry-BYKYZRSf.js";
|
|
20
|
+
import { r as ROOT_WHITELIST_PATTERNS, t as defineConfig$13 } from "./root.entry-zPzaL4rV.js";
|
|
17
21
|
import { t as PresetOptions } from "./preset-options.types-BWSmiunG.js";
|
|
18
22
|
import { i as OxlintRules, n as OxlintConfigOverride, r as OxlintRuleConfig, t as OxlintConfig } from "./index-lrryBFJ6.js";
|
|
19
23
|
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-BpYEgKCm.js";
|
|
@@ -30,4 +34,4 @@ declare const PLUGIN_DEFAULTS: OxlintRules;
|
|
|
30
34
|
* 生态层覆盖插件 recommended 的无选项形态,require-* 与 test-file 系列规则由此获得选项默认值
|
|
31
35
|
*/
|
|
32
36
|
declare const ALL_RULES: OxlintRules;
|
|
33
|
-
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, REACT_NATIVE_TOOLCHAIN_IGNORE_PATTERNS, ROOT_WHITELIST_PATTERNS, SDK_GENERATED_PATTERNS, TYPESCRIPT_PROJECT_RULES, TYPESCRIPT_RECOMMENDED_RULES, UNICORN_RULES, defineConfig as defineBaseConfig, defineConfig as defineNodeConfig, defineConfig$1 as defineE2eConfig, defineConfig$2 as
|
|
37
|
+
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, REACT_NATIVE_TOOLCHAIN_IGNORE_PATTERNS, ROOT_WHITELIST_PATTERNS, SDK_GENERATED_PATTERNS, TYPESCRIPT_PROJECT_RULES, TYPESCRIPT_RECOMMENDED_RULES, UNICORN_RULES, defineConfig as defineBaseConfig, defineConfig as defineNodeConfig, defineConfig$1 as defineE2eConfig, defineConfig$2 as defineE2ePlaywrightConfig, defineConfig$3 as defineElectronConfig, defineConfig$4 as defineExpoConfig, defineConfig$5 as defineFumadocsConfig, defineConfig$6 as defineHonoConfig, defineConfig$7 as defineLibraryConfig, defineConfig$8 as defineMcpConfig, defineConfig$9 as defineNestConfig, defineConfig$10 as defineNextConfig, defineConfig$11 as defineReactConfig, defineConfig$12 as defineReactNativeConfig, defineConfig$13 as defineRootConfig, defineConfig$14 as defineSdkConfig, defineConfig$15 as defineTaroConfig, defineConfig$16 as defineUiApplicationConfig, defineConfig$17 as defineUiBaseConfig, defineConfig$18 as defineUiLibraryConfig };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{i as e,r as t,t as n}from"./base.entry-ihV3q_2I.js";import"./node.js";import{defineConfig as r}from"./react.js";import{defineConfig as i}from"./
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{i as e,r as t,t as n}from"./base.entry-ihV3q_2I.js";import"./node.js";import{defineConfig as r}from"./react.js";import{defineConfig as i}from"./ui-base.js";import{defineConfig as a}from"./ui-application.js";import{defineConfig as o}from"./ui-library.js";import{defineConfig as s}from"./hono.js";import{defineConfig as c}from"./mcp.js";import{r as l,t as u}from"./next.entry-9WqH5pU4.js";import{t as d}from"./taro.entry-BMIixeDL.js";import{i as f,r as p,t as m}from"./fumadocs.entry-CbNS_gTP.js";import{r as h,t as g}from"./react-native.entry-D2Dj46b7.js";import{defineConfig as _}from"./expo.js";import{t as v}from"./nest.entry-esm5OFt2.js";import{t as y}from"./electron.entry-DUsDae4u.js";import{defineConfig as b}from"./library.js";import{t as x}from"./e2e.entry-BovadSvn.js";import{t as S}from"./e2e-playwright.entry-D8R3Btl6.js";import{r as C,t as w}from"./sdk.entry-DpBT2LZv.js";import{r as T,t as E}from"./root.entry-DgJMQCn5.js";import{n as D,t as O}from"./unicorn.rules-0a_FuIjL.js";import{n as k,r as A,t as j}from"./typescript-eslint.rules-j0Y80OGu.js";export{t as ALL_RULES,D as ESLINT_CORE_RULES,j as ESLINT_RECOMMENDED_RULES,p as FUMADOCS_FILE_NAMING_EXEMPT_PATTERNS,f as FUMADOCS_SPECIAL_FILE_PATTERNS,l as NEXTJS_SPECIAL_FILE_PATTERNS,e as PLUGIN_DEFAULTS,h as REACT_NATIVE_TOOLCHAIN_IGNORE_PATTERNS,T as ROOT_WHITELIST_PATTERNS,C as SDK_GENERATED_PATTERNS,k as TYPESCRIPT_PROJECT_RULES,A as TYPESCRIPT_RECOMMENDED_RULES,O as UNICORN_RULES,n as defineBaseConfig,n as defineNodeConfig,x as defineE2eConfig,S as defineE2ePlaywrightConfig,y as defineElectronConfig,_ as defineExpoConfig,m as defineFumadocsConfig,s as defineHonoConfig,b as defineLibraryConfig,c as defineMcpConfig,v as defineNestConfig,u as defineNextConfig,r as defineReactConfig,g as defineReactNativeConfig,E as defineRootConfig,w as defineSdkConfig,d as defineTaroConfig,a as defineUiApplicationConfig,i as defineUiBaseConfig,o as defineUiLibraryConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return/\/(apps|packages)\//.test(e)&&e.endsWith(`/package.json`)}function r(e){return e.endsWith(`-infrastructure`)}function i(e){return typeof e==`object`&&!!e}const a=e({meta:{type:`problem`,docs:{description:`禁止 apps/packages 层声明领域基础设施包依赖(ADR 0102:域细节只经域公开面流出)`}},createOnce(e){return{before(){if(!n(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let a=JSON.parse(n);if(!i(a)||!i(a.dependencies))return;let o=Object.keys(a.dependencies).filter(r);o.length>0&&e.report({node:t,message:`禁止 apps/packages 层声明领域基础设施包依赖(ADR 0102):域的持久化实现细节只经域公开面流出。发现依赖 [${o.join(`, `)}]。`})}catch{}}}}});function o(e){return/\/apps\//.test(e)&&e.endsWith(`/package.json`)}function s(e){return typeof e==`object`&&!!e}function c(e){return s(e)?Object.keys(e).filter(e=>e!==`.`):[]}const l=e({meta:{type:`problem`,docs:{description:`禁止 apps 层应用包声明多出口 exports,依据 ADR 0198:应用包 exports 只允许无或单一根出口,跨应用复用一律经根出口取件`}},createOnce(e){return{before(){if(!o(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!s(r))return;let i=c(r.exports);i.length>0&&e.report({node:t,message:`禁止 apps 层应用包声明多出口 exports,依据 ADR 0198:应用包 exports 只允许无或单一根出口,跨应用复用一律经根出口取件。发现子出口 [${i.join(`, `)}]。`})}catch{}}}}}),ee=/* @__PURE__ */ new Set([`tsgo`,`tsc`]),te={bareCompiler:`裸调 tsgo 或 tsc 执行类型检查`,legacyDevCliTypecheck:`使用 lzi-dev-cli typecheck 旧封装,应迁移至 lzi-tsgo typecheck`,wrapperWithoutConfig:`lzi-tsgo typecheck 未传 tsconfig 路径`,wrapperWithoutSubcommand:`调用 lzi-tsgo 未带 typecheck 子命令`};function ne(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function u(e){return typeof e==`object`&&!!e}function d(e){return e===`typecheck`||e.startsWith(`typecheck:`)}function f(e){return e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(e=>e.length>0)}function p(e){let t=e.split(/\s+/).filter(e=>e.length>0),n=``,r=[];for(let e of t)if(n)r.push(e);else{if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(e))continue;n=e}return n?{command:n,args:r}:null}function m(e,t,n){let r=p(t);if(!r)return null;let i=r.command,a=r.args;return ee.has(i)?n||a.includes(`--noEmit`)?{key:e,kind:`bareCompiler`,segment:t}:null:n?i===`lzi-tsgo`?a[0]===`typecheck`?a.slice(1).some(e=>!e.startsWith(`-`))?null:{key:e,kind:`wrapperWithoutConfig`,segment:t}:{key:e,kind:`wrapperWithoutSubcommand`,segment:t}:i===`lzi-dev-cli`&&a[0]===`typecheck`?{key:e,kind:`legacyDevCliTypecheck`,segment:t}:null:null}function h(e){let t=[];for(let[n,r]of Object.entries(e)){if(typeof r!=`string`)continue;let e=d(n);for(let i of f(r)){let r=m(n,i,e);r&&t.push(r)}}return t}function g(e){if(!u(e))return null;let t=e.scripts;return u(t)?t:null}function _(e){return`scripts 键 ${e.key} ${te[e.kind]}。类型检查统一使用 lzi-tsgo typecheck 加 tsconfig 路径,依据 ADR 0057 与 ADR 0117。`}const v=e({meta:{type:`problem`,docs:{description:`禁止在 package.json scripts 中绕过 lzi-tsgo 封装执行类型检查`}},createOnce(e){return{before(){let t=e.filename;if(!ne(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=g(JSON.parse(n));if(r){let n=h(r);for(let r of n)e.report({node:t,message:_(r)})}}catch{}}}}});function y(e){return/\/domains\/[^/]+\/implementation\/package\.json$/.test(e)}function b(e){return typeof e==`object`&&!!e}function re(e,t){if(e===`./domain`)return!0;let n=typeof t==`string`?t:b(t)?[t.types,t.import,t.require,t.default].filter(e=>typeof e==`string`).join(` `):``;return/(^|\/)dist\/domain(\.|\/|$)/.test(n)||/(^|\/)src\/domain(\/|$)/.test(n)}const ie={noDomainLayerSubpathExport:"禁止领域实现包声明领域分层子路径导出(ADR 0101):领域分层(domain/)为 implementation 包内私有,仓储端口应落位 contract 包;`./domain` 类子导出属违规逃逸通道。"},ae=e({meta:{type:`problem`,docs:{description:`禁止领域实现包声明领域分层子路径导出(ADR 0101 违规逃逸通道)`}},createOnce(e){return{before(){if(!y(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!b(r)||!b(r.exports))return;for(let[n,i]of Object.entries(r.exports))n!==`.`&&re(n,i)&&e.report({node:t,message:`${ie.noDomainLayerSubpathExport}(发现子路径 "${n}")`})}catch{}}}}}),oe=/* @__PURE__ */ new Set([`@types/bun`,`@types/node`,`@typescript/native-preview`,`oxfmt`,`oxlint`,`tsdown`,`turbo`]),se=[`@longzai-intelligence-agent-tools/`,`@longzai-intelligence-bun/`,`@longzai-intelligence-builder/`,`@longzai-intelligence-changelog/`,`@longzai-intelligence-decision/`,`@longzai-intelligence-dev-tools/`,`@longzai-intelligence-env/`,`@longzai-intelligence-git/`,`@longzai-intelligence-issues/`,`@longzai-intelligence-oxfmt/`,`@longzai-intelligence-oxlint/`,`@longzai-intelligence-release/`,`@longzai-intelligence-tsgo/`,`@longzai-intelligence-tsdown/`,`@longzai-intelligence-typescript/`,`@longzai-intelligence-vitest/`,`@longzai-intelligence-vscode/`],ce=/* @__PURE__ */ new Set([`@longzai-intelligence/typescript-config`]),le=/* @__PURE__ */ new Set([`@longzai-intelligence-dev-tools/vite-plugin`,`@longzai-intelligence-typescript/rolldown-plugin-type-boundary`]);function x(e){return/\/(apps|packages|domains|plugins)\//.test(e)&&e.endsWith(`/package.json`)}function S(e){return le.has(e)?!1:oe.has(e)||ce.has(e)?!0:se.some(t=>e.startsWith(t))}function C(e){return typeof e==`object`&&!!e}const w=e({meta:{type:`problem`,docs:{description:`禁止子包声明应放 workspace 根的开发依赖,依据 ADR 0036 根已声明与应放根类别由根统一承载`}},createOnce(e){return{before(){if(!x(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!C(r)||!C(r.devDependencies)||`workspaces`in r)return;let i=Object.keys(r.devDependencies).filter(S);i.length>0&&e.report({node:t,message:`禁止子包声明应放 workspace 根的开发依赖,ADR 0036 判定根已声明与应放根类别均由根统一承载,子包经 Bun hoisting 取用。发现依赖 [${i.join(`, `)}]。`})}catch{}}}}});function T(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function E(e){return typeof e==`object`&&!!e}const D={noMitLicense:`禁止使用 MIT 协议。项目中的所有包都应使用 "license": "UNLICENSED"。`},O=e({meta:{type:`problem`,docs:{description:`禁止在 package.json 中使用 MIT 协议`}},createOnce(e){return{before(){let t=e.filename;if(!T(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);E(r)&&r.license===`MIT`&&e.report({node:t,message:D.noMitLicense})}catch{}}}}});function k(e){return/\/domains\/[^/]+\/infrastructure\/package\.json$/.test(e)}function A(e){return e.endsWith(`-infrastructure`)?`${e.slice(0,-15)}-implementation`:null}function j(e){return typeof e==`object`&&!!e}const M=e({meta:{type:`problem`,docs:{description:`禁止领域基础设施包依赖同域实现包(ADR 0101 依赖图只允许 infrastructure ──> contract)`}},createOnce(e){return{before(){if(!k(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!j(r)||typeof r.name!=`string`)return;let i=A(r.name);if(!i||!j(r.dependencies))return;i in r.dependencies&&e.report({node:t,message:`禁止领域基础设施包依赖同域实现包(ADR 0101):依赖图只允许 infrastructure ──> contract,发现依赖 "${i}"。`})}catch{}}}}});function N(e){return e.endsWith(`/package.json`)}const P=/^(?:\.{1,2}\/)?src\//;function F(e){return typeof e==`object`&&!!e}function I(e,t,n){if(typeof t==`string`)P.test(t)&&n.push({subpath:e,target:t});else if(F(t))for(let r of Object.values(t))I(e,r,n)}function L(e){let t=[];if(typeof e==`string`)return I(`.`,e,t),t;if(F(e))for(let[n,r]of Object.entries(e))I(n,r,t);return t}const R={noSrcExports:`禁止 exports 指向 src 源码(统一 dist 产物范式):包导出一律指向 dist 产物,指向源码会使消费方程序拉入本包源码编译。`},z=e({meta:{type:`problem`,docs:{description:`禁止 exports 指向 src 源码(统一 dist 产物范式门禁)`}},createOnce(e){return{before(){if(!N(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!F(r))return;let i=L(r.exports);for(let n of i)e.report({node:t,message:`${R.noSrcExports}(发现 "${n.subpath}" 指向 "${n.target}")`})}catch{}}}}}),B=[`-domain`,`-contract`,`-implementation`,`-infrastructure`];function V(e){return/\/domains\/[^/]+\/ui\/package\.json$/.test(e)}function H(e){return B.some(t=>e.endsWith(t))}function U(e){return typeof e==`object`&&!!e}const ue=e({meta:{type:`problem`,docs:{description:`禁止 domains ui 层声明域内四层包依赖,ADR 0127:UI 面域外依赖唯一指向生成式 sdk 客户端`}},createOnce(e){return{before(){if(!V(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!U(r)||!U(r.dependencies))return;let i=Object.keys(r.dependencies).filter(H);i.length>0&&e.report({node:t,message:`禁止 ui 层声明域内包依赖,ADR 0127:UI 面域外依赖唯一指向生成式 sdk 客户端,DDD 主体对 ui 全封闭。发现依赖 [${i.join(`, `)}]。`})}catch{}}}}});function de(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function fe(e){return e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(e=>e.length>0)}function pe(e){let t=e.split(/\s+/).filter(e=>e.length>0),n=``,r=[];for(let e of t)if(n)r.push(e);else{if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(e))continue;n=e}return n?{command:n,args:r}:null}const me={buildToolchainMismatch:`build 脚本命令与所属预设的工具链不符`,buildProdToolchainMismatch:`build:prod 脚本命令与所属预设的工具链不符`,devToolchainMismatch:`dev 脚本命令与所属预设的工具链不符`};function W(e){return typeof e==`object`&&!!e}function he(e){if(!W(e))return!1;for(let t of[`dev`,`build`,`buildProd`]){let n=e[t];if(n!==void 0&&(!Array.isArray(n)||n.some(e=>typeof e!=`string`)))return!1}return!0}function ge(e){if(!W(e))return null;let t=e.scripts;return W(t)?t:null}function G(e,t,n,r){if(r===void 0||r.length===0)return[];let i=e[t];if(typeof i!=`string`)return[];let a=[];for(let e of fe(i)){let i=pe(e);i!==null&&(r.includes(i.command)||a.push({key:t,kind:n,command:i.command,allowedList:r.join(`、`)}))}return a}function K(e,t){return[...G(e,`dev`,`devToolchainMismatch`,t.dev),...G(e,`build`,`buildToolchainMismatch`,t.build),...G(e,`build:prod`,`buildProdToolchainMismatch`,t.buildProd)]}function _e(e){return`scripts 键 ${e.key} 使用命令 "${e.command}",${me[e.kind]},允许清单为 ${e.allowedList}。build 脚本形态按预设校验,依据 ADR 0220,请改用当前预设允许的命令。`}const ve=e({meta:{type:`problem`,docs:{description:`按预设注入的允许清单校验 package.json 的 dev 与 build 与 build:prod 脚本命令形态`},schema:[{type:`object`,properties:{dev:{type:`array`,items:{type:`string`}},build:{type:`array`,items:{type:`string`}},buildProd:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{before(){let t=e.filename;if(!de(t))return!1},Program(t){let n=e.options?.[0];if(!he(n)||n.dev===void 0&&n.build===void 0&&n.buildProd===void 0)return;let r=e.sourceCode.text;try{let i=ge(JSON.parse(r));if(i){let r=K(i,n);for(let n of r)e.report({node:t,message:_e(n)})}}catch{}}}}}),q=[`mcp`,`cli`,`tui`,`dev`];function ye(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}const be=/^@longzai-intelligence-([a-z0-9][a-z0-9-]*)\//,xe=/^longzai-intelligence-[a-z0-9][a-z0-9-]*$/;function J(e){return typeof e==`object`&&!!e}function Se(e){let t=e.replace(/\\/g,`/`).split(`/`);for(let e=t.length-2;e>=0;--e){let n=t[e];if(n!==void 0&&xe.test(n))return n.slice(21)}return null}function Ce(e){let t=be.exec(e);return t===null?null:t[1]??null}function we(e,t){return Se(e)??Ce(t)}function Y(e){return`lzi-${e}`}function X(e){return e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e}function Te(e,t,n){let r=Y(t),i=q.find(t=>e===t||e.endsWith(`-${t}`));if(i!==void 0)return`${r}-${i}`;if(n===void 0)return r;let a=X(n);return e.endsWith(`-${a}`)?`${r}-${a}`:r}function Z(e,t,n){let r=Y(t);return e===r||q.some(t=>e===`${r}-${t}`)?!0:n!==void 0&&e===`${r}-${X(n)}`}function Q(e,t){let n=e.bin;return typeof n==`string`?[X(t)]:J(n)?Object.keys(n):[]}const Ee={invalidBinName:`bin 命令名不符合 ADR 0049 完整名称规范,命令名须为 lzi- 前缀加项目全名的 kebab-case 形态,禁止缩写`};function De(e,t){return`${Ee.invalidBinName},实际命令名为 "${e}",应为 "${t}"。`}const Oe=e({meta:{type:`problem`,docs:{description:`校验 package.json 的 bin 命令名使用项目全名,禁止缩写,依据 ADR 0049`}},createOnce(e){return{before(){let t=e.filename;if(!ye(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!J(r)||typeof r.name!=`string`||r.bin===void 0||r.name.includes(`{{`))return;let i=we(e.filename,r.name);if(i===null)return;let a=Q(r,r.name);for(let n of a)n.includes(`{{`)||Z(n,i,r.name)||e.report({node:t,message:De(n,Te(n,i,r.name))})}catch{}}}}}),$=t({meta:{name:`@longzai-intelligence-oxlint/package-json-plugin`},rules:{"no-app-infrastructure-dependency":a,"no-app-subpath-exports":l,"no-bare-tsgo-invocation":v,"no-domain-layer-subpath-export":ae,"no-hoistable-dev-dependency":w,"no-mit-license":O,"no-sibling-implementation-dependency":M,"no-src-exports":z,"no-ui-domain-package-dependency":ue,"require-build-script-toolchain":ve,"require-full-project-bin-name":Oe}});export{$ as default,$ as packageJsonPlugin,K as detectBuildScriptToolchainViolations,Q as extractBinNames,c as extractSubpathExits,L as findSrcExportTargets,o as isAppLayerPackageJson,T as isPackageJson,Z as isValidBinName,O as noMitLicenseRule};
|
|
1
|
+
import"../rolldown-runtime-BqT_7tdF.js";import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return/\/(apps|packages)\//.test(e)&&e.endsWith(`/package.json`)}function r(e){return e.endsWith(`-infrastructure`)}function i(e){return typeof e==`object`&&!!e}const a=e({meta:{type:`problem`,docs:{description:`禁止 apps/packages 层声明领域基础设施包依赖(ADR 0102:域细节只经域公开面流出)`}},createOnce(e){return{before(){if(!n(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let a=JSON.parse(n);if(!i(a)||!i(a.dependencies))return;let o=Object.keys(a.dependencies).filter(r);o.length>0&&e.report({node:t,message:`禁止 apps/packages 层声明领域基础设施包依赖(ADR 0102):域的持久化实现细节只经域公开面流出。发现依赖 [${o.join(`, `)}]。`})}catch{}}}}});function o(e){return/\/apps\//.test(e)&&e.endsWith(`/package.json`)}function s(e){return typeof e==`object`&&!!e}function c(e){return s(e)?Object.keys(e).filter(e=>e!==`.`):[]}const l=e({meta:{type:`problem`,docs:{description:`禁止 apps 层应用包声明多出口 exports,依据 ADR 0198:应用包 exports 只允许无或单一根出口,跨应用复用一律经根出口取件`}},createOnce(e){return{before(){if(!o(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!s(r))return;let i=c(r.exports);i.length>0&&e.report({node:t,message:`禁止 apps 层应用包声明多出口 exports,依据 ADR 0198:应用包 exports 只允许无或单一根出口,跨应用复用一律经根出口取件。发现子出口 [${i.join(`, `)}]。`})}catch{}}}}}),ee=/* @__PURE__ */ new Set([`tsgo`,`tsc`]),te={bareCompiler:`裸调 tsgo 或 tsc 执行类型检查`,legacyDevCliTypecheck:`使用 lzi-dev-cli typecheck 旧封装,应迁移至 lzi-tsgo typecheck`,wrapperWithoutConfig:`lzi-tsgo typecheck 未传 tsconfig 路径`,wrapperWithoutSubcommand:`调用 lzi-tsgo 未带 typecheck 子命令`};function u(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function d(e){return typeof e==`object`&&!!e}function f(e){return e===`typecheck`||e.startsWith(`typecheck:`)}function p(e){return e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(e=>e.length>0)}function m(e){let t=e.split(/\s+/).filter(e=>e.length>0),n=``,r=[];for(let e of t)if(n)r.push(e);else{if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(e))continue;n=e}return n?{command:n,args:r}:null}function h(e,t,n){let r=m(t);if(!r)return null;let i=r.command,a=r.args;return ee.has(i)?n||a.includes(`--noEmit`)?{key:e,kind:`bareCompiler`,segment:t}:null:n?i===`lzi-tsgo`?a[0]===`typecheck`?a.slice(1).some(e=>!e.startsWith(`-`))?null:{key:e,kind:`wrapperWithoutConfig`,segment:t}:{key:e,kind:`wrapperWithoutSubcommand`,segment:t}:i===`lzi-dev-cli`&&a[0]===`typecheck`?{key:e,kind:`legacyDevCliTypecheck`,segment:t}:null:null}function g(e){let t=[];for(let[n,r]of Object.entries(e)){if(typeof r!=`string`)continue;let e=f(n);for(let i of p(r)){let r=h(n,i,e);r&&t.push(r)}}return t}function ne(e){if(!d(e))return null;let t=e.scripts;return d(t)?t:null}function re(e){return`scripts 键 ${e.key} ${te[e.kind]}。类型检查统一使用 lzi-tsgo typecheck 加 tsconfig 路径,依据 ADR 0057 与 ADR 0117。`}const ie=e({meta:{type:`problem`,docs:{description:`禁止在 package.json scripts 中绕过 lzi-tsgo 封装执行类型检查`}},createOnce(e){return{before(){let t=e.filename;if(!u(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=ne(JSON.parse(n));if(r){let n=g(r);for(let r of n)e.report({node:t,message:re(r)})}}catch{}}}}});function ae(e){return/\/domains\/[^/]+\/implementation\/package\.json$/.test(e)}function _(e){return typeof e==`object`&&!!e}function oe(e,t){if(e===`./domain`)return!0;let n=typeof t==`string`?t:_(t)?[t.types,t.import,t.require,t.default].filter(e=>typeof e==`string`).join(` `):``;return/(^|\/)dist\/domain(\.|\/|$)/.test(n)||/(^|\/)src\/domain(\/|$)/.test(n)}const se={noDomainLayerSubpathExport:"禁止领域实现包声明领域分层子路径导出(ADR 0101):领域分层(domain/)为 implementation 包内私有,仓储端口应落位 contract 包;`./domain` 类子导出属违规逃逸通道。"},ce=e({meta:{type:`problem`,docs:{description:`禁止领域实现包声明领域分层子路径导出(ADR 0101 违规逃逸通道)`}},createOnce(e){return{before(){if(!ae(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!_(r)||!_(r.exports))return;for(let[n,i]of Object.entries(r.exports))n!==`.`&&oe(n,i)&&e.report({node:t,message:`${se.noDomainLayerSubpathExport}(发现子路径 "${n}")`})}catch{}}}}}),le=/* @__PURE__ */ new Set([`@types/bun`,`@types/node`,`@typescript/native-preview`,`oxfmt`,`oxlint`,`tsdown`,`turbo`]),ue=[`@longzai-intelligence-agent-tools/`,`@longzai-intelligence-bun/`,`@longzai-intelligence-builder/`,`@longzai-intelligence-changelog/`,`@longzai-intelligence-decision/`,`@longzai-intelligence-dev-tools/`,`@longzai-intelligence-env/`,`@longzai-intelligence-git/`,`@longzai-intelligence-issues/`,`@longzai-intelligence-oxfmt/`,`@longzai-intelligence-oxlint/`,`@longzai-intelligence-release/`,`@longzai-intelligence-tsgo/`,`@longzai-intelligence-tsdown/`,`@longzai-intelligence-typescript/`,`@longzai-intelligence-vitest/`,`@longzai-intelligence-vscode/`],de=/* @__PURE__ */ new Set([`@longzai-intelligence/typescript-config`]),fe=/* @__PURE__ */ new Set([`@longzai-intelligence-dev-tools/vite-plugin`,`@longzai-intelligence-typescript/rolldown-plugin-type-boundary`]);function pe(e){return/\/(apps|packages|domains|plugins)\//.test(e)&&e.endsWith(`/package.json`)}function me(e){return fe.has(e)?!1:le.has(e)||de.has(e)?!0:ue.some(t=>e.startsWith(t))}function v(e){return typeof e==`object`&&!!e}const y=e({meta:{type:`problem`,docs:{description:`禁止子包声明应放 workspace 根的开发依赖,依据 ADR 0036 根已声明与应放根类别由根统一承载`}},createOnce(e){return{before(){if(!pe(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!v(r)||!v(r.devDependencies)||`workspaces`in r)return;let i=Object.keys(r.devDependencies).filter(me);i.length>0&&e.report({node:t,message:`禁止子包声明应放 workspace 根的开发依赖,ADR 0036 判定根已声明与应放根类别均由根统一承载,子包经 Bun hoisting 取用。发现依赖 [${i.join(`, `)}]。`})}catch{}}}}});function b(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function x(e){return typeof e==`object`&&!!e}const S={noMitLicense:`禁止使用 MIT 协议。项目中的所有包都应使用 "license": "UNLICENSED"。`},C=e({meta:{type:`problem`,docs:{description:`禁止在 package.json 中使用 MIT 协议`}},createOnce(e){return{before(){let t=e.filename;if(!b(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);x(r)&&r.license===`MIT`&&e.report({node:t,message:S.noMitLicense})}catch{}}}}});function w(e){return/\/domains\/[^/]+\/infrastructure\/package\.json$/.test(e)}function T(e){return e.endsWith(`-infrastructure`)?`${e.slice(0,-15)}-implementation`:null}function E(e){return typeof e==`object`&&!!e}const D=e({meta:{type:`problem`,docs:{description:`禁止领域基础设施包依赖同域实现包(ADR 0101 依赖图只允许 infrastructure ──> contract)`}},createOnce(e){return{before(){if(!w(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!E(r)||typeof r.name!=`string`)return;let i=T(r.name);if(!i||!E(r.dependencies))return;i in r.dependencies&&e.report({node:t,message:`禁止领域基础设施包依赖同域实现包(ADR 0101):依赖图只允许 infrastructure ──> contract,发现依赖 "${i}"。`})}catch{}}}}});function O(e){return e.endsWith(`/package.json`)}const k=/^(?:\.{1,2}\/)?src\//;function A(e){return typeof e==`object`&&!!e}function j(e,t,n){if(typeof t==`string`)k.test(t)&&n.push({subpath:e,target:t});else if(A(t))for(let r of Object.values(t))j(e,r,n)}function M(e){let t=[];if(typeof e==`string`)return j(`.`,e,t),t;if(A(e))for(let[n,r]of Object.entries(e))j(n,r,t);return t}const N={noSrcExports:`禁止 exports 指向 src 源码(统一 dist 产物范式):包导出一律指向 dist 产物,指向源码会使消费方程序拉入本包源码编译。`},P=e({meta:{type:`problem`,docs:{description:`禁止 exports 指向 src 源码(统一 dist 产物范式门禁)`}},createOnce(e){return{before(){if(!O(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!A(r))return;let i=M(r.exports);for(let n of i)e.report({node:t,message:`${N.noSrcExports}(发现 "${n.subpath}" 指向 "${n.target}")`})}catch{}}}}}),F=[`-domain`,`-contract`,`-implementation`,`-infrastructure`];function I(e){return/\/domains\/[^/]+\/ui\/package\.json$/.test(e)}function L(e){return F.some(t=>e.endsWith(t))}function R(e){return typeof e==`object`&&!!e}const z=e({meta:{type:`problem`,docs:{description:`禁止 domains ui 层声明域内四层包依赖,ADR 0127:UI 面域外依赖唯一指向生成式 sdk 客户端`}},createOnce(e){return{before(){if(!I(e.filename.replace(/\\/g,`/`)))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!R(r)||!R(r.dependencies))return;let i=Object.keys(r.dependencies).filter(L);i.length>0&&e.report({node:t,message:`禁止 ui 层声明域内包依赖,ADR 0127:UI 面域外依赖唯一指向生成式 sdk 客户端,DDD 主体对 ui 全封闭。发现依赖 [${i.join(`, `)}]。`})}catch{}}}}});function he(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function ge(e){return e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(e=>e.length>0)}function _e(e){let t=e.split(/\s+/).filter(e=>e.length>0),n=``,r=[];for(let e of t)if(n)r.push(e);else{if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(e))continue;n=e}return n?{command:n,args:r}:null}const ve={buildToolchainMismatch:`build 脚本命令与所属预设的工具链不符`,buildProdToolchainMismatch:`build:prod 脚本命令与所属预设的工具链不符`,devToolchainMismatch:`dev 脚本命令与所属预设的工具链不符`};function B(e){return typeof e==`object`&&!!e}function ye(e){if(!B(e))return!1;for(let t of[`dev`,`build`,`buildProd`]){let n=e[t];if(n!==void 0&&(!Array.isArray(n)||n.some(e=>typeof e!=`string`)))return!1}return!0}function be(e){if(!B(e))return null;let t=e.scripts;return B(t)?t:null}function V(e,t,n,r){if(r===void 0||r.length===0)return[];let i=e[t];if(typeof i!=`string`)return[];let a=[];for(let e of ge(i)){let i=_e(e);i!==null&&(r.includes(i.command)||a.push({key:t,kind:n,command:i.command,allowedList:r.join(`、`)}))}return a}function H(e,t){return[...V(e,`dev`,`devToolchainMismatch`,t.dev),...V(e,`build`,`buildToolchainMismatch`,t.build),...V(e,`build:prod`,`buildProdToolchainMismatch`,t.buildProd)]}function xe(e){return`scripts 键 ${e.key} 使用命令 "${e.command}",${ve[e.kind]},允许清单为 ${e.allowedList}。build 脚本形态按预设校验,依据 ADR 0220,请改用当前预设允许的命令。`}const Se=e({meta:{type:`problem`,docs:{description:`按预设注入的允许清单校验 package.json 的 dev 与 build 与 build:prod 脚本命令形态`},schema:[{type:`object`,properties:{dev:{type:`array`,items:{type:`string`}},build:{type:`array`,items:{type:`string`}},buildProd:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{before(){let t=e.filename;if(!he(t))return!1},Program(t){let n=e.options?.[0];if(!ye(n)||n.dev===void 0&&n.build===void 0&&n.buildProd===void 0)return;let r=e.sourceCode.text;try{let i=be(JSON.parse(r));if(i){let r=H(i,n);for(let n of r)e.report({node:t,message:xe(n)})}}catch{}}}}}),U=[`mcp`,`cli`,`tui`,`dev`];function Ce(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}const we=/^@longzai-intelligence-([a-z0-9][a-z0-9-]*)\//,Te=/^longzai-intelligence-[a-z0-9][a-z0-9-]*$/;function W(e){return typeof e==`object`&&!!e}function Ee(e){let t=e.replace(/\\/g,`/`).split(`/`);for(let e=t.length-2;e>=0;--e){let n=t[e];if(n!==void 0&&Te.test(n))return n.slice(21)}return null}function De(e){let t=we.exec(e);return t===null?null:t[1]??null}function Oe(e,t){return Ee(e)??De(t)}function G(e){return`lzi-${e}`}function K(e){return e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e}function ke(e,t,n){let r=G(t),i=U.find(t=>e===t||e.endsWith(`-${t}`));if(i!==void 0)return`${r}-${i}`;if(n===void 0)return r;let a=K(n);return e.endsWith(`-${a}`)?`${r}-${a}`:r}function q(e,t,n){let r=G(t);return e===r||U.some(t=>e===`${r}-${t}`)?!0:n!==void 0&&e===`${r}-${K(n)}`}function J(e,t){let n=e.bin;return typeof n==`string`?[K(t)]:W(n)?Object.keys(n):[]}const Ae={invalidBinName:`bin 命令名不符合 ADR 0049 完整名称规范,命令名须为 lzi- 前缀加项目全名的 kebab-case 形态,禁止缩写`};function je(e,t){return`${Ae.invalidBinName},实际命令名为 "${e}",应为 "${t}"。`}const Me=e({meta:{type:`problem`,docs:{description:`校验 package.json 的 bin 命令名使用项目全名,禁止缩写,依据 ADR 0049`}},createOnce(e){return{before(){let t=e.filename;if(!Ce(t))return!1},Program(t){let n=e.sourceCode.text;try{let r=JSON.parse(n);if(!W(r)||typeof r.name!=`string`||r.bin===void 0||r.name.includes(`{{`))return;let i=Oe(e.filename,r.name);if(i===null)return;let a=J(r,r.name);for(let n of a)n.includes(`{{`)||q(n,i,r.name)||e.report({node:t,message:je(n,ke(n,i,r.name))})}catch{}}}}});function Ne(e){return e.replace(/\\/g,`/`).endsWith(`/package.json`)}function Pe(e){return e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(e=>e.length>0)}function Y(e){let t=e.split(/\s+/).filter(e=>e.length>0),n=``,r=[];for(let e of t)if(n)r.push(e);else{if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(e))continue;n=e}return n?{command:n,args:r}:null}const Fe={testToolchainMismatch:`test 脚本命令与所属预设的工具链不符`,testWatchToolchainMismatch:`test:watch 脚本命令与所属预设的工具链不符`,testCoverageToolchainMismatch:`test:coverage 脚本命令与所属预设的工具链不符`};function X(e){return typeof e==`object`&&!!e}function Ie(e){if(!X(e))return!1;for(let t of[`test`,`testWatch`,`testCoverage`]){let n=e[t];if(n!==void 0&&(!Array.isArray(n)||n.some(e=>typeof e!=`string`)))return!1}return!0}function Le(e){if(!X(e))return null;let t=e.scripts;return X(t)?t:null}function Z(e,t,n,r){if(r===void 0||r.length===0)return[];let i=e[t];if(typeof i!=`string`)return[];let a=[];for(let e of Pe(i)){let i=Y(e);i!==null&&(r.includes(i.command)||a.push({key:t,kind:n,command:i.command,allowedList:r.join(`、`)}))}return a}function Q(e,t){return[...Z(e,`test`,`testToolchainMismatch`,t.test),...Z(e,`test:watch`,`testWatchToolchainMismatch`,t.testWatch),...Z(e,`test:coverage`,`testCoverageToolchainMismatch`,t.testCoverage)]}function Re(e){return`scripts 键 ${e.key} 使用命令 "${e.command}",${Fe[e.kind]},允许清单为 ${e.allowedList}。test 脚本形态按预设校验,依据 ADR 0227,请改用当前预设允许的命令。`}const ze=e({meta:{type:`problem`,docs:{description:`按预设注入的允许清单校验 package.json 的 test 与 test:watch 与 test:coverage 脚本命令形态`},schema:[{type:`object`,properties:{test:{type:`array`,items:{type:`string`}},testWatch:{type:`array`,items:{type:`string`}},testCoverage:{type:`array`,items:{type:`string`}}},additionalProperties:!1}]},createOnce(e){return{before(){let t=e.filename;if(!Ne(t))return!1},Program(t){let n=e.options?.[0];if(!Ie(n)||n.test===void 0&&n.testWatch===void 0&&n.testCoverage===void 0)return;let r=e.sourceCode.text;try{let i=Le(JSON.parse(r));if(i){let r=Q(i,n);for(let n of r)e.report({node:t,message:Re(n)})}}catch{}}}}}),$=t({meta:{name:`@longzai-intelligence-oxlint/package-json-plugin`},rules:{"no-app-infrastructure-dependency":a,"no-app-subpath-exports":l,"no-bare-tsgo-invocation":ie,"no-domain-layer-subpath-export":ce,"no-hoistable-dev-dependency":y,"no-mit-license":C,"no-sibling-implementation-dependency":D,"no-src-exports":P,"no-ui-domain-package-dependency":z,"require-build-script-toolchain":Se,"require-full-project-bin-name":Me,"require-test-script-toolchain":ze}});export{$ as default,$ as packageJsonPlugin,H as detectBuildScriptToolchainViolations,Q as detectTestScriptToolchainViolations,J as extractBinNames,c as extractSubpathExits,M as findSrcExportTargets,o as isAppLayerPackageJson,b as isPackageJson,q as isValidBinName,C as noMitLicenseRule};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
2
|
import { t as PresetOptions } from "./preset-options.types-BWSmiunG.js";
|
|
3
3
|
import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-lrryBFJ6.js";
|
|
4
|
-
/**
|
|
5
|
-
* react 域构建形态
|
|
6
|
-
*
|
|
7
|
-
* 工程形即应用宿主单元自身可起可构建,库形即产出 dist 产物
|
|
8
|
-
* 被应用宿主消费的界面库单元
|
|
9
|
-
*/
|
|
10
|
-
type BuildForm = 'application' | 'library';
|
|
11
|
-
/**
|
|
12
|
-
* react 域预设选项
|
|
13
|
-
*
|
|
14
|
-
* 在共享选项之上增加构建形态声明
|
|
15
|
-
*/
|
|
16
|
-
type ReactPresetOptions = PresetOptions & {
|
|
17
|
-
/**
|
|
18
|
-
* 构建形态声明,三键判据按形态规定死
|
|
19
|
-
*
|
|
20
|
-
* @default 'application'
|
|
21
|
-
*/
|
|
22
|
-
buildForm?: BuildForm;
|
|
23
|
-
};
|
|
24
4
|
/**
|
|
25
5
|
* 创建 Oxlint React 配置
|
|
26
6
|
*
|
|
27
|
-
* @param options -
|
|
7
|
+
* @param options - 预设选项,包含额外的规则、覆盖和忽略模式
|
|
28
8
|
* @returns 包含 React 和 JSX a11y 插件的 Oxlint 配置对象
|
|
29
9
|
*/
|
|
30
|
-
declare function defineConfig(options?:
|
|
10
|
+
declare function defineConfig(options?: PresetOptions): OxlintConfig;
|
|
31
11
|
/**
|
|
32
12
|
* 默认 Oxlint React 配置实例
|
|
33
13
|
*/
|
|
34
14
|
declare const oxlintReactConfig: OxlintConfig;
|
|
35
|
-
export { type
|
|
15
|
+
export { type OxlintConfig, type OxlintConfigOverride, oxlintReactConfig as default, defineConfig };
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BqT_7tdF.js";import{s as e,t}from"./base.entry-ihV3q_2I.js";import{t as n}from"./ui-consumption.rules-KvXiDxx6.js";const r={"@longzai-intelligence-oxlint/package-json-plugin/require-build-script-toolchain":[`warn`,{dev:[`lzi-vite`],build:[`lzi-vite`],buildProd:[`bun`]}]}
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e,t}from"./base.entry-ihV3q_2I.js";import{t as n}from"./ui-consumption.rules-KvXiDxx6.js";const r={"@longzai-intelligence-oxlint/package-json-plugin/require-build-script-toolchain":[`warn`,{dev:[`lzi-vite`],build:[`lzi-vite`],buildProd:[`bun`]}]};function i(i){let a=t();return{extends:[a],plugins:[`react`,`jsx-a11y`],...i,rules:{...r,...n,...i?.rules},ignorePatterns:e([...a.ignorePatterns??[],...i?.ignorePatterns??[]])}}const a=i();export{a as default,i as defineConfig};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import { t as PresetOptions } from "./preset-options.types-BWSmiunG.js";
|
|
3
|
+
import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-lrryBFJ6.js";
|
|
4
|
+
/**
|
|
5
|
+
* 创建 Oxlint UI 层工程形配置
|
|
6
|
+
*
|
|
7
|
+
* @param options - 预设选项,包含额外的规则、覆盖和忽略模式
|
|
8
|
+
* @returns 继承 ui-base 基座并注入工程形判据的 Oxlint 配置对象
|
|
9
|
+
*/
|
|
10
|
+
declare function defineConfig(options?: PresetOptions): OxlintConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 默认 Oxlint UI 层工程形配置实例
|
|
13
|
+
*/
|
|
14
|
+
declare const oxlintUiApplicationConfig: OxlintConfig;
|
|
15
|
+
export { type OxlintConfig, type OxlintConfigOverride, oxlintUiApplicationConfig as default, defineConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-ihV3q_2I.js";import{defineConfig as t}from"./ui-base.js";const n={"@longzai-intelligence-oxlint/package-json-plugin/require-build-script-toolchain":[`warn`,{dev:[`lzi-vite`],build:[`lzi-vite`],buildProd:[`bun`]}]};function r(r){let i=t();return{extends:[i],...r,rules:{...n,...r?.rules},ignorePatterns:e([...i.ignorePatterns??[],...r?.ignorePatterns??[]])}}const i=r();export{i as default,r as defineConfig};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import { t as PresetOptions } from "./preset-options.types-BWSmiunG.js";
|
|
3
|
+
import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-lrryBFJ6.js";
|
|
4
|
+
/**
|
|
5
|
+
* 创建 Oxlint UI 层基座配置
|
|
6
|
+
*
|
|
7
|
+
* @param options - 预设选项,包含额外的规则、覆盖和忽略模式
|
|
8
|
+
* @returns 继承 React 栈基座且构建形态不执法的 Oxlint 配置对象
|
|
9
|
+
*/
|
|
10
|
+
declare function defineConfig(options?: PresetOptions): OxlintConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 默认 Oxlint UI 层基座配置实例
|
|
13
|
+
*/
|
|
14
|
+
declare const oxlintUiBaseConfig: OxlintConfig;
|
|
15
|
+
export { type OxlintConfig, type OxlintConfigOverride, oxlintUiBaseConfig as default, defineConfig };
|
package/dist/ui-base.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-ihV3q_2I.js";import{defineConfig as t}from"./react.js";const n={"@longzai-intelligence-oxlint/package-json-plugin/require-build-script-toolchain":[`warn`,{}]};function r(r){let i=t();return{extends:[i],...r,rules:{...n,...r?.rules},ignorePatterns:e([...i.ignorePatterns??[],...r?.ignorePatterns??[]])}}const i=r();export{i as default,r as defineConfig};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import { t as PresetOptions } from "./preset-options.types-BWSmiunG.js";
|
|
3
|
+
import { n as OxlintConfigOverride, t as OxlintConfig } from "./index-lrryBFJ6.js";
|
|
4
|
+
/**
|
|
5
|
+
* 创建 Oxlint UI 层库形配置
|
|
6
|
+
*
|
|
7
|
+
* @param options - 预设选项,包含额外的规则、覆盖和忽略模式
|
|
8
|
+
* @returns 继承 ui-base 基座并注入库形判据的 Oxlint 配置对象
|
|
9
|
+
*/
|
|
10
|
+
declare function defineConfig(options?: PresetOptions): OxlintConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 默认 Oxlint UI 层库形配置实例
|
|
13
|
+
*/
|
|
14
|
+
declare const oxlintUiLibraryConfig: OxlintConfig;
|
|
15
|
+
export { type OxlintConfig, type OxlintConfigOverride, oxlintUiLibraryConfig as default, defineConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{s as e}from"./base.entry-ihV3q_2I.js";import{defineConfig as t}from"./ui-base.js";const n={"@longzai-intelligence-oxlint/package-json-plugin/require-build-script-toolchain":[`warn`,{dev:[`lzi-builder`],build:[`lzi-builder`],buildProd:[`bun`]}]};function r(r){let i=t();return{extends:[i],...r,rules:{...n,...r?.rules},ignorePatterns:e([...i.ignorePatterns??[],...r?.ignorePatterns??[]])}}const i=r();export{i as default,r as defineConfig};
|
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.28",
|
|
4
4
|
"description": "Longzai Intelligence oxlint 配置预设",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -33,6 +33,18 @@
|
|
|
33
33
|
"types": "./dist/react.d.ts",
|
|
34
34
|
"import": "./dist/react.js"
|
|
35
35
|
},
|
|
36
|
+
"./ui-base": {
|
|
37
|
+
"types": "./dist/ui-base.d.ts",
|
|
38
|
+
"import": "./dist/ui-base.js"
|
|
39
|
+
},
|
|
40
|
+
"./ui-application": {
|
|
41
|
+
"types": "./dist/ui-application.d.ts",
|
|
42
|
+
"import": "./dist/ui-application.js"
|
|
43
|
+
},
|
|
44
|
+
"./ui-library": {
|
|
45
|
+
"types": "./dist/ui-library.d.ts",
|
|
46
|
+
"import": "./dist/ui-library.js"
|
|
47
|
+
},
|
|
36
48
|
"./nest": {
|
|
37
49
|
"types": "./dist/nest.d.ts",
|
|
38
50
|
"import": "./dist/nest.js"
|
|
@@ -53,6 +65,10 @@
|
|
|
53
65
|
"types": "./dist/e2e.d.ts",
|
|
54
66
|
"import": "./dist/e2e.js"
|
|
55
67
|
},
|
|
68
|
+
"./e2e-playwright": {
|
|
69
|
+
"types": "./dist/e2e-playwright.d.ts",
|
|
70
|
+
"import": "./dist/e2e-playwright.js"
|
|
71
|
+
},
|
|
56
72
|
"./sdk": {
|
|
57
73
|
"types": "./dist/sdk.d.ts",
|
|
58
74
|
"import": "./dist/sdk.js"
|
|
@@ -105,10 +121,7 @@
|
|
|
105
121
|
"test:coverage": "vitest run --coverage",
|
|
106
122
|
"lint": "oxlint && oxfmt --check",
|
|
107
123
|
"lint:fix": "oxlint --fix && oxfmt",
|
|
108
|
-
"typecheck": "
|
|
109
|
-
"typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
|
|
110
|
-
"typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
|
|
111
|
-
"typecheck:test": "lzi-tsgo typecheck tsconfig/test.json"
|
|
124
|
+
"typecheck": "lzi-typecheck"
|
|
112
125
|
},
|
|
113
126
|
"dependencies": {
|
|
114
127
|
"@longzai-intelligence-vitest/config": "0.0.13",
|
|
@@ -116,33 +129,33 @@
|
|
|
116
129
|
"zod": "^4.6.7"
|
|
117
130
|
},
|
|
118
131
|
"devDependencies": {
|
|
119
|
-
"@longzai-intelligence-oxlint/architecture-core-plugin": "0.2.
|
|
120
|
-
"@longzai-intelligence-oxlint/architecture-electron-plugin": "0.2.
|
|
121
|
-
"@longzai-intelligence-oxlint/architecture-library-plugin": "0.2.
|
|
122
|
-
"@longzai-intelligence-oxlint/code-style-plugin": "0.2.
|
|
123
|
-
"@longzai-intelligence-oxlint/composer-plugin": "0.2.
|
|
124
|
-
"@longzai-intelligence-oxlint/core": "0.2.
|
|
125
|
-
"@longzai-intelligence-oxlint/design-rules-plugin": "0.2.
|
|
126
|
-
"@longzai-intelligence-oxlint/elysia-route-plugin": "0.2.
|
|
127
|
-
"@longzai-intelligence-oxlint/eslint-config-plugin": "0.2.
|
|
128
|
-
"@longzai-intelligence-oxlint/file-naming-plugin": "0.2.
|
|
129
|
-
"@longzai-intelligence-oxlint/lzi-builder-config-plugin": "0.2.
|
|
130
|
-
"@longzai-intelligence-oxlint/lzi-config-plugin": "0.2.
|
|
131
|
-
"@longzai-intelligence-oxlint/nestjs-route-plugin": "0.2.
|
|
132
|
-
"@longzai-intelligence-oxlint/package-json-plugin": "0.2.
|
|
133
|
-
"@longzai-intelligence-oxlint/perfectionist-plugin": "0.2.
|
|
134
|
-
"@longzai-intelligence-oxlint/react-plugin": "0.2.
|
|
135
|
-
"@longzai-intelligence-oxlint/schema-type-separation-plugin": "0.2.
|
|
136
|
-
"@longzai-intelligence-oxlint/stylistic-plugin": "0.2.
|
|
137
|
-
"@longzai-intelligence-oxlint/tsconfig-plugin": "0.2.
|
|
138
|
-
"@longzai-intelligence-oxlint/tsdoc-plugin": "0.2.
|
|
139
|
-
"@longzai-intelligence-oxlint/tsdown-config-plugin": "0.2.
|
|
140
|
-
"@longzai-intelligence-oxlint/tsup-config-plugin": "0.2.
|
|
141
|
-
"@longzai-intelligence-oxlint/typeorm-plugin": "0.2.
|
|
142
|
-
"@longzai-intelligence-oxlint/typescript-eslint-plugin": "0.2.
|
|
143
|
-
"@longzai-intelligence-oxlint/utils": "0.2.
|
|
144
|
-
"@longzai-intelligence-oxlint/vitest-config-plugin": "0.2.
|
|
145
|
-
"@longzai-intelligence-oxlint/zod-plugin": "0.2.
|
|
132
|
+
"@longzai-intelligence-oxlint/architecture-core-plugin": "0.2.28",
|
|
133
|
+
"@longzai-intelligence-oxlint/architecture-electron-plugin": "0.2.28",
|
|
134
|
+
"@longzai-intelligence-oxlint/architecture-library-plugin": "0.2.28",
|
|
135
|
+
"@longzai-intelligence-oxlint/code-style-plugin": "0.2.28",
|
|
136
|
+
"@longzai-intelligence-oxlint/composer-plugin": "0.2.28",
|
|
137
|
+
"@longzai-intelligence-oxlint/core": "0.2.28",
|
|
138
|
+
"@longzai-intelligence-oxlint/design-rules-plugin": "0.2.28",
|
|
139
|
+
"@longzai-intelligence-oxlint/elysia-route-plugin": "0.2.28",
|
|
140
|
+
"@longzai-intelligence-oxlint/eslint-config-plugin": "0.2.28",
|
|
141
|
+
"@longzai-intelligence-oxlint/file-naming-plugin": "0.2.28",
|
|
142
|
+
"@longzai-intelligence-oxlint/lzi-builder-config-plugin": "0.2.28",
|
|
143
|
+
"@longzai-intelligence-oxlint/lzi-config-plugin": "0.2.28",
|
|
144
|
+
"@longzai-intelligence-oxlint/nestjs-route-plugin": "0.2.28",
|
|
145
|
+
"@longzai-intelligence-oxlint/package-json-plugin": "0.2.28",
|
|
146
|
+
"@longzai-intelligence-oxlint/perfectionist-plugin": "0.2.28",
|
|
147
|
+
"@longzai-intelligence-oxlint/react-plugin": "0.2.28",
|
|
148
|
+
"@longzai-intelligence-oxlint/schema-type-separation-plugin": "0.2.28",
|
|
149
|
+
"@longzai-intelligence-oxlint/stylistic-plugin": "0.2.28",
|
|
150
|
+
"@longzai-intelligence-oxlint/tsconfig-plugin": "0.2.28",
|
|
151
|
+
"@longzai-intelligence-oxlint/tsdoc-plugin": "0.2.28",
|
|
152
|
+
"@longzai-intelligence-oxlint/tsdown-config-plugin": "0.2.28",
|
|
153
|
+
"@longzai-intelligence-oxlint/tsup-config-plugin": "0.2.28",
|
|
154
|
+
"@longzai-intelligence-oxlint/typeorm-plugin": "0.2.28",
|
|
155
|
+
"@longzai-intelligence-oxlint/typescript-eslint-plugin": "0.2.28",
|
|
156
|
+
"@longzai-intelligence-oxlint/utils": "0.2.28",
|
|
157
|
+
"@longzai-intelligence-oxlint/vitest-config-plugin": "0.2.28",
|
|
158
|
+
"@longzai-intelligence-oxlint/zod-plugin": "0.2.28",
|
|
146
159
|
"@vitest/coverage-v8": "^4.1.10"
|
|
147
160
|
},
|
|
148
161
|
"peerDependencies": {
|