@longzai-intelligence-oxlint/utils 0.0.42 → 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} +4 -5
- package/package.json +8 -13
- package/dist/index.cjs +0 -1
- package/dist/index.d.mts +0 -360
- /package/dist/{index.mjs → index.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Context } from "@oxlint/plugins";
|
|
2
1
|
import * as z from "zod/mini";
|
|
3
|
-
|
|
2
|
+
import { Context } from "@oxlint/plugins";
|
|
4
3
|
//#region src/types/rule.types.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Oxlint 规则上下文类型
|
|
@@ -59,9 +58,9 @@ declare const NodeWithIdentifierAndRangeSchema: z.ZodMiniObject<{
|
|
|
59
58
|
*/
|
|
60
59
|
declare const ImportSpecifierSchema: z.ZodMiniObject<{
|
|
61
60
|
type: z.ZodMiniEnum<{
|
|
62
|
-
ImportSpecifier: "ImportSpecifier";
|
|
63
61
|
ImportDefaultSpecifier: "ImportDefaultSpecifier";
|
|
64
62
|
ImportNamespaceSpecifier: "ImportNamespaceSpecifier";
|
|
63
|
+
ImportSpecifier: "ImportSpecifier";
|
|
65
64
|
}>;
|
|
66
65
|
imported: z.ZodMiniObject<{
|
|
67
66
|
name: z.ZodMiniString<string>;
|
|
@@ -80,9 +79,9 @@ declare const ImportDeclarationSchema: z.ZodMiniObject<{
|
|
|
80
79
|
}, z.core.$strip>;
|
|
81
80
|
specifiers: z.ZodMiniArray<z.ZodMiniObject<{
|
|
82
81
|
type: z.ZodMiniEnum<{
|
|
83
|
-
ImportSpecifier: "ImportSpecifier";
|
|
84
82
|
ImportDefaultSpecifier: "ImportDefaultSpecifier";
|
|
85
83
|
ImportNamespaceSpecifier: "ImportNamespaceSpecifier";
|
|
84
|
+
ImportSpecifier: "ImportSpecifier";
|
|
86
85
|
}>;
|
|
87
86
|
imported: z.ZodMiniObject<{
|
|
88
87
|
name: z.ZodMiniString<string>;
|
|
@@ -357,4 +356,4 @@ declare function isPlugin(obj: unknown): obj is Plugin;
|
|
|
357
356
|
*/
|
|
358
357
|
declare function getPluginName(plugin: unknown): string;
|
|
359
358
|
//#endregion
|
|
360
|
-
export {
|
|
359
|
+
export { CallExpressionNode, CallExpressionSchema, ExportDefaultDeclarationNode, ExportDefaultDeclarationSchema, ImportDeclarationNode, ImportDeclarationSchema, ImportSpecifierNode, ImportSpecifierSchema, NodeWithIdentifier, NodeWithIdentifierAndRange, NodeWithIdentifierAndRangeSchema, NodeWithIdentifierSchema, ObjectExpressionNode, ObjectExpressionSchema, type OxlintContext, Plugin, PluginMeta, PluginMetaSchema, PluginSchema, type RuleState, getFileName, getImportedNames, getPluginName, hasAnyFileSuffix, hasFileSuffix, hasIPrefix, hasIdWithName, hasIdWithNameAndRange, hasImportedName, isCallExpressionNode, isDefaultImport, isImportDeclaration, isImportSpecifier, isInExcludedPath, isNamespaceImport, isObjectExpressionNode, isPlugin, isTestFile, isValidDtoNameCamelCase, isValidDtoNameUpperCase, removeIPrefix, toDtoCamelCase, toDtoUpperCase };
|
package/package.json
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-oxlint/utils",
|
|
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 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`zod/mini`);c=s(c,1);let l=require(`node:path`);l=s(l,1);const u=c.object({id:c.object({name:c.string()}),type:c.string()}),d=c.object({id:c.object({name:c.string(),range:c.tuple([c.number(),c.number()])}),type:c.string()}),f=c.object({type:c.enum([`ImportSpecifier`,`ImportDefaultSpecifier`,`ImportNamespaceSpecifier`]),imported:c.object({name:c.string()}),local:c.object({name:c.string()})}),p=c.object({type:c.literal(`ImportDeclaration`),source:c.object({value:c.string()}),specifiers:c.array(f)}),m=c.object({type:c.literal(`ExportDefaultDeclaration`),declaration:c.object({type:c.string(),name:c.optional(c.string()),callee:c.optional(c.object({name:c.optional(c.string())})),properties:c.optional(c.array(c.unknown()))})}),h=c.object({type:c.literal(`CallExpression`),callee:c.object({name:c.union([c.string(),c.undefined()])})}),g=c.object({type:c.literal(`ObjectExpression`)}),_=c.object({name:c.string()}),v=c.object({meta:_});function y(e){return p.safeParse(e).success}function b(e){return f.safeParse(e).success}function x(e){return e.type===`ImportDefaultSpecifier`}function S(e){return e.type===`ImportNamespaceSpecifier`}function C(e){return e.specifiers.filter(b).map(e=>e.imported.name)}function w(e,t){return C(e).includes(t)}function T(e){return e.endsWith(`.test.ts`)||e.endsWith(`.spec.ts`)}function E(e,t){return e.endsWith(t)}function D(e,t){return t.some(t=>e.endsWith(t))}function O(e){return l.default.basename(e)}function k(e,t){let n=e.replace(/\\/g,`/`);return t.some(e=>n.endsWith(e))}function A(e){return/^I[A-Z]/.test(e)}function j(e){return e.endsWith(`DTO`)}function M(e){return e.endsWith(`Dto`)}function N(e){return A(e)?e.substring(1):e}function P(e){return e.replace(/DTO$/,`Dto`)}function F(e){return e.replace(/Dto$/,`DTO`)}function I(e){return u.safeParse(e).success}function L(e){return d.safeParse(e).success}function R(e){return h.safeParse(e).success}function z(e){return g.safeParse(e).success}function B(e){return v.safeParse(e).success}function V(e){let t=v.safeParse(e);if(!t.success)throw Error(`无效的 Oxlint 插件:插件对象必须包含 meta.name 属性`);return t.data.meta.name}exports.CallExpressionSchema=h,exports.ExportDefaultDeclarationSchema=m,exports.ImportDeclarationSchema=p,exports.ImportSpecifierSchema=f,exports.NodeWithIdentifierAndRangeSchema=d,exports.NodeWithIdentifierSchema=u,exports.ObjectExpressionSchema=g,exports.PluginMetaSchema=_,exports.PluginSchema=v,exports.getFileName=O,exports.getImportedNames=C,exports.getPluginName=V,exports.hasAnyFileSuffix=D,exports.hasFileSuffix=E,exports.hasIPrefix=A,exports.hasIdWithName=I,exports.hasIdWithNameAndRange=L,exports.hasImportedName=w,exports.isCallExpressionNode=R,exports.isDefaultImport=x,exports.isImportDeclaration=y,exports.isImportSpecifier=b,exports.isInExcludedPath=k,exports.isNamespaceImport=S,exports.isObjectExpressionNode=z,exports.isPlugin=B,exports.isTestFile=T,exports.isValidDtoNameCamelCase=M,exports.isValidDtoNameUpperCase=j,exports.removeIPrefix=N,exports.toDtoCamelCase=P,exports.toDtoUpperCase=F;
|
package/dist/index.d.mts
DELETED
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/mini";
|
|
2
|
-
import { Context } from "@oxlint/plugins";
|
|
3
|
-
|
|
4
|
-
//#region src/types/rule.types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Oxlint 规则上下文类型
|
|
7
|
-
*/
|
|
8
|
-
type OxlintContext = Context;
|
|
9
|
-
/**
|
|
10
|
-
* 规则状态类型
|
|
11
|
-
*
|
|
12
|
-
* 用于在规则执行过程中跟踪状态
|
|
13
|
-
*/
|
|
14
|
-
type RuleState = {
|
|
15
|
-
/**
|
|
16
|
-
* 是否有有效的导入
|
|
17
|
-
*/
|
|
18
|
-
hasValidImport: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* 是否有禁止的导入
|
|
21
|
-
*/
|
|
22
|
-
hasForbiddenImport: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* 是否有默认导出
|
|
25
|
-
*/
|
|
26
|
-
hasExportDefault: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* 禁止导入的节点
|
|
29
|
-
*/
|
|
30
|
-
forbiddenImportNode: unknown | null;
|
|
31
|
-
/**
|
|
32
|
-
* 禁止导入的名称
|
|
33
|
-
*/
|
|
34
|
-
forbiddenImportName: string;
|
|
35
|
-
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/schemas/ast.schemas.d.ts
|
|
38
|
-
/**
|
|
39
|
-
* 带有标识符的节点 schema
|
|
40
|
-
*/
|
|
41
|
-
declare const NodeWithIdentifierSchema: z.ZodMiniObject<{
|
|
42
|
-
id: z.ZodMiniObject<{
|
|
43
|
-
name: z.ZodMiniString<string>;
|
|
44
|
-
}, z.core.$strip>;
|
|
45
|
-
type: z.ZodMiniString<string>;
|
|
46
|
-
}, z.core.$strip>;
|
|
47
|
-
/**
|
|
48
|
-
* 带有标识符和范围的节点 schema
|
|
49
|
-
*/
|
|
50
|
-
declare const NodeWithIdentifierAndRangeSchema: z.ZodMiniObject<{
|
|
51
|
-
id: z.ZodMiniObject<{
|
|
52
|
-
name: z.ZodMiniString<string>;
|
|
53
|
-
range: z.ZodMiniTuple<readonly [z.ZodMiniNumber<number>, z.ZodMiniNumber<number>], null>;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
type: z.ZodMiniString<string>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
/**
|
|
58
|
-
* Import 说明符 schema
|
|
59
|
-
*/
|
|
60
|
-
declare const ImportSpecifierSchema: z.ZodMiniObject<{
|
|
61
|
-
type: z.ZodMiniEnum<{
|
|
62
|
-
ImportSpecifier: "ImportSpecifier";
|
|
63
|
-
ImportDefaultSpecifier: "ImportDefaultSpecifier";
|
|
64
|
-
ImportNamespaceSpecifier: "ImportNamespaceSpecifier";
|
|
65
|
-
}>;
|
|
66
|
-
imported: z.ZodMiniObject<{
|
|
67
|
-
name: z.ZodMiniString<string>;
|
|
68
|
-
}, z.core.$strip>;
|
|
69
|
-
local: z.ZodMiniObject<{
|
|
70
|
-
name: z.ZodMiniString<string>;
|
|
71
|
-
}, z.core.$strip>;
|
|
72
|
-
}, z.core.$strip>;
|
|
73
|
-
/**
|
|
74
|
-
* Import 声明 schema
|
|
75
|
-
*/
|
|
76
|
-
declare const ImportDeclarationSchema: z.ZodMiniObject<{
|
|
77
|
-
type: z.ZodMiniLiteral<"ImportDeclaration">;
|
|
78
|
-
source: z.ZodMiniObject<{
|
|
79
|
-
value: z.ZodMiniString<string>;
|
|
80
|
-
}, z.core.$strip>;
|
|
81
|
-
specifiers: z.ZodMiniArray<z.ZodMiniObject<{
|
|
82
|
-
type: z.ZodMiniEnum<{
|
|
83
|
-
ImportSpecifier: "ImportSpecifier";
|
|
84
|
-
ImportDefaultSpecifier: "ImportDefaultSpecifier";
|
|
85
|
-
ImportNamespaceSpecifier: "ImportNamespaceSpecifier";
|
|
86
|
-
}>;
|
|
87
|
-
imported: z.ZodMiniObject<{
|
|
88
|
-
name: z.ZodMiniString<string>;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
local: z.ZodMiniObject<{
|
|
91
|
-
name: z.ZodMiniString<string>;
|
|
92
|
-
}, z.core.$strip>;
|
|
93
|
-
}, z.core.$strip>>;
|
|
94
|
-
}, z.core.$strip>;
|
|
95
|
-
/**
|
|
96
|
-
* Export Default 声明 schema
|
|
97
|
-
*/
|
|
98
|
-
declare const ExportDefaultDeclarationSchema: z.ZodMiniObject<{
|
|
99
|
-
type: z.ZodMiniLiteral<"ExportDefaultDeclaration">;
|
|
100
|
-
declaration: z.ZodMiniObject<{
|
|
101
|
-
type: z.ZodMiniString<string>;
|
|
102
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
|
-
callee: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
104
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
105
|
-
}, z.core.$strip>>;
|
|
106
|
-
properties: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
107
|
-
}, z.core.$strip>;
|
|
108
|
-
}, z.core.$strip>;
|
|
109
|
-
/**
|
|
110
|
-
* CallExpression 节点 schema
|
|
111
|
-
*/
|
|
112
|
-
declare const CallExpressionSchema: z.ZodMiniObject<{
|
|
113
|
-
type: z.ZodMiniLiteral<"CallExpression">;
|
|
114
|
-
callee: z.ZodMiniObject<{
|
|
115
|
-
name: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUndefined]>;
|
|
116
|
-
}, z.core.$strip>;
|
|
117
|
-
}, z.core.$strip>;
|
|
118
|
-
/**
|
|
119
|
-
* ObjectExpression 节点 schema
|
|
120
|
-
*/
|
|
121
|
-
declare const ObjectExpressionSchema: z.ZodMiniObject<{
|
|
122
|
-
type: z.ZodMiniLiteral<"ObjectExpression">;
|
|
123
|
-
}, z.core.$strip>;
|
|
124
|
-
/**
|
|
125
|
-
* 从 schema 推导的类型
|
|
126
|
-
*/
|
|
127
|
-
type NodeWithIdentifier = z.infer<typeof NodeWithIdentifierSchema>;
|
|
128
|
-
/**
|
|
129
|
-
* 带有标识符和范围的 AST 节点类型
|
|
130
|
-
*/
|
|
131
|
-
type NodeWithIdentifierAndRange = z.infer<typeof NodeWithIdentifierAndRangeSchema>;
|
|
132
|
-
/**
|
|
133
|
-
* Import 说明符节点类型
|
|
134
|
-
*/
|
|
135
|
-
type ImportSpecifierNode = z.infer<typeof ImportSpecifierSchema>;
|
|
136
|
-
/**
|
|
137
|
-
* Import 声明节点类型
|
|
138
|
-
*/
|
|
139
|
-
type ImportDeclarationNode = z.infer<typeof ImportDeclarationSchema>;
|
|
140
|
-
/**
|
|
141
|
-
* Export Default 声明节点类型
|
|
142
|
-
*/
|
|
143
|
-
type ExportDefaultDeclarationNode = z.infer<typeof ExportDefaultDeclarationSchema>;
|
|
144
|
-
/**
|
|
145
|
-
* CallExpression 节点类型
|
|
146
|
-
*/
|
|
147
|
-
type CallExpressionNode = z.infer<typeof CallExpressionSchema>;
|
|
148
|
-
/**
|
|
149
|
-
* ObjectExpression 节点类型
|
|
150
|
-
*/
|
|
151
|
-
type ObjectExpressionNode = z.infer<typeof ObjectExpressionSchema>;
|
|
152
|
-
//#endregion
|
|
153
|
-
//#region src/schemas/plugin.schemas.d.ts
|
|
154
|
-
/**
|
|
155
|
-
* 插件元信息 schema
|
|
156
|
-
*/
|
|
157
|
-
declare const PluginMetaSchema: z.ZodMiniObject<{
|
|
158
|
-
name: z.ZodMiniString<string>;
|
|
159
|
-
}, z.core.$strip>;
|
|
160
|
-
/**
|
|
161
|
-
* 插件 schema
|
|
162
|
-
*/
|
|
163
|
-
declare const PluginSchema: z.ZodMiniObject<{
|
|
164
|
-
meta: z.ZodMiniObject<{
|
|
165
|
-
name: z.ZodMiniString<string>;
|
|
166
|
-
}, z.core.$strip>;
|
|
167
|
-
}, z.core.$strip>;
|
|
168
|
-
/**
|
|
169
|
-
* 从 schema 推导的类型
|
|
170
|
-
*/
|
|
171
|
-
type PluginMeta = z.infer<typeof PluginMetaSchema>;
|
|
172
|
-
/**
|
|
173
|
-
* 插件配置类型
|
|
174
|
-
*/
|
|
175
|
-
type Plugin = z.infer<typeof PluginSchema>;
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region src/utils/import.utils.d.ts
|
|
178
|
-
/**
|
|
179
|
-
* 检查节点是否为 ImportDeclaration
|
|
180
|
-
*
|
|
181
|
-
* @param node - AST 节点
|
|
182
|
-
* @returns 是否为 ImportDeclaration
|
|
183
|
-
*/
|
|
184
|
-
declare function isImportDeclaration(node: unknown): node is ImportDeclarationNode;
|
|
185
|
-
/**
|
|
186
|
-
* 检查说明符是否为 ImportSpecifier
|
|
187
|
-
*
|
|
188
|
-
* @param specifier - Import 说明符
|
|
189
|
-
* @returns 是否为 ImportSpecifier
|
|
190
|
-
*/
|
|
191
|
-
declare function isImportSpecifier(specifier: unknown): specifier is ImportSpecifierNode;
|
|
192
|
-
/**
|
|
193
|
-
* 检查是否为默认导入
|
|
194
|
-
*
|
|
195
|
-
* @param specifier - Import 说明符
|
|
196
|
-
* @returns 是否为默认导入
|
|
197
|
-
*/
|
|
198
|
-
declare function isDefaultImport(specifier: ImportSpecifierNode): boolean;
|
|
199
|
-
/**
|
|
200
|
-
* 检查是否为命名空间导入
|
|
201
|
-
*
|
|
202
|
-
* @param specifier - Import 说明符
|
|
203
|
-
* @returns 是否为命名空间导入
|
|
204
|
-
*/
|
|
205
|
-
declare function isNamespaceImport(specifier: ImportSpecifierNode): boolean;
|
|
206
|
-
/**
|
|
207
|
-
* 从 ImportDeclaration 中提取所有导入的名称
|
|
208
|
-
*
|
|
209
|
-
* @param node - Import 声明节点
|
|
210
|
-
* @returns 导入的名称列表
|
|
211
|
-
*/
|
|
212
|
-
declare function getImportedNames(node: ImportDeclarationNode): string[];
|
|
213
|
-
/**
|
|
214
|
-
* 检查 ImportDeclaration 是否导入了指定名称
|
|
215
|
-
*
|
|
216
|
-
* @param node - Import 声明节点
|
|
217
|
-
* @param name - 要检查的名称
|
|
218
|
-
* @returns 是否导入了指定名称
|
|
219
|
-
*/
|
|
220
|
-
declare function hasImportedName(node: ImportDeclarationNode, name: string): boolean;
|
|
221
|
-
//#endregion
|
|
222
|
-
//#region src/utils/file.utils.d.ts
|
|
223
|
-
/**
|
|
224
|
-
* 检查文件是否为测试文件
|
|
225
|
-
*
|
|
226
|
-
* @param fileName - 文件名
|
|
227
|
-
* @returns 是否为测试文件
|
|
228
|
-
*/
|
|
229
|
-
declare function isTestFile(fileName: string): boolean;
|
|
230
|
-
/**
|
|
231
|
-
* 检查文件是否匹配指定后缀
|
|
232
|
-
*
|
|
233
|
-
* @param fileName - 文件名
|
|
234
|
-
* @param suffix - 文件后缀
|
|
235
|
-
* @returns 是否匹配
|
|
236
|
-
*/
|
|
237
|
-
declare function hasFileSuffix(fileName: string, suffix: string): boolean;
|
|
238
|
-
/**
|
|
239
|
-
* 检查文件是否匹配任意后缀
|
|
240
|
-
*
|
|
241
|
-
* @param fileName - 文件名
|
|
242
|
-
* @param suffixes - 文件后缀列表
|
|
243
|
-
* @returns 是否匹配任意后缀
|
|
244
|
-
*/
|
|
245
|
-
declare function hasAnyFileSuffix(fileName: string, suffixes: string[]): boolean;
|
|
246
|
-
/**
|
|
247
|
-
* 获取文件名(不含路径)
|
|
248
|
-
*
|
|
249
|
-
* @param filePath - 文件路径
|
|
250
|
-
* @returns 文件名
|
|
251
|
-
*/
|
|
252
|
-
declare function getFileName(filePath: string): string;
|
|
253
|
-
/**
|
|
254
|
-
* 检查文件是否在排除路径中
|
|
255
|
-
*
|
|
256
|
-
* @param filePath - 文件路径
|
|
257
|
-
* @param excludedPaths - 排除路径列表
|
|
258
|
-
* @returns 是否在排除路径中
|
|
259
|
-
*/
|
|
260
|
-
declare function isInExcludedPath(filePath: string, excludedPaths: string[]): boolean;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/utils/naming.utils.d.ts
|
|
263
|
-
/**
|
|
264
|
-
* 命名工具函数
|
|
265
|
-
*
|
|
266
|
-
* 提供命名检查和转换的工具函数
|
|
267
|
-
*/
|
|
268
|
-
/**
|
|
269
|
-
* 检查名称是否使用 I 前缀(匈牙利命名法)
|
|
270
|
-
*
|
|
271
|
-
* @param name - 要检查的名称
|
|
272
|
-
* @returns 是否使用 I 前缀
|
|
273
|
-
*/
|
|
274
|
-
declare function hasIPrefix(name: string): boolean;
|
|
275
|
-
/**
|
|
276
|
-
* 检查名称是否符合 DTO 命名规范(DTO 全大写)
|
|
277
|
-
*
|
|
278
|
-
* @param name - 要检查的名称
|
|
279
|
-
* @returns 是否符合 DTO 命名规范
|
|
280
|
-
*/
|
|
281
|
-
declare function isValidDtoNameUpperCase(name: string): boolean;
|
|
282
|
-
/**
|
|
283
|
-
* 检查名称是否符合 DTO 命名规范(Dto 驼峰式)
|
|
284
|
-
*
|
|
285
|
-
* @param name - 要检查的名称
|
|
286
|
-
* @returns 是否符合 DTO 命名规范
|
|
287
|
-
*/
|
|
288
|
-
declare function isValidDtoNameCamelCase(name: string): boolean;
|
|
289
|
-
/**
|
|
290
|
-
* 移除 I 前缀
|
|
291
|
-
*
|
|
292
|
-
* @param name - 原始名称
|
|
293
|
-
* @returns 移除 I 前缀后的名称
|
|
294
|
-
*/
|
|
295
|
-
declare function removeIPrefix(name: string): string;
|
|
296
|
-
/**
|
|
297
|
-
* 将 DTO 后缀转换为驼峰式
|
|
298
|
-
*
|
|
299
|
-
* @param name - 原始名称
|
|
300
|
-
* @returns 转换后的名称
|
|
301
|
-
*/
|
|
302
|
-
declare function toDtoCamelCase(name: string): string;
|
|
303
|
-
/**
|
|
304
|
-
* 将 DTO 后缀转换为大写
|
|
305
|
-
*
|
|
306
|
-
* @param name - 原始名称
|
|
307
|
-
* @returns 转换后的名称
|
|
308
|
-
*/
|
|
309
|
-
declare function toDtoUpperCase(name: string): string;
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/guards/ast.guards.d.ts
|
|
312
|
-
/**
|
|
313
|
-
* 检查节点是否有 id 属性且 id 有 name 属性
|
|
314
|
-
*
|
|
315
|
-
* @param node - AST 节点
|
|
316
|
-
* @returns 如果有则返回 true
|
|
317
|
-
*/
|
|
318
|
-
declare function hasIdWithName(node: unknown): node is NodeWithIdentifier;
|
|
319
|
-
/**
|
|
320
|
-
* 检查节点是否有 id 属性且 id 有 name 和 range 属性
|
|
321
|
-
*
|
|
322
|
-
* @param node - AST 节点
|
|
323
|
-
* @returns 如果有则返回 true
|
|
324
|
-
*/
|
|
325
|
-
declare function hasIdWithNameAndRange(node: unknown): node is NodeWithIdentifierAndRange;
|
|
326
|
-
/**
|
|
327
|
-
* 检查节点是否为 CallExpression
|
|
328
|
-
*
|
|
329
|
-
* @param obj - 待检查的对象
|
|
330
|
-
* @returns 是否为 CallExpression
|
|
331
|
-
*/
|
|
332
|
-
declare function isCallExpressionNode(obj: unknown): obj is CallExpressionNode;
|
|
333
|
-
/**
|
|
334
|
-
* 检查节点是否为 ObjectExpression
|
|
335
|
-
*
|
|
336
|
-
* @param obj - 待检查的对象
|
|
337
|
-
* @returns 是否为 ObjectExpression
|
|
338
|
-
*/
|
|
339
|
-
declare function isObjectExpressionNode(obj: unknown): obj is ObjectExpressionNode;
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region src/guards/plugin.guards.d.ts
|
|
342
|
-
/**
|
|
343
|
-
* 检查对象是否为有效的 Oxlint 插件
|
|
344
|
-
*
|
|
345
|
-
* @param obj - 待检查的对象
|
|
346
|
-
* @returns 是否为有效的 Oxlint 插件
|
|
347
|
-
*/
|
|
348
|
-
declare function isPlugin(obj: unknown): obj is Plugin;
|
|
349
|
-
/**
|
|
350
|
-
* 获取插件名称
|
|
351
|
-
*
|
|
352
|
-
* 如果插件无效则抛出错误,确保返回值一定是 string
|
|
353
|
-
*
|
|
354
|
-
* @param plugin - Oxlint 插件
|
|
355
|
-
* @returns 插件名称
|
|
356
|
-
* @throws {@link Error} 如果插件无效或插件名称未定义
|
|
357
|
-
*/
|
|
358
|
-
declare function getPluginName(plugin: unknown): string;
|
|
359
|
-
//#endregion
|
|
360
|
-
export { type CallExpressionNode, CallExpressionSchema, type ExportDefaultDeclarationNode, ExportDefaultDeclarationSchema, type ImportDeclarationNode, ImportDeclarationSchema, type ImportSpecifierNode, ImportSpecifierSchema, type NodeWithIdentifier, type NodeWithIdentifierAndRange, NodeWithIdentifierAndRangeSchema, NodeWithIdentifierSchema, type ObjectExpressionNode, ObjectExpressionSchema, OxlintContext, Plugin, PluginMeta, PluginMetaSchema, PluginSchema, RuleState, getFileName, getImportedNames, getPluginName, hasAnyFileSuffix, hasFileSuffix, hasIPrefix, hasIdWithName, hasIdWithNameAndRange, hasImportedName, isCallExpressionNode, isDefaultImport, isImportDeclaration, isImportSpecifier, isInExcludedPath, isNamespaceImport, isObjectExpressionNode, isPlugin, isTestFile, isValidDtoNameCamelCase, isValidDtoNameUpperCase, removeIPrefix, toDtoCamelCase, toDtoUpperCase };
|
|
File without changes
|