auto-cr-rules 1.0.13 → 2.0.2

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,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectImportReferences = void 0;
4
+ var isSwcNode = function (value) {
5
+ if (!value || typeof value !== 'object') {
6
+ return false;
7
+ }
8
+ if (!('type' in value)) {
9
+ return false;
10
+ }
11
+ return typeof value.type === 'string';
12
+ };
13
+ var traverse = function (value, visitor) {
14
+ if (Array.isArray(value)) {
15
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
16
+ var element = value_1[_i];
17
+ traverse(element, visitor);
18
+ }
19
+ return;
20
+ }
21
+ if (!value || typeof value !== 'object') {
22
+ return;
23
+ }
24
+ if (isSwcNode(value)) {
25
+ visitor(value);
26
+ }
27
+ var record = value;
28
+ for (var _a = 0, _b = Object.values(record); _a < _b.length; _a++) {
29
+ var child = _b[_a];
30
+ if (typeof child === 'object' && child !== null) {
31
+ traverse(child, visitor);
32
+ }
33
+ }
34
+ };
35
+ var isImportDeclaration = function (node) { return node.type === 'ImportDeclaration'; };
36
+ var isCallExpression = function (node) { return node.type === 'CallExpression'; };
37
+ var collectImportReferences = function (module) {
38
+ var results = [];
39
+ traverse(module, function (node) {
40
+ if (isImportDeclaration(node)) {
41
+ results.push({
42
+ kind: 'static',
43
+ value: node.source.value,
44
+ span: node.source.span,
45
+ });
46
+ return;
47
+ }
48
+ if (isCallExpression(node)) {
49
+ var reference = extractFromCallExpression(node);
50
+ if (reference) {
51
+ results.push(reference);
52
+ }
53
+ }
54
+ });
55
+ return results;
56
+ };
57
+ exports.collectImportReferences = collectImportReferences;
58
+ var extractFromCallExpression = function (node) {
59
+ if (!node.arguments.length) {
60
+ return null;
61
+ }
62
+ var firstArgument = node.arguments[0];
63
+ if (!firstArgument || isSpread(firstArgument)) {
64
+ return null;
65
+ }
66
+ var literal = getStringLiteral(firstArgument);
67
+ if (!literal) {
68
+ return null;
69
+ }
70
+ if (node.callee.type === 'Import') {
71
+ return createImportReference('dynamic', literal);
72
+ }
73
+ if (isRequireIdentifier(node.callee) || isRequireMember(node.callee)) {
74
+ return createImportReference('require', literal);
75
+ }
76
+ return null;
77
+ };
78
+ var createImportReference = function (kind, literal) { return ({
79
+ kind: kind,
80
+ value: literal.value,
81
+ span: literal.span,
82
+ }); };
83
+ var isSpread = function (argument) { return Boolean(argument.spread); };
84
+ var getStringLiteral = function (argument) {
85
+ if (argument.expression.type === 'StringLiteral') {
86
+ return argument.expression;
87
+ }
88
+ return null;
89
+ };
90
+ var isRequireIdentifier = function (expression) {
91
+ return expression.type === 'Identifier' && expression.value === 'require';
92
+ };
93
+ var isRequireMember = function (expression) {
94
+ return (expression.type === 'MemberExpression' &&
95
+ expression.object.type === 'Identifier' &&
96
+ expression.object.value === 'require');
97
+ };
package/dist/index.js CHANGED
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.rules = void 0;
7
- var NoDeepRelativeImports_1 = __importDefault(require("./rules/NoDeepRelativeImports"));
8
- exports.rules = [NoDeepRelativeImports_1.default];
3
+ exports.noDeepRelativeImports = exports.builtinRules = exports.createRuleContext = exports.toRule = exports.isRule = exports.defineRule = void 0;
4
+ var types_1 = require("./types");
5
+ Object.defineProperty(exports, "defineRule", { enumerable: true, get: function () { return types_1.defineRule; } });
6
+ Object.defineProperty(exports, "isRule", { enumerable: true, get: function () { return types_1.isRule; } });
7
+ Object.defineProperty(exports, "toRule", { enumerable: true, get: function () { return types_1.toRule; } });
8
+ var runtime_1 = require("./runtime");
9
+ Object.defineProperty(exports, "createRuleContext", { enumerable: true, get: function () { return runtime_1.createRuleContext; } });
10
+ var rules_1 = require("./rules");
11
+ Object.defineProperty(exports, "builtinRules", { enumerable: true, get: function () { return rules_1.builtinRules; } });
12
+ Object.defineProperty(exports, "noDeepRelativeImports", { enumerable: true, get: function () { return rules_1.noDeepRelativeImports; } });
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRuleMessages = void 0;
4
+ var ruleTranslations = {
5
+ zh: {
6
+ noDeepRelativeImports: function (_a) {
7
+ var value = _a.value, maxDepth = _a.maxDepth;
8
+ return "\u5BFC\u5165\u8DEF\u5F84 \"".concat(value, "\" \u4E0D\u80FD\u8D85\u8FC7\u6700\u5927\u5C42\u7EA7").concat(maxDepth);
9
+ },
10
+ },
11
+ en: {
12
+ noDeepRelativeImports: function (_a) {
13
+ var value = _a.value, maxDepth = _a.maxDepth;
14
+ return "Import path \"".concat(value, "\" must not exceed max depth ").concat(maxDepth);
15
+ },
16
+ },
17
+ };
18
+ Object.values(ruleTranslations).forEach(function (messages) { return Object.freeze(messages); });
19
+ var createRuleMessages = function (language) {
20
+ var _a;
21
+ return (_a = ruleTranslations[language]) !== null && _a !== void 0 ? _a : ruleTranslations.zh;
22
+ };
23
+ exports.createRuleMessages = createRuleMessages;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noDeepRelativeImports = exports.builtinRules = void 0;
4
+ var noDeepRelativeImports_1 = require("./noDeepRelativeImports");
5
+ Object.defineProperty(exports, "noDeepRelativeImports", { enumerable: true, get: function () { return noDeepRelativeImports_1.noDeepRelativeImports; } });
6
+ exports.builtinRules = [noDeepRelativeImports_1.noDeepRelativeImports];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noDeepRelativeImports = void 0;
4
+ var types_1 = require("../types");
5
+ var MAX_DEPTH = 2;
6
+ exports.noDeepRelativeImports = (0, types_1.defineRule)('no-deep-relative-imports', { tag: 'base' }, function (_a) {
7
+ var helpers = _a.helpers, messages = _a.messages;
8
+ for (var _i = 0, _b = helpers.imports; _i < _b.length; _i++) {
9
+ var reference = _b[_i];
10
+ if (!helpers.isRelativePath(reference.value)) {
11
+ continue;
12
+ }
13
+ var depth = helpers.relativeDepth(reference.value);
14
+ if (depth > MAX_DEPTH) {
15
+ helpers.reportViolation(messages.noDeepRelativeImports({ value: reference.value, maxDepth: MAX_DEPTH }), reference.span);
16
+ }
17
+ }
18
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRuleContext = void 0;
4
+ var imports_1 = require("./imports");
5
+ var messages_1 = require("./messages");
6
+ var createRuleContext = function (_a) {
7
+ var ast = _a.ast, filePath = _a.filePath, source = _a.source, reporter = _a.reporter, language = _a.language;
8
+ var imports = (0, imports_1.collectImportReferences)(ast);
9
+ var messages = (0, messages_1.createRuleMessages)(language);
10
+ var helpers = Object.freeze(createRuleHelpers(reporter, imports));
11
+ return Object.freeze({
12
+ ast: ast,
13
+ filePath: filePath,
14
+ source: source,
15
+ language: language,
16
+ reporter: reporter,
17
+ helpers: helpers,
18
+ messages: messages,
19
+ });
20
+ };
21
+ exports.createRuleContext = createRuleContext;
22
+ var createRuleHelpers = function (reporter, imports) {
23
+ var isRelativePath = function (value) { return value.startsWith('.'); };
24
+ var relativeDepth = function (value) {
25
+ return (value.match(/\.\.\//g) || []).length;
26
+ };
27
+ var reportViolation = function (message, span) {
28
+ if (span) {
29
+ reporter.errorAtSpan(span, message);
30
+ return;
31
+ }
32
+ reporter.error(message);
33
+ };
34
+ return {
35
+ imports: imports,
36
+ isRelativePath: isRelativePath,
37
+ relativeDepth: relativeDepth,
38
+ reportViolation: reportViolation,
39
+ };
40
+ };
@@ -0,0 +1,3 @@
1
+ import type { Module } from '@swc/types';
2
+ import type { ImportReference } from './types';
3
+ export declare const collectImportReferences: (module: Module) => ImportReference[];
@@ -0,0 +1,5 @@
1
+ export type { ImportReference, Language, Rule, RuleMetadata, RuleContext, RuleHelpers, RuleMessages, RuleReporter, } from './types';
2
+ export { defineRule, isRule, toRule } from './types';
3
+ export { createRuleContext } from './runtime';
4
+ export type { RuleContextOptions } from './runtime';
5
+ export { builtinRules, noDeepRelativeImports } from './rules';
@@ -0,0 +1,2 @@
1
+ import type { Language, RuleMessages } from './types';
2
+ export declare const createRuleMessages: (language: Language) => RuleMessages;
@@ -0,0 +1,4 @@
1
+ import type { Rule } from '../types';
2
+ import { noDeepRelativeImports } from './noDeepRelativeImports';
3
+ export declare const builtinRules: Rule[];
4
+ export { noDeepRelativeImports };
@@ -0,0 +1 @@
1
+ export declare const noDeepRelativeImports: import("../types").Rule;
@@ -0,0 +1,10 @@
1
+ import type { Module } from '@swc/types';
2
+ import type { Language, RuleContext, RuleReporter } from './types';
3
+ export interface RuleContextOptions {
4
+ ast: Module;
5
+ filePath: string;
6
+ source: string;
7
+ reporter: RuleReporter;
8
+ language: Language;
9
+ }
10
+ export declare const createRuleContext: ({ ast, filePath, source, reporter, language, }: RuleContextOptions) => RuleContext;
@@ -0,0 +1,45 @@
1
+ import type { Module, Span } from '@swc/types';
2
+ export type Language = 'zh' | 'en';
3
+ export interface RuleReporter {
4
+ error(message: string): void;
5
+ errorAtSpan(span: Span | undefined, message: string): void;
6
+ errorAtLine(line: number | undefined, message: string): void;
7
+ }
8
+ export interface ImportReference {
9
+ kind: 'static' | 'dynamic' | 'require';
10
+ value: string;
11
+ span?: Span;
12
+ }
13
+ export interface RuleMessages {
14
+ noDeepRelativeImports(params: {
15
+ value: string;
16
+ maxDepth: number;
17
+ }): string;
18
+ }
19
+ export interface RuleHelpers {
20
+ readonly imports: ReadonlyArray<ImportReference>;
21
+ isRelativePath(value: string): boolean;
22
+ relativeDepth(value: string): number;
23
+ reportViolation(message: string, span?: Span): void;
24
+ }
25
+ export interface RuleContext {
26
+ readonly filePath: string;
27
+ readonly source: string;
28
+ readonly language: Language;
29
+ readonly reporter: RuleReporter;
30
+ readonly ast: Module;
31
+ readonly helpers: RuleHelpers;
32
+ readonly messages: RuleMessages;
33
+ }
34
+ export interface RuleMetadata {
35
+ tag?: string;
36
+ }
37
+ export interface Rule {
38
+ name: string;
39
+ tag?: string;
40
+ run(context: RuleContext): void | Promise<void>;
41
+ }
42
+ export declare function defineRule(name: string, runner: (context: RuleContext) => void | Promise<void>): Rule;
43
+ export declare function defineRule(name: string, metadata: RuleMetadata, runner: (context: RuleContext) => void | Promise<void>): Rule;
44
+ export declare const isRule: (value: unknown) => value is Rule;
45
+ export declare const toRule: (value: unknown, origin: string) => Rule | null;
package/dist/types.js CHANGED
@@ -1,2 +1,46 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.toRule = exports.isRule = void 0;
15
+ exports.defineRule = defineRule;
16
+ function defineRule(name, metadataOrRunner, maybeRunner) {
17
+ var metadata = typeof metadataOrRunner === 'function' ? {} : metadataOrRunner;
18
+ var runner = typeof metadataOrRunner === 'function' ? metadataOrRunner : maybeRunner;
19
+ if (!runner) {
20
+ throw new Error('defineRule requires a rule runner function');
21
+ }
22
+ return __assign(__assign({ name: name }, metadata), { run: runner });
23
+ }
24
+ var isRule = function (value) {
25
+ return (typeof value === 'object' &&
26
+ value !== null &&
27
+ typeof value.name === 'string' &&
28
+ typeof value.run === 'function' &&
29
+ (typeof value.tag === 'undefined' ||
30
+ typeof value.tag === 'string'));
31
+ };
32
+ exports.isRule = isRule;
33
+ var toRule = function (value, origin) {
34
+ if ((0, exports.isRule)(value)) {
35
+ return value;
36
+ }
37
+ if (typeof value === 'function') {
38
+ var fn = value;
39
+ return {
40
+ name: fn.name || origin,
41
+ run: fn,
42
+ };
43
+ }
44
+ return null;
45
+ };
46
+ exports.toRule = toRule;
package/package.json CHANGED
@@ -1,33 +1,35 @@
1
1
  {
2
2
  "name": "auto-cr-rules",
3
- "version": "1.0.13",
4
- "description": "旨在帮助开发团队在代码合并或提交时快速进行智能化审查,提升代码质量与开发效率。",
5
- "type": "commonjs",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "module": "./dist/index.js",
3
+ "version": "2.0.2",
4
+ "description": "Extensible static analysis rule set for the auto-cr automated code review toolkit",
5
+ "main": "dist/index.js",
6
+ "types": "dist/types/index.d.ts",
9
7
  "files": [
10
- "dist",
11
- "README.md",
12
- "LICENSE"
8
+ "dist"
13
9
  ],
14
10
  "scripts": {
15
- "build": "tsc"
11
+ "build": "tsc --build tsconfig.json",
12
+ "build:force": "tsc --build tsconfig.json --force",
13
+ "prepublishOnly": "pnpm run build",
14
+ "publish": "pnpm run build && npm publish --access public"
16
15
  },
17
16
  "keywords": [
18
- "rules"
17
+ "auto-cr",
18
+ "code-review",
19
+ "static-analysis",
20
+ "lint-rules",
21
+ "typescript",
22
+ "javascript",
23
+ "swc",
24
+ "developer-tools"
19
25
  ],
20
- "author": "wangweiwei",
21
26
  "license": "MIT",
22
27
  "sideEffects": false,
23
- "packageManager": "pnpm@10.15.1",
28
+ "dependencies": {
29
+ "@swc/types": "^0.1.25"
30
+ },
24
31
  "devDependencies": {
25
- "@babel/types": "^7.28.4",
26
- "@types/babel__core": "^7.20.5",
27
- "@types/babel__traverse": "^7.28.0",
32
+ "tslib": "^2.8.1",
28
33
  "typescript": "^5.9.2"
29
- },
30
- "dependencies": {
31
- "@babel/core": "^7.28.4"
32
34
  }
33
- }
35
+ }
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import NoDeepRelativeImports from './rules/NoDeepRelativeImports';
2
- export declare const rules: (typeof NoDeepRelativeImports)[];
@@ -1,13 +0,0 @@
1
- import BabelCore from '@babel/core';
2
- import type { CallExpression, ExportAllDeclaration, ExportNamedDeclaration, ImportDeclaration } from '@babel/types';
3
- import type { NodePath } from '@babel/traverse';
4
- import { PluginOptions } from '../types';
5
- export default function (api: typeof BabelCore, options: PluginOptions): {
6
- name: string;
7
- visitor: {
8
- ImportDeclaration(path: NodePath<ImportDeclaration>): void;
9
- CallExpression(path: NodePath<CallExpression>): void;
10
- ExportNamedDeclaration(path: NodePath<ExportNamedDeclaration>): void;
11
- ExportAllDeclaration(path: NodePath<ExportAllDeclaration>): void;
12
- };
13
- };
@@ -1,78 +0,0 @@
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
- var depth = (sourceValue.match(/\.\.\//g) || []).length;
16
- if (depth > maxDepth) {
17
- report(path, "\u5BFC\u5165/\u5BFC\u51FA\u8DEF\u5F84 \"".concat(sourceValue, "\" \u4E0D\u80FD\u8D85\u8FC7\u6700\u5927\u5C42\u7EA7\uFF08").concat(maxDepth, "\uFF1A\u5C42\uFF09"));
18
- }
19
- }
20
- }
21
- // 导出Babel插件函数
22
- function default_1(api, options) {
23
- var t = api.types;
24
- var maxDepth = 2;
25
- // 从插件参数中获取 report 方法,如果没有提供则使用默认的 console.error
26
- var report = options.report;
27
- return {
28
- name: 'no-deep-relative-imports',
29
- visitor: {
30
- // 处理静态导入语句
31
- ImportDeclaration: function (path) {
32
- var sourceValue = path.node.source.value;
33
- if (typeof sourceValue === 'string') {
34
- checkRelativePath(sourceValue, path, maxDepth, report);
35
- }
36
- },
37
- // 处理动态 import() 语句和 require() 调用
38
- CallExpression: function (path) {
39
- // 检查是否是 import() 调用
40
- if (t.isImport(path.node.callee)) {
41
- var firstArg = path.node.arguments[0];
42
- // 确保第一个参数是字符串字面量
43
- if (firstArg && t.isStringLiteral(firstArg)) {
44
- var 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
- var firstArg = path.node.arguments[0];
53
- // 确保第一个参数是字符串字面量
54
- if (firstArg && t.isStringLiteral(firstArg)) {
55
- var sourceValue = firstArg.value;
56
- checkRelativePath(sourceValue, path, maxDepth, report);
57
- }
58
- }
59
- },
60
- // 处理命名导出(export { ... } from 'module')
61
- ExportNamedDeclaration: function (path) {
62
- if (path.node.source) {
63
- var sourceValue = path.node.source.value;
64
- if (typeof sourceValue === 'string') {
65
- checkRelativePath(sourceValue, path, maxDepth, report);
66
- }
67
- }
68
- },
69
- // 处理全部导出(export * from 'module')
70
- ExportAllDeclaration: function (path) {
71
- var sourceValue = path.node.source.value;
72
- if (typeof sourceValue === 'string') {
73
- checkRelativePath(sourceValue, path, maxDepth, report);
74
- }
75
- }
76
- },
77
- };
78
- }
package/dist/types.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { type NodePath } from '@babel/traverse';
2
- import type { AnyTypeAnnotation, ArgumentPlaceholder, ArrayExpression, ArrayPattern, ArrayTypeAnnotation, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AwaitExpression, BigIntLiteral, BinaryExpression, BindExpression, BlockStatement, BooleanLiteral, BooleanLiteralTypeAnnotation, BooleanTypeAnnotation, BreakStatement, CallExpression, CatchClause, ClassAccessorProperty, ClassBody, ClassDeclaration, ClassExpression, ClassImplements, ClassMethod, ClassPrivateMethod, ClassPrivateProperty, ClassProperty, ConditionalExpression, ContinueStatement, DebuggerStatement, DecimalLiteral, DeclareClass, DeclaredPredicate, DeclareExportAllDeclaration, DeclareExportDeclaration, DeclareFunction, DeclareInterface, DeclareModule, DeclareModuleExports, DeclareOpaqueType, DeclareTypeAlias, DeclareVariable, Decorator, Directive, DirectiveLiteral, DoExpression, DoWhileStatement, EmptyStatement, EmptyTypeAnnotation, EnumBooleanBody, EnumBooleanMember, EnumDeclaration, EnumDefaultedMember, EnumNumberBody, EnumNumberMember, EnumStringBody, EnumStringMember, EnumSymbolBody, ExistsTypeAnnotation, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, ExpressionStatement, File, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeAnnotation, FunctionTypeParam, GenericTypeAnnotation, Identifier, IfStatement, Import, ImportAttribute, ImportDeclaration, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportSpecifier, IndexedAccessType, InferredPredicate, InterfaceDeclaration, InterfaceExtends, InterfaceTypeAnnotation, InterpreterDirective, IntersectionTypeAnnotation, JSXAttribute, JSXClosingElement, JSXClosingFragment, JSXElement, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabeledStatement, LogicalExpression, MemberExpression, MetaProperty, MixedTypeAnnotation, ModuleExpression, NewExpression, Noop, NullableTypeAnnotation, NullLiteral, NullLiteralTypeAnnotation, NumberLiteralTypeAnnotation, NumberTypeAnnotation, NumericLiteral, ObjectExpression, ObjectMethod, ObjectPattern, ObjectProperty, ObjectTypeAnnotation, ObjectTypeCallProperty, ObjectTypeIndexer, ObjectTypeInternalSlot, ObjectTypeProperty, ObjectTypeSpreadProperty, OpaqueType, OptionalCallExpression, OptionalIndexedAccessType, OptionalMemberExpression, ParenthesizedExpression, PipelineBareFunction, PipelinePrimaryTopicReference, PipelineTopicExpression, Placeholder, PrivateName, Program, QualifiedTypeIdentifier, RecordExpression, RegExpLiteral, RestElement, ReturnStatement, SequenceExpression, SpreadElement, StaticBlock, StringLiteral, StringLiteralTypeAnnotation, StringTypeAnnotation, Super, SwitchCase, SwitchStatement, SymbolTypeAnnotation, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThisTypeAnnotation, ThrowStatement, TopicReference, TryStatement, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSConditionalType, TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSDeclareMethod, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSExportAssignment, TSExpressionWithTypeArguments, TSExternalModuleReference, TSFunctionType, TSImportEqualsDeclaration, TSImportType, TSIndexedAccessType, TSIndexSignature, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSIntersectionType, TSIntrinsicKeyword, TSLiteralType, TSMappedType, TSMethodSignature, TSModuleBlock, TSModuleDeclaration, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisType, TSTupleType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypeQuery, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TupleExpression, TupleTypeAnnotation, TypeAlias, TypeAnnotation, TypeCastExpression, TypeofTypeAnnotation, TypeParameter, TypeParameterDeclaration, TypeParameterInstantiation, UnaryExpression, UnionTypeAnnotation, UpdateExpression, V8IntrinsicIdentifier, VariableDeclaration, VariableDeclarator, Variance, VoidPattern, VoidTypeAnnotation, WhileStatement, WithStatement, YieldExpression } from '@babel/types';
3
- type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | BinaryExpression | BindExpression | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | ExpressionStatement | File | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | LogicalExpression | MemberExpression | MetaProperty | MixedTypeAnnotation | ModuleExpression | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | PrivateName | Program | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RestElement | ReturnStatement | SequenceExpression | SpreadElement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeofTypeAnnotation | UnaryExpression | UnionTypeAnnotation | UpdateExpression | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidPattern | VoidTypeAnnotation | WhileStatement | WithStatement | YieldExpression;
4
- export interface PluginOptions {
5
- report: <T extends Node>(issue: NodePath<T>, message: string) => void;
6
- }
7
- export {};