@definitelytyped/eslint-plugin 0.0.166-next.4
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/configs/all.d.ts +2 -0
- package/dist/configs/all.js +152 -0
- package/dist/configs/all.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/dt-header.d.ts +2 -0
- package/dist/rules/dt-header.js +62 -0
- package/dist/rules/dt-header.js.map +1 -0
- package/dist/rules/export-just-namespace.d.ts +2 -0
- package/dist/rules/export-just-namespace.js +70 -0
- package/dist/rules/export-just-namespace.js.map +1 -0
- package/dist/rules/index.d.ts +38 -0
- package/dist/rules/index.js +61 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/no-any-union.d.ts +4 -0
- package/dist/rules/no-any-union.js +34 -0
- package/dist/rules/no-any-union.js.map +1 -0
- package/dist/rules/no-bad-reference.d.ts +2 -0
- package/dist/rules/no-bad-reference.js +55 -0
- package/dist/rules/no-bad-reference.js.map +1 -0
- package/dist/rules/no-const-enum.d.ts +4 -0
- package/dist/rules/no-const-enum.js +30 -0
- package/dist/rules/no-const-enum.js.map +1 -0
- package/dist/rules/no-dead-reference.d.ts +2 -0
- package/dist/rules/no-dead-reference.js +44 -0
- package/dist/rules/no-dead-reference.js.map +1 -0
- package/dist/rules/no-declare-current-package.d.ts +4 -0
- package/dist/rules/no-declare-current-package.js +43 -0
- package/dist/rules/no-declare-current-package.js.map +1 -0
- package/dist/rules/no-import-default-of-export-equals.d.ts +4 -0
- package/dist/rules/no-import-default-of-export-equals.js +87 -0
- package/dist/rules/no-import-default-of-export-equals.js.map +1 -0
- package/dist/rules/no-outside-dependencies.d.ts +2 -0
- package/dist/rules/no-outside-dependencies.js +41 -0
- package/dist/rules/no-outside-dependencies.js.map +1 -0
- package/dist/rules/no-self-import.d.ts +4 -0
- package/dist/rules/no-self-import.js +38 -0
- package/dist/rules/no-self-import.js.map +1 -0
- package/dist/rules/no-single-element-tuple-type.d.ts +5 -0
- package/dist/rules/no-single-element-tuple-type.js +30 -0
- package/dist/rules/no-single-element-tuple-type.js.map +1 -0
- package/dist/rules/no-unnecessary-generics.d.ts +8 -0
- package/dist/rules/no-unnecessary-generics.js +135 -0
- package/dist/rules/no-unnecessary-generics.js.map +1 -0
- package/dist/rules/no-useless-files.d.ts +2 -0
- package/dist/rules/no-useless-files.js +53 -0
- package/dist/rules/no-useless-files.js.map +1 -0
- package/dist/rules/prefer-declare-function.d.ts +5 -0
- package/dist/rules/prefer-declare-function.js +35 -0
- package/dist/rules/prefer-declare-function.js.map +1 -0
- package/dist/rules/redundant-undefined.d.ts +4 -0
- package/dist/rules/redundant-undefined.js +53 -0
- package/dist/rules/redundant-undefined.js.map +1 -0
- package/dist/rules/trim-file.d.ts +2 -0
- package/dist/rules/trim-file.js +43 -0
- package/dist/rules/trim-file.js.map +1 -0
- package/dist/util.d.ts +4 -0
- package/dist/util.js +38 -0
- package/dist/util.js.map +1 -0
- package/docs/rules/dt-header.md +88 -0
- package/docs/rules/export-just-namespace.md +29 -0
- package/docs/rules/no-any-union.md +27 -0
- package/docs/rules/no-bad-reference.md +28 -0
- package/docs/rules/no-const-enum.md +16 -0
- package/docs/rules/no-dead-reference.md +17 -0
- package/docs/rules/no-declare-current-package.md +35 -0
- package/docs/rules/no-import-default-of-export-equals.md +22 -0
- package/docs/rules/no-outside-dependencies.md +23 -0
- package/docs/rules/no-self-import.md +27 -0
- package/docs/rules/no-single-element-tuple-type.md +15 -0
- package/docs/rules/no-unnecessary-generics.md +69 -0
- package/docs/rules/no-useless-files.md +14 -0
- package/docs/rules/prefer-declare-function.md +15 -0
- package/docs/rules/redundant-undefined.md +15 -0
- package/docs/rules/trim-file.md +17 -0
- package/package.json +45 -0
- package/src/configs/all.ts +151 -0
- package/src/index.ts +6 -0
- package/src/rules/dt-header.ts +74 -0
- package/src/rules/export-just-namespace.ts +83 -0
- package/src/rules/index.ts +35 -0
- package/src/rules/no-any-union.ts +34 -0
- package/src/rules/no-bad-reference.ts +62 -0
- package/src/rules/no-const-enum.ts +30 -0
- package/src/rules/no-dead-reference.ts +46 -0
- package/src/rules/no-declare-current-package.ts +45 -0
- package/src/rules/no-import-default-of-export-equals.ts +68 -0
- package/src/rules/no-outside-dependencies.ts +42 -0
- package/src/rules/no-self-import.ts +40 -0
- package/src/rules/no-single-element-tuple-type.ts +31 -0
- package/src/rules/no-unnecessary-generics.ts +126 -0
- package/src/rules/no-useless-files.ts +58 -0
- package/src/rules/prefer-declare-function.ts +37 -0
- package/src/rules/redundant-undefined.ts +62 -0
- package/src/rules/trim-file.ts +45 -0
- package/src/util.ts +41 -0
- package/test/dt-header.test.ts +189 -0
- package/test/export-just-namespace.test.ts +70 -0
- package/test/no-any-union.test.ts +22 -0
- package/test/no-bad-reference.test.ts +66 -0
- package/test/no-const-enum.test.ts +22 -0
- package/test/no-dead-reference.test.ts +66 -0
- package/test/no-declare-current-package.test.ts +61 -0
- package/test/no-import-default-of-export-equals.test.ts +49 -0
- package/test/no-self-import.test.ts +47 -0
- package/test/no-single-element-tuple-type.test.ts +28 -0
- package/test/no-unnecessary-generics.test.ts +152 -0
- package/test/no-useless-files.test.ts +42 -0
- package/test/prefer-declare-function.test.ts +66 -0
- package/test/redundant-undefined.test.ts +39 -0
- package/test/trim-file.test.ts +46 -0
- package/test/tsconfig.json +10 -0
- package/test/tsconfig.no-declare-current-package.json +11 -0
- package/test/tsconfig.no-declare-current-package2.json +11 -0
- package/test/tsconfig.no-import-default-of-export-equals.json +11 -0
- package/test/tsconfig.no-self-import.json +7 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.all = void 0;
|
|
4
|
+
const index_js_1 = require("../rules/index.js");
|
|
5
|
+
exports.all = {
|
|
6
|
+
plugins: ["@definitelytyped", "@typescript-eslint", "jsdoc"],
|
|
7
|
+
settings: {
|
|
8
|
+
jsdoc: {
|
|
9
|
+
tagNamePreference: {
|
|
10
|
+
argument: "argument",
|
|
11
|
+
exception: "exception",
|
|
12
|
+
function: "function",
|
|
13
|
+
method: "method",
|
|
14
|
+
param: "param",
|
|
15
|
+
return: "return",
|
|
16
|
+
returns: "returns",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
"jsdoc/check-tag-names": [
|
|
22
|
+
"error",
|
|
23
|
+
{
|
|
24
|
+
// TODO: Some (but not all) of these tags should likely be removed from this list.
|
|
25
|
+
// Additionally, some may need to be contributed to eslint-plugin-jsdoc.
|
|
26
|
+
definedTags: [
|
|
27
|
+
"addVersion",
|
|
28
|
+
"also",
|
|
29
|
+
"api",
|
|
30
|
+
"author",
|
|
31
|
+
"beta",
|
|
32
|
+
"brief",
|
|
33
|
+
"category",
|
|
34
|
+
"cfg",
|
|
35
|
+
"chainable",
|
|
36
|
+
"check",
|
|
37
|
+
"checkReturnValue",
|
|
38
|
+
"classDescription",
|
|
39
|
+
"condparamprivilege",
|
|
40
|
+
"constraint",
|
|
41
|
+
"credits",
|
|
42
|
+
"declaration",
|
|
43
|
+
"defApiFeature",
|
|
44
|
+
"defaultValue",
|
|
45
|
+
"detail",
|
|
46
|
+
"end",
|
|
47
|
+
"eventproperty",
|
|
48
|
+
"experimental",
|
|
49
|
+
"export",
|
|
50
|
+
"expose",
|
|
51
|
+
"extendscript",
|
|
52
|
+
"factory",
|
|
53
|
+
"field",
|
|
54
|
+
"final",
|
|
55
|
+
"fixme",
|
|
56
|
+
"fluent",
|
|
57
|
+
"for",
|
|
58
|
+
"governance",
|
|
59
|
+
"header",
|
|
60
|
+
"hidden-property",
|
|
61
|
+
"hidden",
|
|
62
|
+
"id",
|
|
63
|
+
"jsx",
|
|
64
|
+
"jsxImportSource",
|
|
65
|
+
"label",
|
|
66
|
+
"language",
|
|
67
|
+
"legacy",
|
|
68
|
+
"link",
|
|
69
|
+
"listen",
|
|
70
|
+
"locus",
|
|
71
|
+
"methodOf",
|
|
72
|
+
"minVersion",
|
|
73
|
+
"ngdoc",
|
|
74
|
+
"nonstandard",
|
|
75
|
+
"note",
|
|
76
|
+
"npm",
|
|
77
|
+
"observable",
|
|
78
|
+
"option",
|
|
79
|
+
"optionobject",
|
|
80
|
+
"options",
|
|
81
|
+
"packageDocumentation",
|
|
82
|
+
"param",
|
|
83
|
+
"parent",
|
|
84
|
+
"platform",
|
|
85
|
+
"plugin",
|
|
86
|
+
"preserve",
|
|
87
|
+
"privateRemarks",
|
|
88
|
+
"privilegeLevel",
|
|
89
|
+
"privilegeName",
|
|
90
|
+
"proposed",
|
|
91
|
+
"range",
|
|
92
|
+
"readOnly",
|
|
93
|
+
"related",
|
|
94
|
+
"remark",
|
|
95
|
+
"remarks",
|
|
96
|
+
"required",
|
|
97
|
+
"requires",
|
|
98
|
+
"restriction",
|
|
99
|
+
"returnType",
|
|
100
|
+
"section",
|
|
101
|
+
"see",
|
|
102
|
+
"since",
|
|
103
|
+
"const",
|
|
104
|
+
"singleton",
|
|
105
|
+
"source",
|
|
106
|
+
"struct",
|
|
107
|
+
"suppress",
|
|
108
|
+
"targetfolder",
|
|
109
|
+
"enum",
|
|
110
|
+
"title",
|
|
111
|
+
"record",
|
|
112
|
+
"title",
|
|
113
|
+
"TODO",
|
|
114
|
+
"trigger",
|
|
115
|
+
"triggers",
|
|
116
|
+
"typeparam",
|
|
117
|
+
"typeParam",
|
|
118
|
+
"unsupported",
|
|
119
|
+
"url",
|
|
120
|
+
"usage",
|
|
121
|
+
"warn",
|
|
122
|
+
"warning",
|
|
123
|
+
"version",
|
|
124
|
+
],
|
|
125
|
+
typed: true,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
overrides: [
|
|
130
|
+
{
|
|
131
|
+
files: ["*.cts", "*.mts", "*.ts", "*.tsx"],
|
|
132
|
+
parser: "@typescript-eslint/parser",
|
|
133
|
+
parserOptions: {
|
|
134
|
+
project: true,
|
|
135
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
136
|
+
},
|
|
137
|
+
rules: {
|
|
138
|
+
...Object.fromEntries(Object.keys(index_js_1.rules).map((name) => [`@definitelytyped/${name}`, "error"])),
|
|
139
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
140
|
+
"error",
|
|
141
|
+
{
|
|
142
|
+
"ts-expect-error": false,
|
|
143
|
+
"ts-ignore": "allow-with-description",
|
|
144
|
+
"ts-nocheck": true,
|
|
145
|
+
"ts-check": false,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../src/configs/all.ts"],"names":[],"mappings":";;;AAAA,gDAA0C;AAG7B,QAAA,GAAG,GAAsB;IACpC,OAAO,EAAE,CAAC,kBAAkB,EAAE,oBAAoB,EAAE,OAAO,CAAC;IAC5D,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,iBAAiB,EAAE;gBACjB,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE,WAAW;gBACtB,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,SAAS;aACnB;SACF;KACF;IACD,KAAK,EAAE;QACL,uBAAuB,EAAE;YACvB,OAAO;YACP;gBACE,kFAAkF;gBAClF,wEAAwE;gBACxE,WAAW,EAAE;oBACX,YAAY;oBACZ,MAAM;oBACN,KAAK;oBACL,QAAQ;oBACR,MAAM;oBACN,OAAO;oBACP,UAAU;oBACV,KAAK;oBACL,WAAW;oBACX,OAAO;oBACP,kBAAkB;oBAClB,kBAAkB;oBAClB,oBAAoB;oBACpB,YAAY;oBACZ,SAAS;oBACT,aAAa;oBACb,eAAe;oBACf,cAAc;oBACd,QAAQ;oBACR,KAAK;oBACL,eAAe;oBACf,cAAc;oBACd,QAAQ;oBACR,QAAQ;oBACR,cAAc;oBACd,SAAS;oBACT,OAAO;oBACP,OAAO;oBACP,OAAO;oBACP,QAAQ;oBACR,KAAK;oBACL,YAAY;oBACZ,QAAQ;oBACR,iBAAi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AC9F,mCAAmC,EAAE;oBACnC,OAAO;oBACP;wBACE,iBAAiB,EAAE,KAAK;wBACxB,WAAW,EAAE,wBAAwB;wBACrC,YAAY,EAAE,IAAI;wBAClB,UAAU,EAAE,KAAK;qBAClB;iBACF;aACF;SACF;KACF;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configs = exports.rules = void 0;
|
|
4
|
+
const all_js_1 = require("./configs/all.js");
|
|
5
|
+
var index_js_1 = require("./rules/index.js");
|
|
6
|
+
Object.defineProperty(exports, "rules", { enumerable: true, get: function () { return index_js_1.rules; } });
|
|
7
|
+
exports.configs = {
|
|
8
|
+
all: all_js_1.all,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,6CAAyC;AAAhC,iGAAA,KAAK,OAAA;AAED,QAAA,OAAO,GAAG;IACrB,GAAG,EAAH,YAAG;CACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const header_parser_1 = require("@definitelytyped/header-parser");
|
|
3
|
+
const util_1 = require("../util");
|
|
4
|
+
const rule = (0, util_1.createRule)({
|
|
5
|
+
name: "dt-header",
|
|
6
|
+
defaultOptions: [],
|
|
7
|
+
meta: {
|
|
8
|
+
type: "problem",
|
|
9
|
+
docs: {
|
|
10
|
+
description: "Ensure consistency of DefinitelyTyped headers.",
|
|
11
|
+
recommended: "error",
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
definitionsBy: "Author name should be your name, not the default.",
|
|
15
|
+
minimumTypeScriptVersion: "TypeScript version should be specified under header in `index.d.ts`.",
|
|
16
|
+
parseError: "Error parsing header. Expected: {{expected}}",
|
|
17
|
+
typeDefinitionsFor: "Header should only be in `index.d.ts` of the root.",
|
|
18
|
+
typescriptVersion: "Minimum TypeScript version should be specified under header in `index.d.ts`.",
|
|
19
|
+
},
|
|
20
|
+
schema: [],
|
|
21
|
+
},
|
|
22
|
+
create(context) {
|
|
23
|
+
const sourceCode = context.getSourceCode();
|
|
24
|
+
const { lines, text } = sourceCode;
|
|
25
|
+
const lookFor = (search, messageId) => {
|
|
26
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
27
|
+
if (lines[i].startsWith(search)) {
|
|
28
|
+
context.report({
|
|
29
|
+
loc: {
|
|
30
|
+
end: { line: i + 1, column: search.length },
|
|
31
|
+
start: { line: i + 1, column: 0 },
|
|
32
|
+
},
|
|
33
|
+
messageId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (!(0, util_1.isMainFile)(context.getFilename(), /*allowNested*/ true)) {
|
|
39
|
+
lookFor("// Type definitions for", "typeDefinitionsFor");
|
|
40
|
+
lookFor("// TypeScript Version", "typescriptVersion");
|
|
41
|
+
lookFor("// Minimum TypeScript Version", "minimumTypeScriptVersion");
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
lookFor("// Definitions by: My Self", "definitionsBy");
|
|
45
|
+
const error = (0, header_parser_1.validate)(text);
|
|
46
|
+
if (error) {
|
|
47
|
+
context.report({
|
|
48
|
+
data: {
|
|
49
|
+
expected: (0, header_parser_1.renderExpected)(error.expected),
|
|
50
|
+
},
|
|
51
|
+
loc: {
|
|
52
|
+
column: error.column,
|
|
53
|
+
line: error.line,
|
|
54
|
+
},
|
|
55
|
+
messageId: "parseError",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return {};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
module.exports = rule;
|
|
62
|
+
//# sourceMappingURL=dt-header.js.map
|
|
@@ -0,0 +1 @@
|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AAC,WAAW,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE;YAC5D,OAAO,CAAC,yBAAyB,EAAE,oBAAoB,CAAC,CAAC;YACzD,OAAO,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAC;YACtD,OAAO,CAAC,+BAA+B,EAAE,0BAA0B,CAAC,CAAC;YACrE,OAAO,EAAE,CAAC;SACX;QAED,OAAO,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;QAEvD,MAAM,KAAK,GAAG,IAAA,wBAAQ,EAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI,EAAE;oBACJ,QAAQ,EAAE,IAAA,8BAAc,EAAC,KAAK,CAAC,QAAQ,CAAC;iBACzC;gBACD,GAAG,EAAE;oBACH,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB;gBACD,SAAS,EAAE,YAAY;aACxB,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC;AAEH,iBAAS,IAAI,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
3
|
+
const util_1 = require("../util");
|
|
4
|
+
const rule = (0, util_1.createRule)({
|
|
5
|
+
name: "export-just-namespace",
|
|
6
|
+
defaultOptions: [],
|
|
7
|
+
meta: {
|
|
8
|
+
type: "problem",
|
|
9
|
+
docs: {
|
|
10
|
+
description: "Forbids `export = foo` where `foo` is a namespace and isn't merged with a function/class/type/interface.",
|
|
11
|
+
recommended: "error",
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
useTheBody: "Instead of `export =`-ing a namespace, use the body of the namespace as the module body.",
|
|
15
|
+
},
|
|
16
|
+
schema: [],
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
const ast = context.getSourceCode().ast;
|
|
20
|
+
const exportEqualsNode = ast.body.find(isExportEqualsWithIdentifier);
|
|
21
|
+
if (!exportEqualsNode) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
if (isJustNamespace(ast.body, exportEqualsNode.expression.name)) {
|
|
25
|
+
context.report({
|
|
26
|
+
messageId: "useTheBody",
|
|
27
|
+
node: exportEqualsNode,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return {};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* @returns Where there is a namespace but there are no functions/classes/etc. with the same name.
|
|
35
|
+
*/
|
|
36
|
+
function isJustNamespace(statements, exportEqualsName) {
|
|
37
|
+
let anyNamespace = false;
|
|
38
|
+
for (const statement of statements) {
|
|
39
|
+
switch (statement.type) {
|
|
40
|
+
case utils_1.AST_NODE_TYPES.TSModuleDeclaration:
|
|
41
|
+
anyNamespace || (anyNamespace = nameMatches(statement.id));
|
|
42
|
+
break;
|
|
43
|
+
case utils_1.AST_NODE_TYPES.VariableDeclaration:
|
|
44
|
+
if (statement.declarations.some((d) => nameMatches(d.id))) {
|
|
45
|
+
// OK. It's merged with a variable.
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case utils_1.AST_NODE_TYPES.ClassDeclaration:
|
|
50
|
+
case utils_1.AST_NODE_TYPES.FunctionDeclaration:
|
|
51
|
+
case utils_1.AST_NODE_TYPES.TSDeclareFunction:
|
|
52
|
+
case utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration:
|
|
53
|
+
case utils_1.AST_NODE_TYPES.TSInterfaceDeclaration:
|
|
54
|
+
if (nameMatches(statement.id)) {
|
|
55
|
+
// OK. It's merged with a function/class/type/interface.
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return anyNamespace;
|
|
62
|
+
function nameMatches(nameNode) {
|
|
63
|
+
return !!nameNode && nameNode.type === utils_1.AST_NODE_TYPES.Identifier && nameNode.name === exportEqualsName;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function isExportEqualsWithIdentifier(node) {
|
|
67
|
+
return node.type === utils_1.AST_NODE_TYPES.TSExportAssignment && node.expression.type === utils_1.AST_NODE_TYPES.Identifier;
|
|
68
|
+
}
|
|
69
|
+
module.exports = rule;
|
|
70
|
+
//# sourceMappingURL=export-just-namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-just-namespace.js","sourceRoot":"","sources":["../../src/rules/export-just-namespace.ts"],"names":[],"mappings":";AAAA,oDAAoE;AACpE,kCAAqC;AAMrC,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAC;IACtB,IAAI,EAAE,uBAAuB;IAC7B,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,0GAA0G;YAC5G,WAAW,EAAE,OAAO;SACrB;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,0FAA0F;SACvG;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC;QAExC,MAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrE,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,EAAE,CAAC;SACX;QAED,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YAC/D,OAAO,CAAC,MAAM,CAAC;gBACb,SAAS,EAAE,YAAY;gBACvB,IAAI,EAAE,gBAAgB;aACvB,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC;AAEH;;GAEG;AACH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,0 +1,38 @@
|
|
|
1
|
+
export declare const rules: {
|
|
2
|
+
"dt-header": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"definitionsBy" | "minimumTypeScriptVersion" | "parseError" | "typeDefinitionsFor" | "typescriptVersion", never[], {}>;
|
|
3
|
+
"export-just-namespace": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useTheBody", never[], {}>;
|
|
4
|
+
"no-any-union": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"anyUnion", never[], {
|
|
5
|
+
TSUnionType(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSUnionType): void;
|
|
6
|
+
}>;
|
|
7
|
+
"no-bad-reference": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referencePathPackage" | "referencePathTest", never[], {}>;
|
|
8
|
+
"no-const-enum": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"constEnum", never[], {
|
|
9
|
+
"TSEnumDeclaration[const]"(node: never): void;
|
|
10
|
+
}>;
|
|
11
|
+
"no-dead-reference": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referenceAtTop", never[], {}>;
|
|
12
|
+
"no-declare-current-package": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noDeclareCurrentPackage", never[], {} | {
|
|
13
|
+
TSModuleDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSModuleDeclaration): void;
|
|
14
|
+
}>;
|
|
15
|
+
"no-import-default-of-export-equals": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noImportDefaultOfExportEquals", never[], {
|
|
16
|
+
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
17
|
+
} | {}>;
|
|
18
|
+
"no-outside-dependencies": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noOutsideDependencies", never[], {}>;
|
|
19
|
+
"no-self-import": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useRelativeImport", never[], {} | {
|
|
20
|
+
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
21
|
+
}>;
|
|
22
|
+
"no-single-element-tuple-type": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"singleElementTupleType", never[], {
|
|
23
|
+
"TSTupleType[elementTypes.length=1]"(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSTupleType): void;
|
|
24
|
+
}>;
|
|
25
|
+
"no-unnecessary-generics": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"never" | "sole", never[], {
|
|
26
|
+
[x: string]: (esNode: import("@typescript-eslint/types/dist/generated/ast-spec").FunctionLike & {
|
|
27
|
+
typeParameters: {};
|
|
28
|
+
}) => void;
|
|
29
|
+
}>;
|
|
30
|
+
"no-useless-files": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noContent", never[], {}>;
|
|
31
|
+
"prefer-declare-function": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"variableFunction", never[], {
|
|
32
|
+
"VariableDeclaration > VariableDeclarator"(node: import("@typescript-eslint/types/dist/generated/ast-spec").VariableDeclarator): void;
|
|
33
|
+
}>;
|
|
34
|
+
"redundant-undefined": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"redundantUndefined", never[], {
|
|
35
|
+
TSUnionType(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSUnionType): void;
|
|
36
|
+
}>;
|
|
37
|
+
"trim-file": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"leadingBlankLine" | "trailingBlankLine", never[], {}>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.rules = void 0;
|
|
27
|
+
const dtHeader = __importStar(require("./dt-header"));
|
|
28
|
+
const exportJustNamespace = __importStar(require("./export-just-namespace"));
|
|
29
|
+
const noAnyUnion = __importStar(require("./no-any-union"));
|
|
30
|
+
const noBadReference = __importStar(require("./no-bad-reference"));
|
|
31
|
+
const noConstEnum = __importStar(require("./no-const-enum"));
|
|
32
|
+
const noDeadReference = __importStar(require("./no-dead-reference"));
|
|
33
|
+
const noDeclareCurrentPackage = __importStar(require("./no-declare-current-package"));
|
|
34
|
+
const noImportDefaultOfExportEquals = __importStar(require("./no-import-default-of-export-equals"));
|
|
35
|
+
const noOutsideDependencies = __importStar(require("./no-outside-dependencies"));
|
|
36
|
+
const noSelfImport = __importStar(require("./no-self-import"));
|
|
37
|
+
const noSingleElementTupleType = __importStar(require("./no-single-element-tuple-type"));
|
|
38
|
+
const noUnnecessaryGenerics = __importStar(require("./no-unnecessary-generics"));
|
|
39
|
+
const noUselessFiles = __importStar(require("./no-useless-files"));
|
|
40
|
+
const preferDeclareFunction = __importStar(require("./prefer-declare-function"));
|
|
41
|
+
const redundantUndefined = __importStar(require("./redundant-undefined"));
|
|
42
|
+
const trimFile = __importStar(require("./trim-file"));
|
|
43
|
+
exports.rules = {
|
|
44
|
+
"dt-header": dtHeader,
|
|
45
|
+
"export-just-namespace": exportJustNamespace,
|
|
46
|
+
"no-any-union": noAnyUnion,
|
|
47
|
+
"no-bad-reference": noBadReference,
|
|
48
|
+
"no-const-enum": noConstEnum,
|
|
49
|
+
"no-dead-reference": noDeadReference,
|
|
50
|
+
"no-declare-current-package": noDeclareCurrentPackage,
|
|
51
|
+
"no-import-default-of-export-equals": noImportDefaultOfExportEquals,
|
|
52
|
+
"no-outside-dependencies": noOutsideDependencies,
|
|
53
|
+
"no-self-import": noSelfImport,
|
|
54
|
+
"no-single-element-tuple-type": noSingleElementTupleType,
|
|
55
|
+
"no-unnecessary-generics": noUnnecessaryGenerics,
|
|
56
|
+
"no-useless-files": noUselessFiles,
|
|
57
|
+
"prefer-declare-function": preferDeclareFunction,
|
|
58
|
+
"redundant-undefined": redundantUndefined,
|
|
59
|
+
"trim-file": trimFile,
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,6EAA+D;AAC/D,2DAA6C;AAC7C,mEAAqD;AACrD,6DAA+C;AAC/C,qEAAuD;AACvD,sFAAwE;AACxE,oGAAsF;AACtF,iFAAmE;AACnE,+DAAiD;AACjD,yFAA2E;AAC3E,iFAAmE;AACnE,mEAAqD;AACrD,iFAAmE;AACnE,0EAA4D;AAC5D,sDAAwC;AAE3B,QAAA,KAAK,GAAG;IACnB,WAAW,EAAE,QAAQ;IACrB,uBAAuB,EAAE,mBAAmB;IAC5C,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,cAAc;IAClC,eAAe,EAAE,WAAW;IAC5B,mBAAmB,EAAE,eAAe;IACpC,4BAA4B,EAAE,uBAAuB;IACrD,oCAAoC,EAAE,6BAA6B;IACnE,yBAAyB,EAAE,qBAAqB;IAChD,gBAAgB,EAAE,YAAY;IAC9B,8BAA8B,EAAE,wBAAwB;IACxD,yBAAyB,EAAE,qBAAqB;IAChD,kBAAkB,EAAE,cAAc;IAClC,yBAAyB,EAAE,qBAAqB;IAChD,qBAAqB,EAAE,kBAAkB;IACzC,WAAW,EAAE,QAAQ;CACtB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const util_1 = require("../util");
|
|
3
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
4
|
+
const rule = (0, util_1.createRule)({
|
|
5
|
+
name: "no-any-union",
|
|
6
|
+
defaultOptions: [],
|
|
7
|
+
meta: {
|
|
8
|
+
type: "problem",
|
|
9
|
+
docs: {
|
|
10
|
+
description: "Forbid a union to contain `any`",
|
|
11
|
+
recommended: "error",
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
anyUnion: "Including `any` in a union will override all other members of the union.",
|
|
15
|
+
},
|
|
16
|
+
schema: [],
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
21
|
+
TSUnionType(node) {
|
|
22
|
+
const hasAnyType = node.types.some((t) => t.type === utils_1.AST_NODE_TYPES.TSAnyKeyword);
|
|
23
|
+
if (hasAnyType) {
|
|
24
|
+
context.report({
|
|
25
|
+
messageId: "anyUnion",
|
|
26
|
+
node,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
module.exports = rule;
|
|
34
|
+
//# sourceMappingURL=no-any-union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-any-union.js","sourceRoot":"","sources":["../../src/rules/no-any-union.ts"],"names":[],"mappings":";AAAA,kCAAqC;AACrC,oDAA0D;AAE1D,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAC;IACtB,IAAI,EAAE,cAAc;IACpB,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,iCAAiC;YAC9C,WAAW,EAAE,OAAO;SACrB;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,0EAA0E;SACrF;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,gEAAgE;YAChE,WAAW,CAAC,IAAI;gBACd,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,sBAAc,CAAC,YAAY,CAAC,CAAC;gBAClF,IAAI,UAAU,EAAE;oBACd,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,UAAU;wBACrB,IAAI;qBACL,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,iBAAS,IAAI,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const util_1 = require("../util");
|
|
3
|
+
const rule = (0, util_1.createRule)({
|
|
4
|
+
name: "no-bad-reference",
|
|
5
|
+
defaultOptions: [],
|
|
6
|
+
meta: {
|
|
7
|
+
type: "problem",
|
|
8
|
+
docs: {
|
|
9
|
+
description: `Forbids <reference path="../etc"/> in any file, and forbid <reference path> in test files.`,
|
|
10
|
+
recommended: "error",
|
|
11
|
+
},
|
|
12
|
+
messages: {
|
|
13
|
+
referencePathPackage: "Don't use <reference path> to reference another package. Use an import or <reference types> instead.",
|
|
14
|
+
referencePathTest: "Don't use <reference path> in test files. Use <reference types> or include the file in 'tsconfig.json'.",
|
|
15
|
+
},
|
|
16
|
+
schema: [],
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
var _a;
|
|
20
|
+
const { comments } = context.getSourceCode().ast;
|
|
21
|
+
const isDeclarationFile = context.getFilename().endsWith(".d.ts");
|
|
22
|
+
for (const comment of comments) {
|
|
23
|
+
const referenceMatch = (_a = comment.value.match(/<reference\s+path\s*=\s*"(.+)"\s*\/>/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
24
|
+
if (!referenceMatch) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (isDeclarationFile) {
|
|
28
|
+
if (referenceMatch.startsWith("..")) {
|
|
29
|
+
report(comment, "referencePathPackage");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
report(comment, "referencePathTest");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {};
|
|
37
|
+
function report(comment, messageId) {
|
|
38
|
+
context.report({
|
|
39
|
+
loc: {
|
|
40
|
+
end: {
|
|
41
|
+
column: comment.value.lastIndexOf(`"`),
|
|
42
|
+
line: comment.loc.end.line,
|
|
43
|
+
},
|
|
44
|
+
start: {
|
|
45
|
+
column: comment.value.indexOf(`"`) + 1,
|
|
46
|
+
line: comment.loc.start.line,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
messageId,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
module.exports = rule;
|
|
55
|
+
//# sourceMappingURL=no-bad-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-bad-reference.js","sourceRoot":"","sources":["../../src/rules/no-bad-reference.ts"],"names":[],"mappings":";AACA,kCAAqC;AAIrC,MAAM,IAAI,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,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;wBACtC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI;qBAC7B;iBACF;gBACD,SAAS;aACV,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,iBAAS,IAAI,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const util_1 = require("../util");
|
|
3
|
+
const rule = (0, util_1.createRule)({
|
|
4
|
+
name: "no-const-enum",
|
|
5
|
+
defaultOptions: [],
|
|
6
|
+
meta: {
|
|
7
|
+
type: "problem",
|
|
8
|
+
docs: {
|
|
9
|
+
description: "Forbid `const enum`",
|
|
10
|
+
recommended: "error",
|
|
11
|
+
},
|
|
12
|
+
messages: {
|
|
13
|
+
constEnum: "Use of `const enum` is forbidden.",
|
|
14
|
+
},
|
|
15
|
+
schema: [],
|
|
16
|
+
},
|
|
17
|
+
create(context) {
|
|
18
|
+
return {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20
|
+
"TSEnumDeclaration[const]"(node) {
|
|
21
|
+
context.report({
|
|
22
|
+
messageId: "constEnum",
|
|
23
|
+
node,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
module.exports = rule;
|
|
30
|
+
//# sourceMappingURL=no-const-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-const-enum.js","sourceRoot":"","sources":["../../src/rules/no-const-enum.ts"],"names":[],"mappings":";AAAA,kCAAqC;AAErC,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAC;IACtB,IAAI,EAAE,eAAe;IACrB,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,OAAO;SACrB;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,mCAAmC;SAC/C;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,gEAAgE;YAChE,0BAA0B,CAAC,IAAI;gBAC7B,OAAO,CAAC,MAAM,CAAC;oBACb,SAAS,EAAE,WAAW;oBACtB,IAAI;iBACL,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,iBAAS,IAAI,CAAC"}
|