@longzai-intelligence-oxlint/core 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.d.cts → index.d.ts} +1 -1
- package/package.json +8 -13
- package/dist/index.cjs +0 -2
- package/dist/index.d.mts +0 -180
- /package/dist/{index.mjs → index.js} +0 -0
|
@@ -177,4 +177,4 @@ declare function inferDirFromStack(stack: string): string | undefined;
|
|
|
177
177
|
*/
|
|
178
178
|
declare function inferCallerDir(): string | undefined;
|
|
179
179
|
//#endregion
|
|
180
|
-
export { OxlintConfig, OxlintConfigOptions, OxlintConfigOverride, OxlintRuleConfig, OxlintRules, OxlintSeverity, defineOxlintConfig, extractDirFromFilePath, extractFilePathFromStackLine, inferCallerDir, inferDirFromStack, isOxlintConfigPath, oxlintDefaults, typescriptEslintDefaultOverrides, typescriptEslintRecommendedDefaults, unicornDefaults };
|
|
180
|
+
export { type OxlintConfig, type OxlintConfigOptions, type OxlintConfigOverride, type OxlintRuleConfig, type OxlintRules, type OxlintSeverity, defineOxlintConfig, extractDirFromFilePath, extractFilePathFromStackLine, inferCallerDir, inferDirFromStack, isOxlintConfigPath, oxlintDefaults, typescriptEslintDefaultOverrides, typescriptEslintRecommendedDefaults, unicornDefaults };
|
package/package.json
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-oxlint/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"type": "module",
|
|
9
|
-
"main": "./dist/index.
|
|
10
|
-
"
|
|
11
|
-
"types": "./dist/index.d.mts",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
|
-
"types":
|
|
15
|
-
|
|
16
|
-
"require": "./dist/index.d.cts"
|
|
17
|
-
},
|
|
18
|
-
"import": "./dist/index.mjs",
|
|
19
|
-
"require": "./dist/index.cjs"
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
20
15
|
}
|
|
21
16
|
},
|
|
22
17
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
-
"build:prod": "NODE_ENV=production
|
|
18
|
+
"build": "lzi-builder",
|
|
19
|
+
"build:prod": "NODE_ENV=production lzi-builder",
|
|
25
20
|
"prepublishOnly": "bun run build:prod",
|
|
26
|
-
"dev": "
|
|
21
|
+
"dev": "lzi-builder --watch",
|
|
27
22
|
"clean": "lzi-dev-cli clean",
|
|
28
23
|
"test": "vitest run",
|
|
29
24
|
"test:watch": "vitest",
|
package/dist/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`node:path`),t=require(`node:path/win32`),n=require(`node:url`);const r={"max-lines":[`error`,{max:400,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":[`error`,{max:200,skipBlankLines:!0,skipComments:!0}],"no-useless-rename":`error`,"sort-imports":[`error`,{ignoreDeclarationSort:!0,ignoreMemberSort:!1,ignoreCase:!0}]},i={"typescript/no-explicit-any":`error`,"typescript/no-non-null-assertion":`error`,"typescript/no-extra-non-null-assertion":`error`,"typescript/no-misused-new":`error`,"typescript/no-this-alias":`error`,"typescript/no-unnecessary-type-constraint":`error`,"typescript/no-unsafe-argument":`error`,"typescript/no-unsafe-assignment":`error`,"typescript/no-unsafe-call":`error`,"typescript/no-unsafe-member-access":`error`,"typescript/no-unsafe-return":`error`,"typescript/no-require-imports":`error`,"typescript/triple-slash-reference":`error`},a=[{files:[`**/*.cjs`],rules:{"typescript/no-require-imports":`off`}}],o={"unicorn/prefer-node-protocol":`error`,"unicorn/no-empty-file":`error`},s=[`**/node_modules/**`,`**/dist/**`,`**/out/**`,`**/.next/**`,`**/coverage/**`,`**/.bun/**`,`**/tailwind/*.mjs`,`**/tsup.config.bundled_*.mjs`],c={...r,...i,...o},l=[`typescript`,`unicorn`,`import`],u=[...a];function d(e={}){let{rules:t,overrides:n,ignorePatterns:r,plugins:i,jsPlugins:a}=e;return{ignorePatterns:[...s,...r??[]],plugins:[...l,...i??[]],jsPlugins:a??[...l],rules:{...c,...t},overrides:[...u,...n??[]]}}function f(e){for(let t of[/\((file:\/\/[^):\s]+):\d+:\d+\)/,/\(([^):\s]+):\d+:\d+\)/,/at\s+(file:\/\/[^):\s]+):\d+:\d+/,/at\s+([^):\s]+):\d+:\d+/,/at\s+async\s+(file:\/\/[^):\s]+):\d+:\d+/,/at\s+async\s+([^):\s]+):\d+:\d+/]){let n=e.match(t);if(n?.[1])return n[1]}return null}function p(e){return e.endsWith(`/oxlint.config.ts`)||e.endsWith(`\\oxlint.config.ts`)||e.endsWith(`/oxlint.config.js`)||e.endsWith(`\\oxlint.config.js`)||e===`oxlint.config.ts`||e===`oxlint.config.js`}function m(e){return/^[A-Za-z]:/.test(e)||e.includes(`\\`)}function h(r){return r.startsWith(`file://`)?(0,e.dirname)((0,n.fileURLToPath)(r)):m(r)?(0,t.dirname)(r):(0,e.dirname)(r)}function g(e){let t=e.split(`
|
|
2
|
-
`);for(let e=0;e<t.length;e++){let n=t[e];if(!n)continue;let r=f(n);if(r&&p(r))return h(r)}}function _(){let e=Error().stack;if(e)return g(e)}exports.defineOxlintConfig=d,exports.extractDirFromFilePath=h,exports.extractFilePathFromStackLine=f,exports.inferCallerDir=_,exports.inferDirFromStack=g,exports.isOxlintConfigPath=p,exports.oxlintDefaults=r,exports.typescriptEslintDefaultOverrides=a,exports.typescriptEslintRecommendedDefaults=i,exports.unicornDefaults=o;
|
package/dist/index.d.mts
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
//#region src/types/config.types.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Oxlint 核心类型定义
|
|
4
|
-
*
|
|
5
|
-
* 提供所有 oxlint 相关包共享的类型定义。
|
|
6
|
-
* 仅包含有消费者的类型。
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Oxlint 规则严重级别
|
|
10
|
-
*/
|
|
11
|
-
type OxlintSeverity = 'off' | 'warn' | 'error';
|
|
12
|
-
/**
|
|
13
|
-
* Oxlint 规则配置项
|
|
14
|
-
*
|
|
15
|
-
* 单条规则的配置,支持仅严重级别或带选项的配置
|
|
16
|
-
*/
|
|
17
|
-
type OxlintRuleConfig = OxlintSeverity | [OxlintSeverity, ...unknown[]];
|
|
18
|
-
/**
|
|
19
|
-
* Oxlint 规则集
|
|
20
|
-
*
|
|
21
|
-
* 规则名到配置项的映射
|
|
22
|
-
*/
|
|
23
|
-
type OxlintRules = Record<string, OxlintRuleConfig>;
|
|
24
|
-
/**
|
|
25
|
-
* Oxlint 配置覆盖项
|
|
26
|
-
*/
|
|
27
|
-
type OxlintConfigOverride = {
|
|
28
|
-
/**
|
|
29
|
-
* 匹配的文件模式数组
|
|
30
|
-
*/
|
|
31
|
-
files: string[];
|
|
32
|
-
/**
|
|
33
|
-
* 应用于匹配文件的规则配置
|
|
34
|
-
*/
|
|
35
|
-
rules?: OxlintRules;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Oxlint 配置选项
|
|
39
|
-
*/
|
|
40
|
-
type OxlintConfig = {
|
|
41
|
-
/**
|
|
42
|
-
* 继承的配置列表
|
|
43
|
-
*/
|
|
44
|
-
extends?: OxlintConfig[];
|
|
45
|
-
/**
|
|
46
|
-
* Rust 插件列表
|
|
47
|
-
*/
|
|
48
|
-
plugins?: string[];
|
|
49
|
-
/**
|
|
50
|
-
* JavaScript 插件列表
|
|
51
|
-
*/
|
|
52
|
-
jsPlugins?: string[];
|
|
53
|
-
/**
|
|
54
|
-
* 规则配置
|
|
55
|
-
*/
|
|
56
|
-
rules?: OxlintRules;
|
|
57
|
-
/**
|
|
58
|
-
* 针对特定文件的配置覆盖
|
|
59
|
-
*/
|
|
60
|
-
overrides?: OxlintConfigOverride[];
|
|
61
|
-
/**
|
|
62
|
-
* 忽略的文件模式列表
|
|
63
|
-
*/
|
|
64
|
-
ignorePatterns?: string[];
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* defineOxlintConfig 工厂函数的选项参数
|
|
68
|
-
*
|
|
69
|
-
* 所有字段均为可选,工厂函数内部提供完整的默认值。
|
|
70
|
-
* 传入的值会与默认值合并,不会替换。
|
|
71
|
-
*/
|
|
72
|
-
type OxlintConfigOptions = {
|
|
73
|
-
/**
|
|
74
|
-
* 额外的规则配置,与默认规则合并
|
|
75
|
-
*/
|
|
76
|
-
rules?: OxlintRules;
|
|
77
|
-
/**
|
|
78
|
-
* 额外的文件覆盖配置,追加到默认覆盖之后
|
|
79
|
-
*/
|
|
80
|
-
overrides?: OxlintConfigOverride[];
|
|
81
|
-
/**
|
|
82
|
-
* 额外的忽略模式,追加到默认忽略模式之后
|
|
83
|
-
*/
|
|
84
|
-
ignorePatterns?: string[];
|
|
85
|
-
/**
|
|
86
|
-
* 额外的 Rust 插件,追加到默认插件列表之后
|
|
87
|
-
*/
|
|
88
|
-
plugins?: string[];
|
|
89
|
-
/**
|
|
90
|
-
* JS 插件列表,替代默认的 JS 插件列表
|
|
91
|
-
*/
|
|
92
|
-
jsPlugins?: string[];
|
|
93
|
-
};
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/defaults/define-oxlint-config.config.d.ts
|
|
96
|
-
/**
|
|
97
|
-
* 创建 Oxlint 配置
|
|
98
|
-
*
|
|
99
|
-
* 工厂函数内部自动组装所有默认规则、默认覆盖、默认忽略模式和默认插件。
|
|
100
|
-
* 调用方只需传入项目特定参数,传入的值会与默认值合并而非替换。
|
|
101
|
-
*
|
|
102
|
-
* @param options - 配置选项,所有字段均为可选
|
|
103
|
-
* @returns Oxlint 配置对象
|
|
104
|
-
*/
|
|
105
|
-
declare function defineOxlintConfig(options?: OxlintConfigOptions): OxlintConfig;
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region src/defaults/oxlint-defaults.config.d.ts
|
|
108
|
-
/**
|
|
109
|
-
* Oxlint 原生规则默认配置
|
|
110
|
-
*
|
|
111
|
-
* 明文列出 oxlint 原生规则的默认值,作为组织级共享配置的配置源。
|
|
112
|
-
* 配置参考:https://oxc.rs/docs/guide/usage/linter/rules.html
|
|
113
|
-
*/
|
|
114
|
-
declare const oxlintDefaults: Record<string, OxlintRuleConfig>;
|
|
115
|
-
//#endregion
|
|
116
|
-
//#region src/defaults/typescript-eslint-defaults.config.d.ts
|
|
117
|
-
/**
|
|
118
|
-
* Oxlint 原生规则默认配置 - typescript-eslint 推荐规则
|
|
119
|
-
*
|
|
120
|
-
* typescript-eslint/recommended 中 Oxlint 原生支持的规则默认值,
|
|
121
|
-
* 作为组织级共享配置的配置源。
|
|
122
|
-
* Oxlint 中 typescript 规则带 typescript/ 前缀。
|
|
123
|
-
*/
|
|
124
|
-
declare const typescriptEslintRecommendedDefaults: Record<string, OxlintRuleConfig>;
|
|
125
|
-
/**
|
|
126
|
-
* typescript-eslint 默认覆盖配置
|
|
127
|
-
*
|
|
128
|
-
* 核心规则的文件级豁免,确保共享包出厂配置即可正确处理各文件类型。
|
|
129
|
-
*/
|
|
130
|
-
declare const typescriptEslintDefaultOverrides: OxlintConfigOverride[];
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/defaults/unicorn-defaults.config.d.ts
|
|
133
|
-
/**
|
|
134
|
-
* Oxlint 原生规则默认配置 - unicorn 规则
|
|
135
|
-
*
|
|
136
|
-
* 明文列出 oxlint unicorn 插件规则的默认值,作为组织级共享配置的配置源。
|
|
137
|
-
* 配置参考:https://oxc.rs/docs/guide/usage/linter/rules.html
|
|
138
|
-
*/
|
|
139
|
-
declare const unicornDefaults: Record<string, OxlintRuleConfig>;
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/utils/infer-caller-dir.utils.d.ts
|
|
142
|
-
/**
|
|
143
|
-
* 从堆栈行中提取文件路径
|
|
144
|
-
*
|
|
145
|
-
* @param line - 堆栈行
|
|
146
|
-
* @returns 文件路径,无法提取时返回 null
|
|
147
|
-
*/
|
|
148
|
-
declare function extractFilePathFromStackLine(line: string): string | null;
|
|
149
|
-
/**
|
|
150
|
-
* 检查文件路径是否为 oxlint 配置文件
|
|
151
|
-
*
|
|
152
|
-
* @param filePath - 文件路径
|
|
153
|
-
* @returns 是否为 oxlint 配置文件
|
|
154
|
-
*/
|
|
155
|
-
declare function isOxlintConfigPath(filePath: string): boolean;
|
|
156
|
-
/**
|
|
157
|
-
* 从文件路径提取目录路径
|
|
158
|
-
*
|
|
159
|
-
* @param filePath - 文件路径
|
|
160
|
-
* @returns 目录路径
|
|
161
|
-
*/
|
|
162
|
-
declare function extractDirFromFilePath(filePath: string): string;
|
|
163
|
-
/**
|
|
164
|
-
* 从堆栈字符串中推断 oxlint 配置文件所在目录
|
|
165
|
-
*
|
|
166
|
-
* @param stack - 堆栈字符串
|
|
167
|
-
* @returns 目录路径,无法推断时返回 undefined
|
|
168
|
-
*/
|
|
169
|
-
declare function inferDirFromStack(stack: string): string | undefined;
|
|
170
|
-
/**
|
|
171
|
-
* 通过调用栈推断调用者目录
|
|
172
|
-
*
|
|
173
|
-
* 该函数解析 Error.stack 获取调用配置函数的文件路径
|
|
174
|
-
* 支持 V8 引擎 (Node.js/Bun/Chrome) 的堆栈格式
|
|
175
|
-
*
|
|
176
|
-
* @returns 调用者文件所在目录,推断失败时返回 undefined
|
|
177
|
-
*/
|
|
178
|
-
declare function inferCallerDir(): string | undefined;
|
|
179
|
-
//#endregion
|
|
180
|
-
export { OxlintConfig, OxlintConfigOptions, OxlintConfigOverride, OxlintRuleConfig, OxlintRules, OxlintSeverity, defineOxlintConfig, extractDirFromFilePath, extractFilePathFromStackLine, inferCallerDir, inferDirFromStack, isOxlintConfigPath, oxlintDefaults, typescriptEslintDefaultOverrides, typescriptEslintRecommendedDefaults, unicornDefaults };
|
|
File without changes
|