auto-cr-rules 1.0.0
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.
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
/**
|
|
5
|
+
* 检查相对路径的深度,如果超过最大允许深度则报告错误
|
|
6
|
+
* @param sourceValue - 导入源路径
|
|
7
|
+
* @param path - Babel AST path 对象
|
|
8
|
+
* @param report - 报告函数
|
|
9
|
+
* @param maxDepth - 最大允许的深度
|
|
10
|
+
*/
|
|
11
|
+
function checkRelativePath(sourceValue, path, maxDepth, report) {
|
|
12
|
+
// 只检查相对路径
|
|
13
|
+
if (sourceValue.startsWith('.')) {
|
|
14
|
+
// 计算路径深度:通过计算 "../" 的出现次数
|
|
15
|
+
const depth = (sourceValue.match(/\.\.\//g) || []).length;
|
|
16
|
+
if (depth > maxDepth) {
|
|
17
|
+
report(path, `导入路径 "${sourceValue}" 不能超过最大层级${maxDepth}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// 导出Babel插件函数
|
|
22
|
+
function default_1(api, options) {
|
|
23
|
+
const { types: t } = api;
|
|
24
|
+
const maxDepth = 2;
|
|
25
|
+
// 从插件参数中获取 report 方法,如果没有提供则使用默认的 console.error
|
|
26
|
+
const { report } = options;
|
|
27
|
+
return {
|
|
28
|
+
name: 'no-deep-relative-imports',
|
|
29
|
+
visitor: {
|
|
30
|
+
// 处理静态导入语句
|
|
31
|
+
ImportDeclaration(path) {
|
|
32
|
+
const sourceValue = path.node.source.value;
|
|
33
|
+
if (typeof sourceValue === 'string') {
|
|
34
|
+
checkRelativePath(sourceValue, path, maxDepth, report);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// 处理动态 import() 语句和 require() 调用
|
|
38
|
+
CallExpression(path) {
|
|
39
|
+
// 检查是否是 import() 调用
|
|
40
|
+
if (t.isImport(path.node.callee)) {
|
|
41
|
+
const firstArg = path.node.arguments[0];
|
|
42
|
+
// 确保第一个参数是字符串字面量
|
|
43
|
+
if (firstArg && t.isStringLiteral(firstArg)) {
|
|
44
|
+
const sourceValue = firstArg.value;
|
|
45
|
+
checkRelativePath(sourceValue, path, maxDepth, report);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// 检查是否是 require() 调用
|
|
49
|
+
else if (t.isIdentifier(path.node.callee, { name: 'require' }) ||
|
|
50
|
+
(t.isMemberExpression(path.node.callee) &&
|
|
51
|
+
t.isIdentifier(path.node.callee.object, { name: 'require' }))) {
|
|
52
|
+
const firstArg = path.node.arguments[0];
|
|
53
|
+
// 确保第一个参数是字符串字面量
|
|
54
|
+
if (firstArg && t.isStringLiteral(firstArg)) {
|
|
55
|
+
const sourceValue = firstArg.value;
|
|
56
|
+
checkRelativePath(sourceValue, path, maxDepth, report);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BabelCore from '@babel/core';
|
|
2
|
+
import type { CallExpression, ImportDeclaration } from '@babel/types';
|
|
3
|
+
import type { NodePath } from '@babel/traverse';
|
|
4
|
+
export default function (api: typeof BabelCore, options: PluginOptions): {
|
|
5
|
+
name: string;
|
|
6
|
+
visitor: {
|
|
7
|
+
ImportDeclaration(path: NodePath<ImportDeclaration>): void;
|
|
8
|
+
CallExpression(path: NodePath<CallExpression>): void;
|
|
9
|
+
};
|
|
10
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auto-cr-rules",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"rules"
|
|
11
|
+
],
|
|
12
|
+
"author": "wangweiwei",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"packageManager": "pnpm@10.15.1",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@babel/types": "^7.28.4",
|
|
18
|
+
"@types/babel__core": "^7.20.5",
|
|
19
|
+
"@types/babel__traverse": "^7.28.0",
|
|
20
|
+
"typescript": "^5.9.2"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@babel/core": "^7.28.4"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import BabelCore from '@babel/core'
|
|
2
|
+
import type { CallExpression, ImportDeclaration } from '@babel/types'
|
|
3
|
+
import type { NodePath } from '@babel/traverse'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 检查相对路径的深度,如果超过最大允许深度则报告错误
|
|
7
|
+
* @param sourceValue - 导入源路径
|
|
8
|
+
* @param path - Babel AST path 对象
|
|
9
|
+
* @param report - 报告函数
|
|
10
|
+
* @param maxDepth - 最大允许的深度
|
|
11
|
+
*/
|
|
12
|
+
function checkRelativePath(
|
|
13
|
+
sourceValue: string,
|
|
14
|
+
path: NodePath<ImportDeclaration> | NodePath<CallExpression>,
|
|
15
|
+
maxDepth: number,
|
|
16
|
+
report: PluginOptions['report']
|
|
17
|
+
): void {
|
|
18
|
+
// 只检查相对路径
|
|
19
|
+
if (sourceValue.startsWith('.')) {
|
|
20
|
+
// 计算路径深度:通过计算 "../" 的出现次数
|
|
21
|
+
const depth = (sourceValue.match(/\.\.\//g) || []).length
|
|
22
|
+
|
|
23
|
+
if (depth > maxDepth) {
|
|
24
|
+
report<ImportDeclaration | CallExpression>(
|
|
25
|
+
path,
|
|
26
|
+
`导入路径 "${sourceValue}" 不能超过最大层级${maxDepth}`
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 导出Babel插件函数
|
|
33
|
+
export default function (api: typeof BabelCore, options: PluginOptions) {
|
|
34
|
+
const { types: t } = api
|
|
35
|
+
const maxDepth = 2
|
|
36
|
+
// 从插件参数中获取 report 方法,如果没有提供则使用默认的 console.error
|
|
37
|
+
const { report } = options
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
name: 'no-deep-relative-imports',
|
|
41
|
+
visitor: {
|
|
42
|
+
// 处理静态导入语句
|
|
43
|
+
ImportDeclaration(path: NodePath<ImportDeclaration>) {
|
|
44
|
+
const sourceValue = path.node.source.value
|
|
45
|
+
if (typeof sourceValue === 'string') {
|
|
46
|
+
checkRelativePath(sourceValue, path, maxDepth, report)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// 处理动态 import() 语句和 require() 调用
|
|
50
|
+
CallExpression(path: NodePath<CallExpression>) {
|
|
51
|
+
// 检查是否是 import() 调用
|
|
52
|
+
if (t.isImport(path.node.callee)) {
|
|
53
|
+
const firstArg = path.node.arguments[0]
|
|
54
|
+
// 确保第一个参数是字符串字面量
|
|
55
|
+
if (firstArg && t.isStringLiteral(firstArg)) {
|
|
56
|
+
const sourceValue = firstArg.value
|
|
57
|
+
checkRelativePath(sourceValue, path, maxDepth, report)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// 检查是否是 require() 调用
|
|
61
|
+
else if (
|
|
62
|
+
t.isIdentifier(path.node.callee, { name: 'require' }) ||
|
|
63
|
+
(t.isMemberExpression(path.node.callee) &&
|
|
64
|
+
t.isIdentifier(path.node.callee.object, { name: 'require' }))
|
|
65
|
+
) {
|
|
66
|
+
const firstArg = path.node.arguments[0]
|
|
67
|
+
// 确保第一个参数是字符串字面量
|
|
68
|
+
if (firstArg && t.isStringLiteral(firstArg)) {
|
|
69
|
+
const sourceValue = firstArg.value
|
|
70
|
+
checkRelativePath(sourceValue, path, maxDepth, report)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import { type NodePath } from '@babel/traverse'
|
|
2
|
+
import type {
|
|
3
|
+
AnyTypeAnnotation,
|
|
4
|
+
ArgumentPlaceholder,
|
|
5
|
+
ArrayExpression,
|
|
6
|
+
ArrayPattern,
|
|
7
|
+
ArrayTypeAnnotation,
|
|
8
|
+
ArrowFunctionExpression,
|
|
9
|
+
AssignmentExpression,
|
|
10
|
+
AssignmentPattern,
|
|
11
|
+
AwaitExpression,
|
|
12
|
+
BigIntLiteral,
|
|
13
|
+
BinaryExpression,
|
|
14
|
+
BindExpression,
|
|
15
|
+
BlockStatement,
|
|
16
|
+
BooleanLiteral,
|
|
17
|
+
BooleanLiteralTypeAnnotation,
|
|
18
|
+
BooleanTypeAnnotation,
|
|
19
|
+
BreakStatement,
|
|
20
|
+
CallExpression,
|
|
21
|
+
CatchClause,
|
|
22
|
+
ClassAccessorProperty,
|
|
23
|
+
ClassBody,
|
|
24
|
+
ClassDeclaration,
|
|
25
|
+
ClassExpression,
|
|
26
|
+
ClassImplements,
|
|
27
|
+
ClassMethod,
|
|
28
|
+
ClassPrivateMethod,
|
|
29
|
+
ClassPrivateProperty,
|
|
30
|
+
ClassProperty,
|
|
31
|
+
ConditionalExpression,
|
|
32
|
+
ContinueStatement,
|
|
33
|
+
DebuggerStatement,
|
|
34
|
+
DecimalLiteral,
|
|
35
|
+
DeclareClass,
|
|
36
|
+
DeclaredPredicate,
|
|
37
|
+
DeclareExportAllDeclaration,
|
|
38
|
+
DeclareExportDeclaration,
|
|
39
|
+
DeclareFunction,
|
|
40
|
+
DeclareInterface,
|
|
41
|
+
DeclareModule,
|
|
42
|
+
DeclareModuleExports,
|
|
43
|
+
DeclareOpaqueType,
|
|
44
|
+
DeclareTypeAlias,
|
|
45
|
+
DeclareVariable,
|
|
46
|
+
Decorator,
|
|
47
|
+
Directive,
|
|
48
|
+
DirectiveLiteral,
|
|
49
|
+
DoExpression,
|
|
50
|
+
DoWhileStatement,
|
|
51
|
+
EmptyStatement,
|
|
52
|
+
EmptyTypeAnnotation,
|
|
53
|
+
EnumBooleanBody,
|
|
54
|
+
EnumBooleanMember,
|
|
55
|
+
EnumDeclaration,
|
|
56
|
+
EnumDefaultedMember,
|
|
57
|
+
EnumNumberBody,
|
|
58
|
+
EnumNumberMember,
|
|
59
|
+
EnumStringBody,
|
|
60
|
+
EnumStringMember,
|
|
61
|
+
EnumSymbolBody,
|
|
62
|
+
ExistsTypeAnnotation,
|
|
63
|
+
ExportAllDeclaration,
|
|
64
|
+
ExportDefaultDeclaration,
|
|
65
|
+
ExportDefaultSpecifier,
|
|
66
|
+
ExportNamedDeclaration,
|
|
67
|
+
ExportNamespaceSpecifier,
|
|
68
|
+
ExportSpecifier,
|
|
69
|
+
ExpressionStatement,
|
|
70
|
+
File,
|
|
71
|
+
ForInStatement,
|
|
72
|
+
ForOfStatement,
|
|
73
|
+
ForStatement,
|
|
74
|
+
FunctionDeclaration,
|
|
75
|
+
FunctionExpression,
|
|
76
|
+
FunctionTypeAnnotation,
|
|
77
|
+
FunctionTypeParam,
|
|
78
|
+
GenericTypeAnnotation,
|
|
79
|
+
Identifier,
|
|
80
|
+
IfStatement,
|
|
81
|
+
Import,
|
|
82
|
+
ImportAttribute,
|
|
83
|
+
ImportDeclaration,
|
|
84
|
+
ImportDefaultSpecifier,
|
|
85
|
+
ImportExpression,
|
|
86
|
+
ImportNamespaceSpecifier,
|
|
87
|
+
ImportSpecifier,
|
|
88
|
+
IndexedAccessType,
|
|
89
|
+
InferredPredicate,
|
|
90
|
+
InterfaceDeclaration,
|
|
91
|
+
InterfaceExtends,
|
|
92
|
+
InterfaceTypeAnnotation,
|
|
93
|
+
InterpreterDirective,
|
|
94
|
+
IntersectionTypeAnnotation,
|
|
95
|
+
JSXAttribute,
|
|
96
|
+
JSXClosingElement,
|
|
97
|
+
JSXClosingFragment,
|
|
98
|
+
JSXElement,
|
|
99
|
+
JSXEmptyExpression,
|
|
100
|
+
JSXExpressionContainer,
|
|
101
|
+
JSXFragment,
|
|
102
|
+
JSXIdentifier,
|
|
103
|
+
JSXMemberExpression,
|
|
104
|
+
JSXNamespacedName,
|
|
105
|
+
JSXOpeningElement,
|
|
106
|
+
JSXOpeningFragment,
|
|
107
|
+
JSXSpreadAttribute,
|
|
108
|
+
JSXSpreadChild,
|
|
109
|
+
JSXText,
|
|
110
|
+
LabeledStatement,
|
|
111
|
+
LogicalExpression,
|
|
112
|
+
MemberExpression,
|
|
113
|
+
MetaProperty,
|
|
114
|
+
MixedTypeAnnotation,
|
|
115
|
+
ModuleExpression,
|
|
116
|
+
NewExpression,
|
|
117
|
+
Noop,
|
|
118
|
+
NullableTypeAnnotation,
|
|
119
|
+
NullLiteral,
|
|
120
|
+
NullLiteralTypeAnnotation,
|
|
121
|
+
NumberLiteralTypeAnnotation,
|
|
122
|
+
NumberTypeAnnotation,
|
|
123
|
+
NumericLiteral,
|
|
124
|
+
ObjectExpression,
|
|
125
|
+
ObjectMethod,
|
|
126
|
+
ObjectPattern,
|
|
127
|
+
ObjectProperty,
|
|
128
|
+
ObjectTypeAnnotation,
|
|
129
|
+
ObjectTypeCallProperty,
|
|
130
|
+
ObjectTypeIndexer,
|
|
131
|
+
ObjectTypeInternalSlot,
|
|
132
|
+
ObjectTypeProperty,
|
|
133
|
+
ObjectTypeSpreadProperty,
|
|
134
|
+
OpaqueType,
|
|
135
|
+
OptionalCallExpression,
|
|
136
|
+
OptionalIndexedAccessType,
|
|
137
|
+
OptionalMemberExpression,
|
|
138
|
+
ParenthesizedExpression,
|
|
139
|
+
PipelineBareFunction,
|
|
140
|
+
PipelinePrimaryTopicReference,
|
|
141
|
+
PipelineTopicExpression,
|
|
142
|
+
Placeholder,
|
|
143
|
+
PrivateName,
|
|
144
|
+
Program,
|
|
145
|
+
QualifiedTypeIdentifier,
|
|
146
|
+
RecordExpression,
|
|
147
|
+
RegExpLiteral,
|
|
148
|
+
RestElement,
|
|
149
|
+
ReturnStatement,
|
|
150
|
+
SequenceExpression,
|
|
151
|
+
SpreadElement,
|
|
152
|
+
StaticBlock,
|
|
153
|
+
StringLiteral,
|
|
154
|
+
StringLiteralTypeAnnotation,
|
|
155
|
+
StringTypeAnnotation,
|
|
156
|
+
Super,
|
|
157
|
+
SwitchCase,
|
|
158
|
+
SwitchStatement,
|
|
159
|
+
SymbolTypeAnnotation,
|
|
160
|
+
TaggedTemplateExpression,
|
|
161
|
+
TemplateElement,
|
|
162
|
+
TemplateLiteral,
|
|
163
|
+
ThisExpression,
|
|
164
|
+
ThisTypeAnnotation,
|
|
165
|
+
ThrowStatement,
|
|
166
|
+
TopicReference,
|
|
167
|
+
TryStatement,
|
|
168
|
+
TSAnyKeyword,
|
|
169
|
+
TSArrayType,
|
|
170
|
+
TSAsExpression,
|
|
171
|
+
TSBigIntKeyword,
|
|
172
|
+
TSBooleanKeyword,
|
|
173
|
+
TSCallSignatureDeclaration,
|
|
174
|
+
TSConditionalType,
|
|
175
|
+
TSConstructorType,
|
|
176
|
+
TSConstructSignatureDeclaration,
|
|
177
|
+
TSDeclareFunction,
|
|
178
|
+
TSDeclareMethod,
|
|
179
|
+
TSEnumBody,
|
|
180
|
+
TSEnumDeclaration,
|
|
181
|
+
TSEnumMember,
|
|
182
|
+
TSExportAssignment,
|
|
183
|
+
TSExpressionWithTypeArguments,
|
|
184
|
+
TSExternalModuleReference,
|
|
185
|
+
TSFunctionType,
|
|
186
|
+
TSImportEqualsDeclaration,
|
|
187
|
+
TSImportType,
|
|
188
|
+
TSIndexedAccessType,
|
|
189
|
+
TSIndexSignature,
|
|
190
|
+
TSInferType,
|
|
191
|
+
TSInstantiationExpression,
|
|
192
|
+
TSInterfaceBody,
|
|
193
|
+
TSInterfaceDeclaration,
|
|
194
|
+
TSIntersectionType,
|
|
195
|
+
TSIntrinsicKeyword,
|
|
196
|
+
TSLiteralType,
|
|
197
|
+
TSMappedType,
|
|
198
|
+
TSMethodSignature,
|
|
199
|
+
TSModuleBlock,
|
|
200
|
+
TSModuleDeclaration,
|
|
201
|
+
TSNamedTupleMember,
|
|
202
|
+
TSNamespaceExportDeclaration,
|
|
203
|
+
TSNeverKeyword,
|
|
204
|
+
TSNonNullExpression,
|
|
205
|
+
TSNullKeyword,
|
|
206
|
+
TSNumberKeyword,
|
|
207
|
+
TSObjectKeyword,
|
|
208
|
+
TSOptionalType,
|
|
209
|
+
TSParameterProperty,
|
|
210
|
+
TSParenthesizedType,
|
|
211
|
+
TSPropertySignature,
|
|
212
|
+
TSQualifiedName,
|
|
213
|
+
TSRestType,
|
|
214
|
+
TSSatisfiesExpression,
|
|
215
|
+
TSStringKeyword,
|
|
216
|
+
TSSymbolKeyword,
|
|
217
|
+
TSTemplateLiteralType,
|
|
218
|
+
TSThisType,
|
|
219
|
+
TSTupleType,
|
|
220
|
+
TSTypeAliasDeclaration,
|
|
221
|
+
TSTypeAnnotation,
|
|
222
|
+
TSTypeAssertion,
|
|
223
|
+
TSTypeLiteral,
|
|
224
|
+
TSTypeOperator,
|
|
225
|
+
TSTypeParameter,
|
|
226
|
+
TSTypeParameterDeclaration,
|
|
227
|
+
TSTypeParameterInstantiation,
|
|
228
|
+
TSTypePredicate,
|
|
229
|
+
TSTypeQuery,
|
|
230
|
+
TSTypeReference,
|
|
231
|
+
TSUndefinedKeyword,
|
|
232
|
+
TSUnionType,
|
|
233
|
+
TSUnknownKeyword,
|
|
234
|
+
TSVoidKeyword,
|
|
235
|
+
TupleExpression,
|
|
236
|
+
TupleTypeAnnotation,
|
|
237
|
+
TypeAlias,
|
|
238
|
+
TypeAnnotation,
|
|
239
|
+
TypeCastExpression,
|
|
240
|
+
TypeofTypeAnnotation,
|
|
241
|
+
TypeParameter,
|
|
242
|
+
TypeParameterDeclaration,
|
|
243
|
+
TypeParameterInstantiation,
|
|
244
|
+
UnaryExpression,
|
|
245
|
+
UnionTypeAnnotation,
|
|
246
|
+
UpdateExpression,
|
|
247
|
+
V8IntrinsicIdentifier,
|
|
248
|
+
VariableDeclaration,
|
|
249
|
+
VariableDeclarator,
|
|
250
|
+
Variance,
|
|
251
|
+
VoidPattern,
|
|
252
|
+
VoidTypeAnnotation,
|
|
253
|
+
WhileStatement,
|
|
254
|
+
WithStatement,
|
|
255
|
+
YieldExpression,
|
|
256
|
+
} from '@babel/types'
|
|
257
|
+
|
|
258
|
+
type Node =
|
|
259
|
+
| AnyTypeAnnotation
|
|
260
|
+
| ArgumentPlaceholder
|
|
261
|
+
| ArrayExpression
|
|
262
|
+
| ArrayPattern
|
|
263
|
+
| ArrayTypeAnnotation
|
|
264
|
+
| ArrowFunctionExpression
|
|
265
|
+
| AssignmentExpression
|
|
266
|
+
| AssignmentPattern
|
|
267
|
+
| AwaitExpression
|
|
268
|
+
| BigIntLiteral
|
|
269
|
+
| BinaryExpression
|
|
270
|
+
| BindExpression
|
|
271
|
+
| BlockStatement
|
|
272
|
+
| BooleanLiteral
|
|
273
|
+
| BooleanLiteralTypeAnnotation
|
|
274
|
+
| BooleanTypeAnnotation
|
|
275
|
+
| BreakStatement
|
|
276
|
+
| CallExpression
|
|
277
|
+
| CatchClause
|
|
278
|
+
| ClassAccessorProperty
|
|
279
|
+
| ClassBody
|
|
280
|
+
| ClassDeclaration
|
|
281
|
+
| ClassExpression
|
|
282
|
+
| ClassImplements
|
|
283
|
+
| ClassMethod
|
|
284
|
+
| ClassPrivateMethod
|
|
285
|
+
| ClassPrivateProperty
|
|
286
|
+
| ClassProperty
|
|
287
|
+
| ConditionalExpression
|
|
288
|
+
| ContinueStatement
|
|
289
|
+
| DebuggerStatement
|
|
290
|
+
| DecimalLiteral
|
|
291
|
+
| DeclareClass
|
|
292
|
+
| DeclareExportAllDeclaration
|
|
293
|
+
| DeclareExportDeclaration
|
|
294
|
+
| DeclareFunction
|
|
295
|
+
| DeclareInterface
|
|
296
|
+
| DeclareModule
|
|
297
|
+
| DeclareModuleExports
|
|
298
|
+
| DeclareOpaqueType
|
|
299
|
+
| DeclareTypeAlias
|
|
300
|
+
| DeclareVariable
|
|
301
|
+
| DeclaredPredicate
|
|
302
|
+
| Decorator
|
|
303
|
+
| Directive
|
|
304
|
+
| DirectiveLiteral
|
|
305
|
+
| DoExpression
|
|
306
|
+
| DoWhileStatement
|
|
307
|
+
| EmptyStatement
|
|
308
|
+
| EmptyTypeAnnotation
|
|
309
|
+
| EnumBooleanBody
|
|
310
|
+
| EnumBooleanMember
|
|
311
|
+
| EnumDeclaration
|
|
312
|
+
| EnumDefaultedMember
|
|
313
|
+
| EnumNumberBody
|
|
314
|
+
| EnumNumberMember
|
|
315
|
+
| EnumStringBody
|
|
316
|
+
| EnumStringMember
|
|
317
|
+
| EnumSymbolBody
|
|
318
|
+
| ExistsTypeAnnotation
|
|
319
|
+
| ExportAllDeclaration
|
|
320
|
+
| ExportDefaultDeclaration
|
|
321
|
+
| ExportDefaultSpecifier
|
|
322
|
+
| ExportNamedDeclaration
|
|
323
|
+
| ExportNamespaceSpecifier
|
|
324
|
+
| ExportSpecifier
|
|
325
|
+
| ExpressionStatement
|
|
326
|
+
| File
|
|
327
|
+
| ForInStatement
|
|
328
|
+
| ForOfStatement
|
|
329
|
+
| ForStatement
|
|
330
|
+
| FunctionDeclaration
|
|
331
|
+
| FunctionExpression
|
|
332
|
+
| FunctionTypeAnnotation
|
|
333
|
+
| FunctionTypeParam
|
|
334
|
+
| GenericTypeAnnotation
|
|
335
|
+
| Identifier
|
|
336
|
+
| IfStatement
|
|
337
|
+
| Import
|
|
338
|
+
| ImportAttribute
|
|
339
|
+
| ImportDeclaration
|
|
340
|
+
| ImportDefaultSpecifier
|
|
341
|
+
| ImportExpression
|
|
342
|
+
| ImportNamespaceSpecifier
|
|
343
|
+
| ImportSpecifier
|
|
344
|
+
| IndexedAccessType
|
|
345
|
+
| InferredPredicate
|
|
346
|
+
| InterfaceDeclaration
|
|
347
|
+
| InterfaceExtends
|
|
348
|
+
| InterfaceTypeAnnotation
|
|
349
|
+
| InterpreterDirective
|
|
350
|
+
| IntersectionTypeAnnotation
|
|
351
|
+
| JSXAttribute
|
|
352
|
+
| JSXClosingElement
|
|
353
|
+
| JSXClosingFragment
|
|
354
|
+
| JSXElement
|
|
355
|
+
| JSXEmptyExpression
|
|
356
|
+
| JSXExpressionContainer
|
|
357
|
+
| JSXFragment
|
|
358
|
+
| JSXIdentifier
|
|
359
|
+
| JSXMemberExpression
|
|
360
|
+
| JSXNamespacedName
|
|
361
|
+
| JSXOpeningElement
|
|
362
|
+
| JSXOpeningFragment
|
|
363
|
+
| JSXSpreadAttribute
|
|
364
|
+
| JSXSpreadChild
|
|
365
|
+
| JSXText
|
|
366
|
+
| LabeledStatement
|
|
367
|
+
| LogicalExpression
|
|
368
|
+
| MemberExpression
|
|
369
|
+
| MetaProperty
|
|
370
|
+
| MixedTypeAnnotation
|
|
371
|
+
| ModuleExpression
|
|
372
|
+
| NewExpression
|
|
373
|
+
| Noop
|
|
374
|
+
| NullLiteral
|
|
375
|
+
| NullLiteralTypeAnnotation
|
|
376
|
+
| NullableTypeAnnotation
|
|
377
|
+
| NumberLiteralTypeAnnotation
|
|
378
|
+
| NumberTypeAnnotation
|
|
379
|
+
| NumericLiteral
|
|
380
|
+
| ObjectExpression
|
|
381
|
+
| ObjectMethod
|
|
382
|
+
| ObjectPattern
|
|
383
|
+
| ObjectProperty
|
|
384
|
+
| ObjectTypeAnnotation
|
|
385
|
+
| ObjectTypeCallProperty
|
|
386
|
+
| ObjectTypeIndexer
|
|
387
|
+
| ObjectTypeInternalSlot
|
|
388
|
+
| ObjectTypeProperty
|
|
389
|
+
| ObjectTypeSpreadProperty
|
|
390
|
+
| OpaqueType
|
|
391
|
+
| OptionalCallExpression
|
|
392
|
+
| OptionalIndexedAccessType
|
|
393
|
+
| OptionalMemberExpression
|
|
394
|
+
| ParenthesizedExpression
|
|
395
|
+
| PipelineBareFunction
|
|
396
|
+
| PipelinePrimaryTopicReference
|
|
397
|
+
| PipelineTopicExpression
|
|
398
|
+
| Placeholder
|
|
399
|
+
| PrivateName
|
|
400
|
+
| Program
|
|
401
|
+
| QualifiedTypeIdentifier
|
|
402
|
+
| RecordExpression
|
|
403
|
+
| RegExpLiteral
|
|
404
|
+
| RestElement
|
|
405
|
+
| ReturnStatement
|
|
406
|
+
| SequenceExpression
|
|
407
|
+
| SpreadElement
|
|
408
|
+
| StaticBlock
|
|
409
|
+
| StringLiteral
|
|
410
|
+
| StringLiteralTypeAnnotation
|
|
411
|
+
| StringTypeAnnotation
|
|
412
|
+
| Super
|
|
413
|
+
| SwitchCase
|
|
414
|
+
| SwitchStatement
|
|
415
|
+
| SymbolTypeAnnotation
|
|
416
|
+
| TSAnyKeyword
|
|
417
|
+
| TSArrayType
|
|
418
|
+
| TSAsExpression
|
|
419
|
+
| TSBigIntKeyword
|
|
420
|
+
| TSBooleanKeyword
|
|
421
|
+
| TSCallSignatureDeclaration
|
|
422
|
+
| TSConditionalType
|
|
423
|
+
| TSConstructSignatureDeclaration
|
|
424
|
+
| TSConstructorType
|
|
425
|
+
| TSDeclareFunction
|
|
426
|
+
| TSDeclareMethod
|
|
427
|
+
| TSEnumBody
|
|
428
|
+
| TSEnumDeclaration
|
|
429
|
+
| TSEnumMember
|
|
430
|
+
| TSExportAssignment
|
|
431
|
+
| TSExpressionWithTypeArguments
|
|
432
|
+
| TSExternalModuleReference
|
|
433
|
+
| TSFunctionType
|
|
434
|
+
| TSImportEqualsDeclaration
|
|
435
|
+
| TSImportType
|
|
436
|
+
| TSIndexSignature
|
|
437
|
+
| TSIndexedAccessType
|
|
438
|
+
| TSInferType
|
|
439
|
+
| TSInstantiationExpression
|
|
440
|
+
| TSInterfaceBody
|
|
441
|
+
| TSInterfaceDeclaration
|
|
442
|
+
| TSIntersectionType
|
|
443
|
+
| TSIntrinsicKeyword
|
|
444
|
+
| TSLiteralType
|
|
445
|
+
| TSMappedType
|
|
446
|
+
| TSMethodSignature
|
|
447
|
+
| TSModuleBlock
|
|
448
|
+
| TSModuleDeclaration
|
|
449
|
+
| TSNamedTupleMember
|
|
450
|
+
| TSNamespaceExportDeclaration
|
|
451
|
+
| TSNeverKeyword
|
|
452
|
+
| TSNonNullExpression
|
|
453
|
+
| TSNullKeyword
|
|
454
|
+
| TSNumberKeyword
|
|
455
|
+
| TSObjectKeyword
|
|
456
|
+
| TSOptionalType
|
|
457
|
+
| TSParameterProperty
|
|
458
|
+
| TSParenthesizedType
|
|
459
|
+
| TSPropertySignature
|
|
460
|
+
| TSQualifiedName
|
|
461
|
+
| TSRestType
|
|
462
|
+
| TSSatisfiesExpression
|
|
463
|
+
| TSStringKeyword
|
|
464
|
+
| TSSymbolKeyword
|
|
465
|
+
| TSTemplateLiteralType
|
|
466
|
+
| TSThisType
|
|
467
|
+
| TSTupleType
|
|
468
|
+
| TSTypeAliasDeclaration
|
|
469
|
+
| TSTypeAnnotation
|
|
470
|
+
| TSTypeAssertion
|
|
471
|
+
| TSTypeLiteral
|
|
472
|
+
| TSTypeOperator
|
|
473
|
+
| TSTypeParameter
|
|
474
|
+
| TSTypeParameterDeclaration
|
|
475
|
+
| TSTypeParameterInstantiation
|
|
476
|
+
| TSTypePredicate
|
|
477
|
+
| TSTypeQuery
|
|
478
|
+
| TSTypeReference
|
|
479
|
+
| TSUndefinedKeyword
|
|
480
|
+
| TSUnionType
|
|
481
|
+
| TSUnknownKeyword
|
|
482
|
+
| TSVoidKeyword
|
|
483
|
+
| TaggedTemplateExpression
|
|
484
|
+
| TemplateElement
|
|
485
|
+
| TemplateLiteral
|
|
486
|
+
| ThisExpression
|
|
487
|
+
| ThisTypeAnnotation
|
|
488
|
+
| ThrowStatement
|
|
489
|
+
| TopicReference
|
|
490
|
+
| TryStatement
|
|
491
|
+
| TupleExpression
|
|
492
|
+
| TupleTypeAnnotation
|
|
493
|
+
| TypeAlias
|
|
494
|
+
| TypeAnnotation
|
|
495
|
+
| TypeCastExpression
|
|
496
|
+
| TypeParameter
|
|
497
|
+
| TypeParameterDeclaration
|
|
498
|
+
| TypeParameterInstantiation
|
|
499
|
+
| TypeofTypeAnnotation
|
|
500
|
+
| UnaryExpression
|
|
501
|
+
| UnionTypeAnnotation
|
|
502
|
+
| UpdateExpression
|
|
503
|
+
| V8IntrinsicIdentifier
|
|
504
|
+
| VariableDeclaration
|
|
505
|
+
| VariableDeclarator
|
|
506
|
+
| Variance
|
|
507
|
+
| VoidPattern
|
|
508
|
+
| VoidTypeAnnotation
|
|
509
|
+
| WhileStatement
|
|
510
|
+
| WithStatement
|
|
511
|
+
| YieldExpression
|
|
512
|
+
|
|
513
|
+
declare global {
|
|
514
|
+
interface PluginOptions {
|
|
515
|
+
report: <T extends Node>(issue: NodePath<T>, message: string) => void
|
|
516
|
+
}
|
|
517
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "CommonJs",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationDir": "./dist/types",
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*"],
|
|
13
|
+
"exclude": ["node_modules", "**/*.test.ts"]
|
|
14
|
+
}
|