eslint-plugin-obsidian 2.7.0 → 2.8.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.
- package/dist/dto/callExpression.d.ts +14 -0
- package/dist/dto/callExpression.d.ts.map +1 -0
- package/dist/dto/callExpression.js +30 -0
- package/dist/dto/callExpression.js.map +1 -0
- package/dist/dto/class.js +2 -2
- package/dist/dto/class.js.map +1 -1
- package/dist/dto/componentProps.d.ts +8 -0
- package/dist/dto/componentProps.d.ts.map +1 -0
- package/dist/dto/componentProps.js +30 -0
- package/dist/dto/componentProps.js.map +1 -0
- package/dist/dto/decorator.js +2 -2
- package/dist/dto/decorator.js.map +1 -1
- package/dist/dto/file.d.ts +3 -1
- package/dist/dto/file.d.ts.map +1 -1
- package/dist/dto/file.js +14 -6
- package/dist/dto/file.js.map +1 -1
- package/dist/dto/functionalComponent.d.ts +8 -0
- package/dist/dto/functionalComponent.d.ts.map +1 -0
- package/dist/dto/functionalComponent.js +14 -0
- package/dist/dto/functionalComponent.js.map +1 -0
- package/dist/dto/generics.d.ts +9 -0
- package/dist/dto/generics.d.ts.map +1 -0
- package/dist/dto/generics.js +24 -0
- package/dist/dto/generics.js.map +1 -0
- package/dist/dto/identifier.d.ts +7 -0
- package/dist/dto/identifier.d.ts.map +1 -0
- package/dist/dto/identifier.js +13 -0
- package/dist/dto/identifier.js.map +1 -0
- package/dist/dto/missingType.d.ts +7 -0
- package/dist/dto/missingType.d.ts.map +1 -0
- package/dist/dto/missingType.js +16 -0
- package/dist/dto/missingType.js.map +1 -0
- package/dist/dto/singleType.d.ts +10 -0
- package/dist/dto/singleType.d.ts.map +1 -0
- package/dist/dto/singleType.js +22 -0
- package/dist/dto/singleType.js.map +1 -0
- package/dist/dto/type.d.ts +6 -0
- package/dist/dto/type.d.ts.map +1 -0
- package/dist/dto/type.js +3 -0
- package/dist/dto/type.js.map +1 -0
- package/dist/dto/typeIntersection.d.ts +10 -0
- package/dist/dto/typeIntersection.d.ts.map +1 -0
- package/dist/dto/typeIntersection.js +24 -0
- package/dist/dto/typeIntersection.js.map +1 -0
- package/dist/dto/typeLiteral.d.ts +8 -0
- package/dist/dto/typeLiteral.d.ts.map +1 -0
- package/dist/dto/typeLiteral.js +19 -0
- package/dist/dto/typeLiteral.js.map +1 -0
- package/dist/dto/typeReference.d.ts +10 -0
- package/dist/dto/typeReference.d.ts.map +1 -0
- package/dist/dto/typeReference.js +21 -0
- package/dist/dto/typeReference.js.map +1 -0
- package/dist/dto/variable.d.ts +9 -0
- package/dist/dto/variable.d.ts.map +1 -0
- package/dist/dto/variable.js +25 -0
- package/dist/dto/variable.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/rules/stronglyTypedInjectComponent/createRule.d.ts +7 -0
- package/dist/rules/stronglyTypedInjectComponent/createRule.d.ts.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/createRule.js +17 -0
- package/dist/rules/stronglyTypedInjectComponent/createRule.js.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/errorReporter.d.ts +9 -0
- package/dist/rules/stronglyTypedInjectComponent/errorReporter.d.ts.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/errorReporter.js +17 -0
- package/dist/rules/stronglyTypedInjectComponent/errorReporter.js.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/index.d.ts +3 -0
- package/dist/rules/stronglyTypedInjectComponent/index.d.ts.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/index.js +29 -0
- package/dist/rules/stronglyTypedInjectComponent/index.js.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/injectComponentHandler.d.ts +11 -0
- package/dist/rules/stronglyTypedInjectComponent/injectComponentHandler.d.ts.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/injectComponentHandler.js +27 -0
- package/dist/rules/stronglyTypedInjectComponent/injectComponentHandler.js.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/typeValidator.d.ts +15 -0
- package/dist/rules/stronglyTypedInjectComponent/typeValidator.d.ts.map +1 -0
- package/dist/rules/stronglyTypedInjectComponent/typeValidator.js +26 -0
- package/dist/rules/stronglyTypedInjectComponent/typeValidator.js.map +1 -0
- package/dist/rules/unresolvedProviderDependencies/subgraphResolver.js +3 -3
- package/dist/rules/unresolvedProviderDependencies/subgraphResolver.js.map +1 -1
- package/dist/utils/array.d.ts +2 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +8 -0
- package/dist/utils/array.js.map +1 -0
- package/dist/{ast/utils.d.ts → utils/ast.d.ts} +7 -2
- package/dist/utils/ast.d.ts.map +1 -0
- package/dist/{ast/utils.js → utils/ast.js} +27 -13
- package/dist/utils/ast.js.map +1 -0
- package/package.json +2 -1
- package/dist/ast/utils.d.ts.map +0 -1
- package/dist/ast/utils.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { Identifier } from './identifier';
|
|
3
|
+
import { Generics } from './generics';
|
|
4
|
+
export declare class CallExpression {
|
|
5
|
+
readonly node: TSESTree.CallExpression;
|
|
6
|
+
constructor(node: TSESTree.CallExpression);
|
|
7
|
+
isExpression(name: string): boolean;
|
|
8
|
+
get name(): string;
|
|
9
|
+
get parent(): TSESTree.Node;
|
|
10
|
+
get arguments(): Identifier[];
|
|
11
|
+
get generics(): Generics | undefined;
|
|
12
|
+
private get callee();
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=callExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callExpression.d.ts","sourceRoot":"","sources":["../../src/dto/callExpression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,cAAc;IACX,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc;gBAA7B,IAAI,EAAE,QAAQ,CAAC,cAAc;IAE3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,MAAM,IAAI,QAAQ,CAAC,IAAI,CAE1B;IAED,IAAI,SAAS,IAAI,UAAU,EAAE,CAE5B;IAED,IAAI,QAAQ,yBAEX;IAED,OAAO,KAAK,MAAM,GAEjB;CACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallExpression = void 0;
|
|
4
|
+
const identifier_1 = require("./identifier");
|
|
5
|
+
const generics_1 = require("./generics");
|
|
6
|
+
class CallExpression {
|
|
7
|
+
constructor(node) {
|
|
8
|
+
this.node = node;
|
|
9
|
+
}
|
|
10
|
+
isExpression(name) {
|
|
11
|
+
return this.name === name;
|
|
12
|
+
}
|
|
13
|
+
get name() {
|
|
14
|
+
return this.callee.name;
|
|
15
|
+
}
|
|
16
|
+
get parent() {
|
|
17
|
+
return this.node.parent;
|
|
18
|
+
}
|
|
19
|
+
get arguments() {
|
|
20
|
+
return this.node.arguments.map((arg) => new identifier_1.Identifier(arg));
|
|
21
|
+
}
|
|
22
|
+
get generics() {
|
|
23
|
+
return this.node.typeArguments && new generics_1.Generics(this.node.typeArguments);
|
|
24
|
+
}
|
|
25
|
+
get callee() {
|
|
26
|
+
return this.node.callee;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CallExpression = CallExpression;
|
|
30
|
+
//# sourceMappingURL=callExpression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callExpression.js","sourceRoot":"","sources":["../../src/dto/callExpression.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,yCAAsC;AAEtC,MAAa,cAAc;IACvB,YAAqB,IAA6B;QAA7B,SAAI,GAAJ,IAAI,CAAyB;IAAG,CAAC;IAE/C,YAAY,CAAC,IAAY;QAC5B,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IAC9B,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,MAAO,CAAC;IAC7B,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,uBAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1E,CAAC;IAED,IAAY,MAAM;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,MAA6B,CAAC;IACnD,CAAC;CACJ;AA1BD,wCA0BC"}
|
package/dist/dto/class.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Clazz = void 0;
|
|
4
4
|
const decorator_1 = require("./decorator");
|
|
5
5
|
const assertions_1 = require("../utils/assertions");
|
|
6
|
-
const
|
|
6
|
+
const ast_1 = require("../utils/ast");
|
|
7
7
|
const method_1 = require("./method");
|
|
8
8
|
class Clazz {
|
|
9
9
|
constructor(node) {
|
|
@@ -26,7 +26,7 @@ class Clazz {
|
|
|
26
26
|
}
|
|
27
27
|
getDecoratedMethods(decoratorName) {
|
|
28
28
|
return this.body
|
|
29
|
-
.filter(
|
|
29
|
+
.filter(ast_1.isMethodDefinition)
|
|
30
30
|
.map((node) => new method_1.Method(node))
|
|
31
31
|
.filter((method) => method.isDecoratedWith(decoratorName));
|
|
32
32
|
}
|
package/dist/dto/class.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/dto/class.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,oDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/dto/class.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,oDAAoD;AACpD,sCAAkD;AAClD,qCAAkC;AAElC,MAAa,KAAK;IAChB,YAAmB,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;QAChD,IAAA,0BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAoB,EAAE,EAAE;YAClD,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1C,CAAC,CAAC,IAAI,EAAE,CAAC;IACX,CAAC;IAED,IAAI,UAAU;;QACZ,OAAO,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAA6B,EAAE,EAAE;YACxE,OAAO,IAAI,qBAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7B,CAAC;IAEM,mBAAmB,CAAC,aAAqB;QAC9C,OAAO,IAAI,CAAC,IAAI;aACb,MAAM,CAAC,wBAAkB,CAAC;aAC1B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAM,CAAC,IAAI,CAAC,CAAC;aAC/B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,CAAC;IAEM,gBAAgB,CAAC,IAAY;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,UAAqB,EAAE,EAAE;YAC/D,OAAO,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;QACpD,CAAC,CAAC,CAAC;QACH,IAAA,0BAAa,EAAC,SAAS,EAAE,aAAa,IAAI,uBAAuB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAY,IAAI;;QACd,OAAO,MAAA,IAAI,CAAC,IAAI,CAAC,EAAE,0CAAE,IAAI,CAAC;IAC5B,CAAC;CACF;AAvCD,sBAuCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentProps.d.ts","sourceRoot":"","sources":["../../src/dto/componentProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAUzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,qBAAa,cAAc;IAEb,OAAO,CAAC,KAAK;gBADb,KAAK,EAAE,QAAQ,CAAC,SAAS;IAGrC,IAAI,IAAI,IAAI,IAAI,CAQf;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentProps = void 0;
|
|
4
|
+
const ast_1 = require("../utils/ast");
|
|
5
|
+
const singleType_1 = require("./singleType");
|
|
6
|
+
const typeIntersection_1 = require("./typeIntersection");
|
|
7
|
+
const missingType_1 = require("./missingType");
|
|
8
|
+
const typeReference_1 = require("./typeReference");
|
|
9
|
+
class ComponentProps {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
this.props = props;
|
|
12
|
+
}
|
|
13
|
+
get type() {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const typeAnnotation = (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.typeAnnotation) === null || _b === void 0 ? void 0 : _b.typeAnnotation;
|
|
16
|
+
if (!typeAnnotation)
|
|
17
|
+
return new missingType_1.MissingType();
|
|
18
|
+
if ((0, ast_1.isTypeIntersection)(typeAnnotation))
|
|
19
|
+
return new typeIntersection_1.TypeIntersection(typeAnnotation);
|
|
20
|
+
if ((0, ast_1.isAnyType)(typeAnnotation))
|
|
21
|
+
return new missingType_1.MissingType();
|
|
22
|
+
if ((0, ast_1.isTypeReference)(typeAnnotation))
|
|
23
|
+
return new typeReference_1.TypeReference(typeAnnotation);
|
|
24
|
+
if ((0, ast_1.isTypeAnnotation)((_c = this.props) === null || _c === void 0 ? void 0 : _c.typeAnnotation))
|
|
25
|
+
return new singleType_1.SingleType(this.props);
|
|
26
|
+
return new missingType_1.MissingType();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ComponentProps = ComponentProps;
|
|
30
|
+
//# sourceMappingURL=componentProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentProps.js","sourceRoot":"","sources":["../../src/dto/componentProps.ts"],"names":[],"mappings":";;;AACA,sCAKsB;AACtB,6CAA0C;AAC1C,yDAAsD;AACtD,+CAA4C;AAE5C,mDAAgD;AAEhD,MAAa,cAAc;IAEzB,YAAoB,KAA0B;QAA1B,UAAK,GAAL,KAAK,CAAqB;IAAI,CAAC;IAEnD,IAAI,IAAI;;QACN,MAAM,cAAc,GAAG,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,cAAc,0CAAE,cAAc,CAAC;QAClE,IAAI,CAAC,cAAc;YAAE,OAAO,IAAI,yBAAW,EAAE,CAAC;QAC9C,IAAI,IAAA,wBAAkB,EAAC,cAAc,CAAC;YAAE,OAAO,IAAI,mCAAgB,CAAC,cAAc,CAAC,CAAC;QACpF,IAAI,IAAA,eAAS,EAAC,cAAc,CAAC;YAAE,OAAO,IAAI,yBAAW,EAAE,CAAC;QACxD,IAAI,IAAA,qBAAe,EAAC,cAAc,CAAC;YAAE,OAAO,IAAI,6BAAa,CAAC,cAAc,CAAC,CAAC;QAC9E,IAAI,IAAA,sBAAgB,EAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,cAAc,CAAC;YAAE,OAAO,IAAI,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpF,OAAO,IAAI,yBAAW,EAAE,CAAC;IAC3B,CAAC;CACF;AAbD,wCAaC"}
|
package/dist/dto/decorator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Decorator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ast_1 = require("../utils/ast");
|
|
5
5
|
const property_1 = require("./property");
|
|
6
6
|
class Decorator {
|
|
7
7
|
constructor(node) {
|
|
@@ -11,7 +11,7 @@ class Decorator {
|
|
|
11
11
|
return this.node.expression;
|
|
12
12
|
}
|
|
13
13
|
getProperty(name) {
|
|
14
|
-
const property = (0,
|
|
14
|
+
const property = (0, ast_1.getDecoratorProperty)(this.node, name);
|
|
15
15
|
return property && new property_1.Property(property);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/dto/decorator.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/dto/decorator.ts"],"names":[],"mappings":";;;AACA,sCAAoD;AACpD,yCAAsC;AAMtC,MAAa,SAAS;IACpB,YAAoB,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;IAAG,CAAC;IAEhD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,UAA4B,CAAC;IAChD,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,MAAM,QAAQ,GAAG,IAAA,0BAAoB,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvD,OAAO,QAAQ,IAAI,IAAI,mBAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF;AAXD,8BAWC"}
|
package/dist/dto/file.d.ts
CHANGED
|
@@ -2,15 +2,17 @@ import type { TSESTree } from '@typescript-eslint/types';
|
|
|
2
2
|
import { Clazz } from './class';
|
|
3
3
|
import { Import } from './import';
|
|
4
4
|
import { ClassFile } from './classFile';
|
|
5
|
+
import { Variable } from './variable';
|
|
5
6
|
export declare class File {
|
|
6
7
|
private program;
|
|
7
8
|
private path;
|
|
8
|
-
constructor(program: TSESTree.Program, path
|
|
9
|
+
constructor(program: TSESTree.Program, path?: string);
|
|
9
10
|
requireGraph(name: string): Clazz;
|
|
10
11
|
private get classNodes();
|
|
11
12
|
private get body();
|
|
12
13
|
toClassWithImports(): ClassFile[];
|
|
13
14
|
get imports(): Import[];
|
|
14
15
|
get graphs(): Clazz[];
|
|
16
|
+
get variables(): Variable[];
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/dto/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAOhC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,IAAI;IAEH,OAAO,CAAC,OAAO;IAAmB,OAAO,CAAC,IAAI;gBAD9C,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM;IAG7C,YAAY,CAAC,IAAI,EAAE,MAAM;IAQhC,OAAO,KAAK,UAAU,GAIrB;IAED,OAAO,KAAK,IAAI,GAEf;IAEM,kBAAkB;IAMzB,IAAI,OAAO,aAIV;IAED,IAAI,MAAM,YAUT;IAED,IAAI,SAAS,eAMZ;CACF"}
|
package/dist/dto/file.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.File = void 0;
|
|
4
4
|
const class_1 = require("./class");
|
|
5
|
-
const
|
|
5
|
+
const ast_1 = require("../utils/ast");
|
|
6
6
|
const import_1 = require("./import");
|
|
7
7
|
const classFile_1 = require("./classFile");
|
|
8
8
|
const assertions_1 = require("../utils/assertions");
|
|
9
|
+
const variable_1 = require("./variable");
|
|
9
10
|
class File {
|
|
10
11
|
constructor(program, path) {
|
|
11
12
|
this.program = program;
|
|
@@ -21,8 +22,8 @@ class File {
|
|
|
21
22
|
}
|
|
22
23
|
get classNodes() {
|
|
23
24
|
return this.body
|
|
24
|
-
.filter(
|
|
25
|
-
.map(
|
|
25
|
+
.filter(ast_1.isClassLike)
|
|
26
|
+
.map(ast_1.getClassDeclaration);
|
|
26
27
|
}
|
|
27
28
|
get body() {
|
|
28
29
|
return this.program.body;
|
|
@@ -34,20 +35,27 @@ class File {
|
|
|
34
35
|
}
|
|
35
36
|
get imports() {
|
|
36
37
|
return this.body
|
|
37
|
-
.filter(
|
|
38
|
+
.filter(ast_1.isImportDeclaration)
|
|
38
39
|
.map((node) => new import_1.Import(node));
|
|
39
40
|
}
|
|
40
41
|
get graphs() {
|
|
41
42
|
return this.body
|
|
42
|
-
.filter(
|
|
43
|
+
.filter(ast_1.isClassLike)
|
|
43
44
|
.map((node) => {
|
|
44
|
-
const clazz = (0,
|
|
45
|
+
const clazz = (0, ast_1.getClassDeclaration)(node);
|
|
45
46
|
return clazz && new class_1.Clazz(clazz);
|
|
46
47
|
})
|
|
47
48
|
.filter((clazz) => {
|
|
48
49
|
return clazz ? clazz.decoratorNames.includes('Graph') : false;
|
|
49
50
|
});
|
|
50
51
|
}
|
|
52
|
+
get variables() {
|
|
53
|
+
return this.body
|
|
54
|
+
.filter(ast_1.isVariableDeclaration)
|
|
55
|
+
.map((node) => node.declarations)
|
|
56
|
+
.flat()
|
|
57
|
+
.map((node) => new variable_1.Variable(node));
|
|
58
|
+
}
|
|
51
59
|
}
|
|
52
60
|
exports.File = File;
|
|
53
61
|
//# sourceMappingURL=file.js.map
|
package/dist/dto/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAChC,sCAKsB;AACtB,qCAAkC;AAClC,2CAAwC;AACxC,oDAAoD;AACpD,yCAAsC;AAEtC,MAAa,IAAI;IAEf,YAAoB,OAAyB,EAAS,IAAY;QAA9C,YAAO,GAAP,OAAO,CAAkB;QAAS,SAAI,GAAJ,IAAI,CAAQ;IAAI,CAAC;IAEhE,YAAY,CAAC,IAAY;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;;YAC1C,OAAO,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,0CAAE,IAAI,MAAK,IAAI,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,IAAA,0BAAa,EAAC,KAAK,EAAE,SAAS,IAAI,oBAAoB,CAAC,CAAC;QACxD,OAAO,IAAI,aAAK,CAAC,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Y,CAAC;aAChC,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;CACF;AArDD,oBAqDC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { ComponentProps } from './componentProps';
|
|
3
|
+
export declare class FunctionalComponent {
|
|
4
|
+
private node;
|
|
5
|
+
constructor(node: TSESTree.ArrowFunctionExpression);
|
|
6
|
+
get props(): ComponentProps;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=functionalComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functionalComponent.d.ts","sourceRoot":"","sources":["../../src/dto/functionalComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,mBAAmB;IAClB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,uBAAuB;IAE1D,IAAI,KAAK,IAAI,cAAc,CAE1B;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionalComponent = void 0;
|
|
4
|
+
const componentProps_1 = require("./componentProps");
|
|
5
|
+
class FunctionalComponent {
|
|
6
|
+
constructor(node) {
|
|
7
|
+
this.node = node;
|
|
8
|
+
}
|
|
9
|
+
get props() {
|
|
10
|
+
return new componentProps_1.ComponentProps(this.node.params[0]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.FunctionalComponent = FunctionalComponent;
|
|
14
|
+
//# sourceMappingURL=functionalComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functionalComponent.js","sourceRoot":"","sources":["../../src/dto/functionalComponent.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAElD,MAAa,mBAAmB;IAC9B,YAAoB,IAAsC;QAAtC,SAAI,GAAJ,IAAI,CAAkC;IAAG,CAAC;IAE9D,IAAI,KAAK;QACP,OAAO,IAAI,+BAAc,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACF;AAND,kDAMC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import type { Type } from './type';
|
|
3
|
+
export declare class Generics {
|
|
4
|
+
readonly node: TSESTree.TSTypeParameterInstantiation;
|
|
5
|
+
constructor(node: TSESTree.TSTypeParameterInstantiation | undefined);
|
|
6
|
+
get types(): Type[];
|
|
7
|
+
private get params();
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=generics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generics.d.ts","sourceRoot":"","sources":["../../src/dto/generics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,qBAAa,QAAQ;IAEP,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,4BAA4B;gBADpD,IAAI,EAAE,QAAQ,CAAC,4BAA4B,GAAG,SAAS;IAKnE,IAAI,KAAK,IAAI,IAAI,EAAE,CAKlB;IAED,OAAO,KAAK,MAAM,GAEjB;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Generics = void 0;
|
|
4
|
+
const assertions_1 = require("../utils/assertions");
|
|
5
|
+
const ast_1 = require("../utils/ast");
|
|
6
|
+
const typeLiteral_1 = require("./typeLiteral");
|
|
7
|
+
const typeReference_1 = require("./typeReference");
|
|
8
|
+
class Generics {
|
|
9
|
+
constructor(node) {
|
|
10
|
+
this.node = node;
|
|
11
|
+
(0, assertions_1.assertDefined)(node);
|
|
12
|
+
}
|
|
13
|
+
get types() {
|
|
14
|
+
return this.params
|
|
15
|
+
.map((param) => {
|
|
16
|
+
return (0, ast_1.isTypeLiteral)(param) ? new typeLiteral_1.TypeLiteral() : new typeReference_1.TypeReference(param);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
get params() {
|
|
20
|
+
return this.node.params;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.Generics = Generics;
|
|
24
|
+
//# sourceMappingURL=generics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generics.js","sourceRoot":"","sources":["../../src/dto/generics.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,sCAA6C;AAC7C,+CAA4C;AAE5C,mDAAgD;AAEhD,MAAa,QAAQ;IAEnB,YAAqB,IAA2C;QAA3C,SAAI,GAAJ,IAAI,CAAuC;QAC9D,IAAA,0BAAa,EAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM;aACf,GAAG,CAAC,CAAC,KAA+B,EAAE,EAAE;YACvC,OAAO,IAAA,mBAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,IAAI,6BAAa,CAAC,KAAK,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAY,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAoC,CAAC;IACxD,CAAC;CACF;AAhBD,4BAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../src/dto/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAa,UAAU;IAET,OAAO,CAAC,IAAI;gBADZ,IAAI,EAAE,QAAQ,CAAC,IAAI;IAG/B,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Identifier = void 0;
|
|
4
|
+
class Identifier {
|
|
5
|
+
constructor(node) {
|
|
6
|
+
this.node = node;
|
|
7
|
+
}
|
|
8
|
+
get name() {
|
|
9
|
+
return this.node.name;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.Identifier = Identifier;
|
|
13
|
+
//# sourceMappingURL=identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/dto/identifier.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IAErB,YAAoB,IAAyB;QAAzB,SAAI,GAAJ,IAAI,CAAqB;IAAG,CAAC;IAEjD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;CACF;AAPD,gCAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingType.d.ts","sourceRoot":"","sources":["../../src/dto/missingType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,qBAAa,WAAY,YAAW,IAAI;IACtC,QAAQ,IAAI,MAAM,EAAE;IAIpB,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO;CAG/B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MissingType = void 0;
|
|
4
|
+
class MissingType {
|
|
5
|
+
toString() {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
isEmpty() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
equals(types) {
|
|
12
|
+
return types.length === 0 || types.length === 1 && types[0].isEmpty();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.MissingType = MissingType;
|
|
16
|
+
//# sourceMappingURL=missingType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingType.js","sourceRoot":"","sources":["../../src/dto/missingType.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACtB,QAAQ;QACN,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACxE,CAAC;CACF;AAZD,kCAYC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import type { Type } from './type';
|
|
3
|
+
export declare class SingleType implements Type {
|
|
4
|
+
private props;
|
|
5
|
+
constructor(props: TSESTree.Identifier);
|
|
6
|
+
toString(): string[];
|
|
7
|
+
isEmpty(): boolean;
|
|
8
|
+
equals(types: Type[]): boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=singleType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleType.d.ts","sourceRoot":"","sources":["../../src/dto/singleType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,qBAAa,UAAW,YAAW,IAAI;IACzB,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ,CAAC,UAAU;IAE9C,QAAQ,IAAI,MAAM,EAAE;IAKpB,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO;CAG/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SingleType = void 0;
|
|
4
|
+
const identifier_1 = require("./identifier");
|
|
5
|
+
class SingleType {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.props = props;
|
|
8
|
+
}
|
|
9
|
+
toString() {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const typeRef = (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.typeAnnotation) === null || _b === void 0 ? void 0 : _b.typeAnnotation;
|
|
12
|
+
return [new identifier_1.Identifier(typeRef.typeName).name];
|
|
13
|
+
}
|
|
14
|
+
isEmpty() {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
equals(types) {
|
|
18
|
+
return types.length === 1 && types[0].toString() === this.toString();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.SingleType = SingleType;
|
|
22
|
+
//# sourceMappingURL=singleType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleType.js","sourceRoot":"","sources":["../../src/dto/singleType.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAE1C,MAAa,UAAU;IACrB,YAAoB,KAA0B;QAA1B,UAAK,GAAL,KAAK,CAAqB;IAAG,CAAC;IAElD,QAAQ;;QACN,MAAM,OAAO,GAAG,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,cAAc,0CAAE,cAA0C,CAAC;QACvF,OAAO,CAAC,IAAI,uBAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;IACvE,CAAC;CACF;AAfD,gCAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/dto/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,QAAQ,IAAI,MAAM,EAAE,CAAC;IACrB,OAAO,IAAI,OAAO,CAAC;IACnB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;CAChC"}
|
package/dist/dto/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/dto/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { Type } from './type';
|
|
3
|
+
export declare class TypeIntersection implements Type {
|
|
4
|
+
private typeAnnotation;
|
|
5
|
+
constructor(typeAnnotation: TSESTree.TSIntersectionType);
|
|
6
|
+
toString(): string[];
|
|
7
|
+
isEmpty(): boolean;
|
|
8
|
+
equals(types: Type[]): boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=typeIntersection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIntersection.d.ts","sourceRoot":"","sources":["../../src/dto/typeIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,qBAAa,gBAAiB,YAAW,IAAI;IAC/B,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,QAAQ,CAAC,kBAAkB;IAE/D,QAAQ,IAAI,MAAM,EAAE;IAOpB,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO;CAG/B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeIntersection = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const identifier_1 = require("./identifier");
|
|
6
|
+
class TypeIntersection {
|
|
7
|
+
constructor(typeAnnotation) {
|
|
8
|
+
this.typeAnnotation = typeAnnotation;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return this.typeAnnotation.types.map((type) => {
|
|
12
|
+
const typeRef = type;
|
|
13
|
+
return new identifier_1.Identifier(typeRef.typeName).name;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
isEmpty() {
|
|
17
|
+
return this.typeAnnotation.types.length === 0;
|
|
18
|
+
}
|
|
19
|
+
equals(types) {
|
|
20
|
+
return (0, lodash_1.isEqual)(this.toString(), types.map((type) => type.toString()).flat());
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.TypeIntersection = TypeIntersection;
|
|
24
|
+
//# sourceMappingURL=typeIntersection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIntersection.js","sourceRoot":"","sources":["../../src/dto/typeIntersection.ts"],"names":[],"mappings":";;;AACA,mCAAiC;AAEjC,6CAA0C;AAE1C,MAAa,gBAAgB;IAC3B,YAAoB,cAA2C;QAA3C,mBAAc,GAAd,cAAc,CAA6B;IAAI,CAAC;IAEpE,QAAQ;QACN,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG,IAAgC,CAAC;YACjD,OAAO,IAAI,uBAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AAjBD,4CAiBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Type } from './type';
|
|
2
|
+
export declare class TypeLiteral implements Type {
|
|
3
|
+
static isTypeLiteral(type: Type): type is TypeLiteral;
|
|
4
|
+
toString(): string[];
|
|
5
|
+
isEmpty(): boolean;
|
|
6
|
+
equals(types: Type[]): boolean;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=typeLiteral.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeLiteral.d.ts","sourceRoot":"","sources":["../../src/dto/typeLiteral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,qBAAa,WAAY,YAAW,IAAI;IACtC,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,WAAW;IAIrD,QAAQ,IAAI,MAAM,EAAE;IAIpB,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO;CAG/B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeLiteral = void 0;
|
|
4
|
+
class TypeLiteral {
|
|
5
|
+
static isTypeLiteral(type) {
|
|
6
|
+
return type instanceof TypeLiteral;
|
|
7
|
+
}
|
|
8
|
+
toString() {
|
|
9
|
+
throw new Error('Method not implemented.');
|
|
10
|
+
}
|
|
11
|
+
isEmpty() {
|
|
12
|
+
throw new Error('Method not implemented.');
|
|
13
|
+
}
|
|
14
|
+
equals(types) {
|
|
15
|
+
return types.length === 1 && types[0].toString() === this.toString();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.TypeLiteral = TypeLiteral;
|
|
19
|
+
//# sourceMappingURL=typeLiteral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeLiteral.js","sourceRoot":"","sources":["../../src/dto/typeLiteral.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACtB,MAAM,CAAC,aAAa,CAAC,IAAU;QAC7B,OAAO,IAAI,YAAY,WAAW,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;IACvE,CAAC;CACF;AAhBD,kCAgBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import type { Type } from './type';
|
|
3
|
+
export declare class TypeReference implements Type {
|
|
4
|
+
private node;
|
|
5
|
+
constructor(node: TSESTree.TSTypeReference);
|
|
6
|
+
toString(): string[];
|
|
7
|
+
isEmpty(): boolean;
|
|
8
|
+
equals(types: Type[]): boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=typeReference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeReference.d.ts","sourceRoot":"","sources":["../../src/dto/typeReference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,qBAAa,aAAc,YAAW,IAAI;IAC5B,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,eAAe;IAElD,QAAQ,IAAI,MAAM,EAAE;IAIpB,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO;CAG/B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeReference = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const identifier_1 = require("./identifier");
|
|
6
|
+
class TypeReference {
|
|
7
|
+
constructor(node) {
|
|
8
|
+
this.node = node;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return [new identifier_1.Identifier(this.node.typeName).name];
|
|
12
|
+
}
|
|
13
|
+
isEmpty() {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
equals(types) {
|
|
17
|
+
return (0, lodash_1.isEqual)(this.toString(), types.map((type) => type.toString()).flat());
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.TypeReference = TypeReference;
|
|
21
|
+
//# sourceMappingURL=typeReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeReference.js","sourceRoot":"","sources":["../../src/dto/typeReference.ts"],"names":[],"mappings":";;;AACA,mCAAiC;AAEjC,6CAA0C;AAE1C,MAAa,aAAa;IACxB,YAAoB,IAA8B;QAA9B,SAAI,GAAJ,IAAI,CAA0B;IAAG,CAAC;IAEtD,QAAQ;QACN,OAAO,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF;AAdD,sCAcC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
export declare class Variable {
|
|
3
|
+
private node;
|
|
4
|
+
constructor(node: TSESTree.VariableDeclarator);
|
|
5
|
+
get name(): string;
|
|
6
|
+
get isArrowFunction(): boolean;
|
|
7
|
+
get arrowFunction(): TSESTree.ArrowFunctionExpression;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/dto/variable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,qBAAa,QAAQ;IACP,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,kBAAkB;IAErD,IAAI,IAAI,WAEP;IAED,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,IAAI,aAAa,IAAI,QAAQ,CAAC,uBAAuB,CAGpD;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Variable = void 0;
|
|
7
|
+
const assert_1 = __importDefault(require("assert"));
|
|
8
|
+
class Variable {
|
|
9
|
+
constructor(node) {
|
|
10
|
+
this.node = node;
|
|
11
|
+
}
|
|
12
|
+
get name() {
|
|
13
|
+
return this.node.id.name;
|
|
14
|
+
}
|
|
15
|
+
get isArrowFunction() {
|
|
16
|
+
var _a;
|
|
17
|
+
return ((_a = this.node.init) === null || _a === void 0 ? void 0 : _a.type) === 'ArrowFunctionExpression';
|
|
18
|
+
}
|
|
19
|
+
get arrowFunction() {
|
|
20
|
+
(0, assert_1.default)(this.isArrowFunction, 'Variable does not represent an arrow function');
|
|
21
|
+
return this.node.init;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Variable = Variable;
|
|
25
|
+
//# sourceMappingURL=variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable.js","sourceRoot":"","sources":["../../src/dto/variable.ts"],"names":[],"mappings":";;;;;;AACA,oDAA4B;AAE5B,MAAa,QAAQ;IACnB,YAAoB,IAAiC;QAAjC,SAAI,GAAJ,IAAI,CAA6B;IAAG,CAAC;IAEzD,IAAI,IAAI;QACN,OAAQ,IAAI,CAAC,IAAI,CAAC,EAA0B,CAAC,IAAI,CAAC;IACpD,CAAC;IAED,IAAI,eAAe;;QACjB,OAAO,CAAA,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,0CAAE,IAAI,MAAK,yBAAyB,CAAC;IAC5D,CAAC;IAED,IAAI,aAAa;QACf,IAAA,gBAAM,EAAC,IAAI,CAAC,eAAe,EAAE,+CAA+C,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,IAAI,CAAC,IAAwC,CAAC;IAC5D,CAAC;CACF;AAfD,4BAeC"}
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const { unresolvedProviderDependenciesGenerator } = require('./rules/unresolvedProviderDependencies');
|
|
4
4
|
const { noCircularDependenciesGenerator } = require('./rules/noCircularDependency');
|
|
5
|
+
const { stronglyTypedInjectComponentGenerator } = require('./rules/stronglyTypedInjectComponent');
|
|
5
6
|
module.exports = {
|
|
6
7
|
rules: {
|
|
7
8
|
'unresolved-provider-dependencies': unresolvedProviderDependenciesGenerator(),
|
|
8
9
|
'no-circular-dependencies': noCircularDependenciesGenerator(),
|
|
10
|
+
'strongly-typed-inject-component': stronglyTypedInjectComponentGenerator(),
|
|
9
11
|
},
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,uCAAuC,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACtG,MAAM,EAAE,+BAA+B,EAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,uCAAuC,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACtG,MAAM,EAAE,+BAA+B,EAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AACpF,MAAM,EAAE,qCAAqC,EAAE,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;AAElG,MAAM,CAAC,OAAO,GAAG;IACf,KAAK,EAAE;QACL,kCAAkC,EAAE,uCAAuC,EAAE;QAC7E,0BAA0B,EAAE,+BAA+B,EAAE;QAC7D,iCAAiC,EAAE,qCAAqC,EAAE;KAC3E;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { Context } from '../../dto/context';
|
|
3
|
+
import { CallExpression } from '../../dto/callExpression';
|
|
4
|
+
export declare function create(context: Context): {
|
|
5
|
+
CallExpression(node: TSESTree.CallExpression): void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=createRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRule.d.ts","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/createRule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO;yBAOd,uBAAuB;EAI/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.create = void 0;
|
|
4
|
+
const injectComponentHandler_1 = require("./injectComponentHandler");
|
|
5
|
+
const callExpression_1 = require("../../dto/callExpression");
|
|
6
|
+
const errorReporter_1 = require("./errorReporter");
|
|
7
|
+
const typeValidator_1 = require("./typeValidator");
|
|
8
|
+
function create(context) {
|
|
9
|
+
const injectComponentHandler = new injectComponentHandler_1.InjectComponentHandler(new errorReporter_1.ErrorReporter(context), new typeValidator_1.TypeValidator());
|
|
10
|
+
return {
|
|
11
|
+
CallExpression(node) {
|
|
12
|
+
injectComponentHandler.handle(new callExpression_1.CallExpression(node));
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.create = create;
|
|
17
|
+
//# sourceMappingURL=createRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/createRule.ts"],"names":[],"mappings":";;;AAEA,qEAAkE;AAClE,6DAA0D;AAC1D,mDAAgD;AAChD,mDAAgD;AAEhD,SAAgB,MAAM,CAAC,OAAgB;IACrC,MAAM,sBAAsB,GAAG,IAAI,+CAAsB,CACvD,IAAI,6BAAa,CAAC,OAAO,CAAC,EAC1B,IAAI,6BAAa,EAAE,CACpB,CAAC;IAEF,OAAO;QACL,cAAc,CAAC,IAA6B;YAC1C,sBAAsB,CAAC,MAAM,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAXD,wBAWC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import type { Context } from '../../dto/context';
|
|
3
|
+
import type { Type } from '../../dto/type';
|
|
4
|
+
export declare class ErrorReporter {
|
|
5
|
+
private context;
|
|
6
|
+
constructor(context: Context);
|
|
7
|
+
report(types?: Type, node?: TSESTree.Node): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=errorReporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorReporter.d.ts","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/errorReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAa,aAAa;IACZ,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,OAAO;IAE7B,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI;CAWjD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorReporter = void 0;
|
|
4
|
+
class ErrorReporter {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
this.context = context;
|
|
7
|
+
}
|
|
8
|
+
report(types, node) {
|
|
9
|
+
if (types && node) {
|
|
10
|
+
this.context.reportError(node, 'strongly-typed-inject-component', {
|
|
11
|
+
expectation: `injectedComponent<${types.toString()}>`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ErrorReporter = ErrorReporter;
|
|
17
|
+
//# sourceMappingURL=errorReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorReporter.js","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/errorReporter.ts"],"names":[],"mappings":";;;AAIA,MAAa,aAAa;IACxB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAI,CAAC;IAElC,MAAM,CAAC,KAAY,EAAE,IAAoB;QAC9C,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,WAAW,CACtB,IAAI,EACJ,iCAAiC,EACjC;gBACE,WAAW,EAAE,qBAAqB,KAAK,CAAC,QAAQ,EAAE,GAAG;aACtD,CACF,CAAC;SACH;IACH,CAAC;CACF;AAdD,sCAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAWtE,eAAO,MAAM,qCAAqC,yFAmBjD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stronglyTypedInjectComponentGenerator = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const createRule_1 = require("./createRule");
|
|
6
|
+
const context_1 = require("../../dto/context");
|
|
7
|
+
const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://wix-incubator.github.io/obsidian/docs/documentation/meta/eslint#${name}`);
|
|
8
|
+
const stronglyTypedInjectComponentGenerator = () => {
|
|
9
|
+
return createRule({
|
|
10
|
+
create: (context) => {
|
|
11
|
+
return (0, createRule_1.create)(new context_1.Context(context));
|
|
12
|
+
},
|
|
13
|
+
name: 'strongly-typed-inject-component',
|
|
14
|
+
meta: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: 'Calling injectComponent without prop types is a bad practice and a common source of bugs.',
|
|
17
|
+
recommended: 'strict',
|
|
18
|
+
},
|
|
19
|
+
messages: {
|
|
20
|
+
'strongly-typed-inject-component': 'The call to injectComponent is missing prop types. It should be typed as: {{expectation}}',
|
|
21
|
+
},
|
|
22
|
+
schema: [],
|
|
23
|
+
type: 'problem',
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: [],
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.stronglyTypedInjectComponentGenerator = stronglyTypedInjectComponentGenerator;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/index.ts"],"names":[],"mappings":";;;AAAA,oDAAsE;AAEtE,6CAAsC;AACtC,+CAA0C;AAI1C,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,2EAA2E,IAAI,EAAE,CAC5F,CAAC;AAEK,MAAM,qCAAqC,GAAG,GAAG,EAAE;IACxD,OAAO,UAAU,CAAC;QAChB,MAAM,EAAE,CAAC,OAA2D,EAAE,EAAE;YACtE,OAAO,IAAA,mBAAM,EAAC,IAAI,iBAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,WAAW,EAAE,2FAA2F;gBACxG,WAAW,EAAE,QAAQ;aACtB;YACD,QAAQ,EAAE;gBACR,iCAAiC,EAAE,2FAA2F;aAC/H;YACD,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,SAAS;SAChB;QACD,cAAc,EAAE,EAAE;KACnB,CAAgB,CAAC;AACpB,CAAC,CAAC;AAnBW,QAAA,qCAAqC,yCAmBhD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CallExpression } from '../../dto/callExpression';
|
|
2
|
+
import type { ErrorReporter } from './errorReporter';
|
|
3
|
+
import type { TypeValidator } from './typeValidator';
|
|
4
|
+
export declare class InjectComponentHandler {
|
|
5
|
+
private errorReporter;
|
|
6
|
+
private typeValidator;
|
|
7
|
+
constructor(errorReporter: ErrorReporter, typeValidator: TypeValidator);
|
|
8
|
+
handle(callExpression: CallExpression): void;
|
|
9
|
+
private getInjectedComponent;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=injectComponentHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectComponentHandler.d.ts","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/injectComponentHandler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,sBAAsB;IACrB,OAAO,CAAC,aAAa;IAAiB,OAAO,CAAC,aAAa;gBAAnD,aAAa,EAAE,aAAa,EAAU,aAAa,EAAE,aAAa;IAE/E,MAAM,CAAC,cAAc,EAAE,cAAc;IAQ5C,OAAO,CAAC,oBAAoB;CAM7B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InjectComponentHandler = void 0;
|
|
4
|
+
const ast_1 = require("../../utils/ast");
|
|
5
|
+
const file_1 = require("../../dto/file");
|
|
6
|
+
class InjectComponentHandler {
|
|
7
|
+
constructor(errorReporter, typeValidator) {
|
|
8
|
+
this.errorReporter = errorReporter;
|
|
9
|
+
this.typeValidator = typeValidator;
|
|
10
|
+
}
|
|
11
|
+
handle(callExpression) {
|
|
12
|
+
if (callExpression.isExpression('injectComponent')) {
|
|
13
|
+
const injectedComponent = this.getInjectedComponent(callExpression.node, callExpression.arguments);
|
|
14
|
+
const { isError, componentProps } = this.typeValidator.validate(injectedComponent, callExpression.generics);
|
|
15
|
+
if (isError)
|
|
16
|
+
this.errorReporter.report(componentProps, callExpression.node);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
getInjectedComponent(node, args) {
|
|
20
|
+
return new file_1.File((0, ast_1.requireProgram)(node))
|
|
21
|
+
.variables
|
|
22
|
+
.filter((variable) => variable.isArrowFunction)
|
|
23
|
+
.find((variable) => variable.name === args[0].name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.InjectComponentHandler = InjectComponentHandler;
|
|
27
|
+
//# sourceMappingURL=injectComponentHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectComponentHandler.js","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/injectComponentHandler.ts"],"names":[],"mappings":";;;AAEA,yCAAiD;AACjD,yCAAsC;AAKtC,MAAa,sBAAsB;IACjC,YAAoB,aAA4B,EAAU,aAA4B;QAAlE,kBAAa,GAAb,aAAa,CAAe;QAAU,kBAAa,GAAb,aAAa,CAAe;IAAI,CAAC;IAEpF,MAAM,CAAC,cAA8B;QAC1C,IAAI,cAAc,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE;YAClD,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;YACnG,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,iBAAiB,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC5G,IAAI,OAAO;gBAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;SAC7E;IACH,CAAC;IAEO,oBAAoB,CAAC,IAA6B,EAAE,IAAkB;QAC5E,OAAO,IAAI,WAAI,CAAC,IAAA,oBAAc,EAAC,IAAI,CAAC,CAAC;aAClC,SAAS;aACT,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;aAC9C,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;CACF;AAjBD,wDAiBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Generics } from '../../dto/generics';
|
|
2
|
+
import type { Variable } from '../../dto/variable';
|
|
3
|
+
import type { Type } from '../../dto/type';
|
|
4
|
+
export declare class TypeValidator {
|
|
5
|
+
validate(injectedComponent?: Variable, generics?: Generics): {
|
|
6
|
+
isError: boolean;
|
|
7
|
+
componentProps?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
isError: boolean;
|
|
10
|
+
componentProps: Type;
|
|
11
|
+
};
|
|
12
|
+
private comparePropsAndTypes;
|
|
13
|
+
private hasInlineType;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=typeValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeValidator.d.ts","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/typeValidator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAa,aAAa;IACjB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ;;;;;;;IAOjE,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,aAAa;CAGtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeValidator = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const functionalComponent_1 = require("../../dto/functionalComponent");
|
|
6
|
+
const typeLiteral_1 = require("../../dto/typeLiteral");
|
|
7
|
+
const array_1 = require("../../utils/array");
|
|
8
|
+
class TypeValidator {
|
|
9
|
+
validate(injectedComponent, generics) {
|
|
10
|
+
if (!injectedComponent)
|
|
11
|
+
return { isError: false };
|
|
12
|
+
const componentProps = new functionalComponent_1.FunctionalComponent(injectedComponent.arrowFunction).props.type;
|
|
13
|
+
const injectComponentGenerics = (generics === null || generics === void 0 ? void 0 : generics.types) || [];
|
|
14
|
+
return { isError: !this.comparePropsAndTypes(componentProps, injectComponentGenerics), componentProps };
|
|
15
|
+
}
|
|
16
|
+
comparePropsAndTypes(componentProps, injectComponentGenerics) {
|
|
17
|
+
return (this.hasInlineType(injectComponentGenerics) ||
|
|
18
|
+
componentProps.equals(injectComponentGenerics) ||
|
|
19
|
+
(0, array_1.isEmpty)(injectComponentGenerics) && (0, lodash_1.isEqual)(componentProps.toString(), ['Injected']));
|
|
20
|
+
}
|
|
21
|
+
hasInlineType(injectComponentGenerics) {
|
|
22
|
+
return injectComponentGenerics.some(typeLiteral_1.TypeLiteral.isTypeLiteral);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TypeValidator = TypeValidator;
|
|
26
|
+
//# sourceMappingURL=typeValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeValidator.js","sourceRoot":"","sources":["../../../src/rules/stronglyTypedInjectComponent/typeValidator.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AACjC,uEAAoE;AAEpE,uDAAoD;AAEpD,6CAA4C;AAG5C,MAAa,aAAa;IACjB,QAAQ,CAAC,iBAA4B,EAAE,QAAmB;QAC/D,IAAI,CAAC,iBAAiB;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAClD,MAAM,cAAc,GAAG,IAAI,yCAAmB,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3F,MAAM,uBAAuB,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,KAAI,EAAE,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,EAAE,uBAAuB,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1G,CAAC;IAEO,oBAAoB,CAAC,cAAoB,EAAE,uBAA+B;QAChF,OAAO,CACL,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC;YAC3C,cAAc,CAAC,MAAM,CAAC,uBAAuB,CAAC;YAC9C,IAAA,eAAO,EAAC,uBAAuB,CAAC,IAAI,IAAA,gBAAO,EAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CACrF,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,uBAA+B;QACnD,OAAO,uBAAuB,CAAC,IAAI,CAAC,yBAAW,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;CACF;AAnBD,sCAmBC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SubgraphResolver = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ast_1 = require("../../utils/ast");
|
|
5
5
|
const classFile_1 = require("../../dto/classFile");
|
|
6
6
|
const file_1 = require("../../dto/file");
|
|
7
7
|
class SubgraphResolver {
|
|
@@ -50,13 +50,13 @@ class SubgraphResolver {
|
|
|
50
50
|
createLocalGraphClasses({ clazz, imports, path }, localGraphNames) {
|
|
51
51
|
if (localGraphNames.length === 0)
|
|
52
52
|
return [];
|
|
53
|
-
const parent = new file_1.File((0,
|
|
53
|
+
const parent = new file_1.File((0, ast_1.requireProgram)(clazz.node), path);
|
|
54
54
|
return localGraphNames.map((localGraphName) => {
|
|
55
55
|
return new classFile_1.ClassFile(parent.requireGraph(localGraphName), imports, path);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
getSubgraphNamesFromDecoratorProperty(subgraphs) {
|
|
59
|
-
return (0,
|
|
59
|
+
return (0, ast_1.mapArrayExpression)(subgraphs.getValue(), (el) => el.name);
|
|
60
60
|
}
|
|
61
61
|
getLocalGraphNames(subgraphs, { imports }) {
|
|
62
62
|
return subgraphs.filter((subgraph) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subgraphResolver.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/subgraphResolver.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"subgraphResolver.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/subgraphResolver.ts"],"names":[],"mappings":";;;AACA,yCAAqE;AACrE,mDAAgD;AAEhD,yCAAsC;AAGtC,MAAa,gBAAgB;IAC3B,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAI,CAAC;IAExC,OAAO,CAAC,KAAgB;QAC7B,OAAO;YACL,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;YAChC,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;SAC9B,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;IAEO,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ts","sourceRoot":"","sources":["../../src/utils/array.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,WAEpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/utils/array.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAC,KAAa;IACjC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AACrD,CAAC;AAFD,0BAEC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
2
|
import type { ArrayExpressionElement } from '../types';
|
|
3
3
|
export declare function isClassLike(node: TSESTree.Node): node is TSESTree.ClassDeclaration;
|
|
4
|
+
export declare function isTypeReference(node?: TSESTree.Node): node is TSESTree.TSTypeReference;
|
|
5
|
+
export declare function isTypeLiteral(node: TSESTree.Node): node is TSESTree.TSTypeLiteral;
|
|
4
6
|
export declare function isImportDeclaration(node: TSESTree.Node): node is TSESTree.ImportDeclaration;
|
|
5
7
|
export declare function isMethodDefinition(node: TSESTree.Node): node is TSESTree.MethodDefinition;
|
|
6
8
|
export declare function getClassDeclaration(node: TSESTree.Node): TSESTree.ClassDeclaration | undefined;
|
|
7
9
|
export declare function requireProgram(node: TSESTree.Node | undefined): TSESTree.Program;
|
|
8
|
-
export declare function isImportLike(node: TSESTree.Node): boolean;
|
|
9
10
|
export declare function getDecoratorProperty(decorator: TSESTree.Decorator, propertyName: string): TSESTree.Property | undefined;
|
|
10
11
|
export declare function mapArrayExpression<T>(array: TSESTree.ArrayExpression, map: (el: ArrayExpressionElement) => T): T[];
|
|
11
|
-
|
|
12
|
+
export declare function isTypeIntersection(node: TSESTree.Node | undefined): node is TSESTree.TSIntersectionType;
|
|
13
|
+
export declare function isTypeAnnotation(node: TSESTree.Node | undefined): node is TSESTree.TSTypeAnnotation;
|
|
14
|
+
export declare function isAnyType(node: TSESTree.Node | undefined): node is TSESTree.TSAnyKeyword;
|
|
15
|
+
export declare function isVariableDeclaration(node: TSESTree.Node): node is TSESTree.VariableDeclaration;
|
|
16
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/utils/ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGvD,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAWlF;AAED,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,eAAe,CAEtF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,aAAa,CAEjF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,iBAAiB,CAE3F;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAEzF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAW9F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC,OAAO,CAQhF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,iCAMvF;AAUD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,sBAAsB,KAAK,CAAC,OAE5G;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CAAC,kBAAkB,CAEvG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAEnG;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CAAC,YAAY,CAExF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,mBAAmB,CAE/F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const assertions_1 = require("
|
|
3
|
+
exports.isVariableDeclaration = exports.isAnyType = exports.isTypeAnnotation = exports.isTypeIntersection = exports.mapArrayExpression = exports.getDecoratorProperty = exports.requireProgram = exports.getClassDeclaration = exports.isMethodDefinition = exports.isImportDeclaration = exports.isTypeLiteral = exports.isTypeReference = exports.isClassLike = void 0;
|
|
4
|
+
const assertions_1 = require("./assertions");
|
|
5
5
|
function isClassLike(node) {
|
|
6
6
|
switch (node.type) {
|
|
7
7
|
case 'ClassDeclaration':
|
|
@@ -15,6 +15,14 @@ function isClassLike(node) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.isClassLike = isClassLike;
|
|
18
|
+
function isTypeReference(node) {
|
|
19
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'TSTypeReference';
|
|
20
|
+
}
|
|
21
|
+
exports.isTypeReference = isTypeReference;
|
|
22
|
+
function isTypeLiteral(node) {
|
|
23
|
+
return node.type === 'TSTypeLiteral';
|
|
24
|
+
}
|
|
25
|
+
exports.isTypeLiteral = isTypeLiteral;
|
|
18
26
|
function isImportDeclaration(node) {
|
|
19
27
|
return node.type === 'ImportDeclaration';
|
|
20
28
|
}
|
|
@@ -46,16 +54,6 @@ function requireProgram(node) {
|
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
exports.requireProgram = requireProgram;
|
|
49
|
-
function isImportLike(node) {
|
|
50
|
-
switch (node.type) {
|
|
51
|
-
case 'ImportDeclaration':
|
|
52
|
-
case 'ImportDefaultSpecifier':
|
|
53
|
-
return true;
|
|
54
|
-
default:
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.isImportLike = isImportLike;
|
|
59
57
|
function getDecoratorProperty(decorator, propertyName) {
|
|
60
58
|
const expression = decorator.expression;
|
|
61
59
|
const property = expression.arguments.map((argument) => {
|
|
@@ -75,4 +73,20 @@ function mapArrayExpression(array, map) {
|
|
|
75
73
|
return array.elements.map(map);
|
|
76
74
|
}
|
|
77
75
|
exports.mapArrayExpression = mapArrayExpression;
|
|
78
|
-
|
|
76
|
+
function isTypeIntersection(node) {
|
|
77
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'TSIntersectionType';
|
|
78
|
+
}
|
|
79
|
+
exports.isTypeIntersection = isTypeIntersection;
|
|
80
|
+
function isTypeAnnotation(node) {
|
|
81
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'TSTypeAnnotation';
|
|
82
|
+
}
|
|
83
|
+
exports.isTypeAnnotation = isTypeAnnotation;
|
|
84
|
+
function isAnyType(node) {
|
|
85
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'TSAnyKeyword';
|
|
86
|
+
}
|
|
87
|
+
exports.isAnyType = isAnyType;
|
|
88
|
+
function isVariableDeclaration(node) {
|
|
89
|
+
return node.type === 'VariableDeclaration';
|
|
90
|
+
}
|
|
91
|
+
exports.isVariableDeclaration = isVariableDeclaration;
|
|
92
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/utils/ast.ts"],"names":[],"mappings":";;;AAEA,6CAA6C;AAE7C,SAAgB,WAAW,CAAC,IAAmB;IAC7C,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,kBAAkB;YACrB,OAAO,IAAI,CAAC;QACd,KAAK,0BAA0B;YAC7B,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvC,KAAK,wBAAwB;YAC3B,OAAO,WAAW,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;QACxC;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AAXD,kCAWC;AAED,SAAgB,eAAe,CAAC,IAAoB;IAClD,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,iBAAiB,CAAC;AAC1C,CAAC;AAFD,0CAEC;AAED,SAAgB,aAAa,CAAC,IAAmB;IAC/C,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC;AACvC,CAAC;AAFD,sCAEC;AAED,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAmB,CAAC;AAC3C,CAAC;AAFD,kDAEC;AAED,SAAgB,kBAAkB,CAAC,IAAmB;IACpD,OAAO,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC;AAC1C,CAAC;AAFD,gDAEC;AAED,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,kBAAkB;YACrB,OAAO,IAAI,CAAC;QACd,KAAK,0BAA0B;YAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,KAAK,wBAAwB;YAC3B,OAAO,mBAAmB,CAAC,IAAI,CAAC,WAAY,CAAC,CA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,SAAgB,gBAAgB,CAAC,IAA+B;IAC9D,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,kBAAkB,CAAC;AAC3C,CAAC;AAFD,4CAEC;AAED,SAAgB,SAAS,CAAC,IAA+B;IACvD,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,cAAc,CAAC;AACvC,CAAC;AAFD,8BAEC;AAED,SAAgB,qBAAqB,CAAC,IAAmB;IACvD,OAAO,IAAI,CAAC,IAAI,KAAK,qBAAqB,CAAC;AAC7C,CAAC;AAFD,sDAEC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "eslint-plugin-obsidian",
|
|
3
3
|
"description": "ESLint rules for Obsidian",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.8.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npx tsc --project tsconfig.prod.json",
|
|
8
8
|
"test": "npx jest",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"eslint": "8.x.x",
|
|
19
|
+
"eslint-plugin-obsidian": "*",
|
|
19
20
|
"react-obsidian": "2.x.x"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
package/dist/ast/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/ast/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGvD,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAWlF;AAED,wBAAgB,mBAAmB,CAAC,I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