eslint-plugin-obsidian 2.5.0 → 2.6.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.
Files changed (103) hide show
  1. package/dist/ast/utils.d.ts +11 -0
  2. package/dist/ast/utils.d.ts.map +1 -0
  3. package/dist/ast/utils.js +78 -0
  4. package/dist/ast/utils.js.map +1 -0
  5. package/dist/dto/class.d.ts +14 -0
  6. package/dist/dto/class.d.ts.map +1 -0
  7. package/dist/dto/class.js +45 -0
  8. package/dist/dto/class.js.map +1 -0
  9. package/dist/dto/classWithImports.d.ts +8 -0
  10. package/dist/dto/classWithImports.d.ts.map +1 -0
  11. package/dist/dto/classWithImports.js +11 -0
  12. package/dist/dto/classWithImports.js.map +1 -0
  13. package/dist/dto/decorator.d.ts +13 -0
  14. package/dist/dto/decorator.d.ts.map +1 -0
  15. package/dist/dto/decorator.js +19 -0
  16. package/dist/dto/decorator.js.map +1 -0
  17. package/dist/dto/file.d.ts +15 -0
  18. package/dist/dto/file.d.ts.map +1 -0
  19. package/dist/dto/file.js +52 -0
  20. package/dist/dto/file.js.map +1 -0
  21. package/dist/dto/import.d.ts +8 -0
  22. package/dist/dto/import.d.ts.map +1 -0
  23. package/dist/dto/import.js +18 -0
  24. package/dist/dto/import.js.map +1 -0
  25. package/dist/dto/method.d.ts +11 -0
  26. package/dist/dto/method.d.ts.map +1 -0
  27. package/dist/dto/method.js +28 -0
  28. package/dist/dto/method.js.map +1 -0
  29. package/dist/dto/parameter.d.ts +7 -0
  30. package/dist/dto/parameter.d.ts.map +1 -0
  31. package/dist/dto/parameter.js +13 -0
  32. package/dist/dto/parameter.js.map +1 -0
  33. package/dist/dto/property.d.ts +7 -0
  34. package/dist/dto/property.d.ts.map +1 -0
  35. package/dist/dto/property.js +13 -0
  36. package/dist/dto/property.js.map +1 -0
  37. package/dist/framework/fileReader.d.ts +11 -0
  38. package/dist/framework/fileReader.d.ts.map +1 -0
  39. package/dist/framework/fileReader.js +59 -0
  40. package/dist/framework/fileReader.js.map +1 -0
  41. package/dist/framework/pathResolver.d.ts +5 -0
  42. package/dist/framework/pathResolver.d.ts.map +1 -0
  43. package/dist/framework/pathResolver.js +11 -0
  44. package/dist/framework/pathResolver.js.map +1 -0
  45. package/dist/index.js +2 -2
  46. package/dist/index.js.map +1 -1
  47. package/dist/unresolvedProviderDependencies/createRule.d.ts +8 -0
  48. package/dist/unresolvedProviderDependencies/createRule.d.ts.map +1 -0
  49. package/dist/unresolvedProviderDependencies/createRule.js +23 -0
  50. package/dist/unresolvedProviderDependencies/createRule.js.map +1 -0
  51. package/dist/unresolvedProviderDependencies/dependencyResolver.d.ts +11 -0
  52. package/dist/unresolvedProviderDependencies/dependencyResolver.d.ts.map +1 -0
  53. package/dist/unresolvedProviderDependencies/dependencyResolver.js +28 -0
  54. package/dist/unresolvedProviderDependencies/dependencyResolver.js.map +1 -0
  55. package/dist/unresolvedProviderDependencies/errorReporter.d.ts +8 -0
  56. package/dist/unresolvedProviderDependencies/errorReporter.d.ts.map +1 -0
  57. package/dist/unresolvedProviderDependencies/errorReporter.js +16 -0
  58. package/dist/unresolvedProviderDependencies/errorReporter.js.map +1 -0
  59. package/dist/unresolvedProviderDependencies/graphHandler.d.ts +14 -0
  60. package/dist/unresolvedProviderDependencies/graphHandler.d.ts.map +1 -0
  61. package/dist/unresolvedProviderDependencies/graphHandler.js +24 -0
  62. package/dist/unresolvedProviderDependencies/graphHandler.js.map +1 -0
  63. package/dist/unresolvedProviderDependencies/index.d.ts +2 -3
  64. package/dist/unresolvedProviderDependencies/index.d.ts.map +1 -1
  65. package/dist/unresolvedProviderDependencies/index.js +23 -16
  66. package/dist/unresolvedProviderDependencies/index.js.map +1 -1
  67. package/dist/unresolvedProviderDependencies/resolvedDependencyChecker.d.ts +12 -0
  68. package/dist/unresolvedProviderDependencies/resolvedDependencyChecker.d.ts.map +1 -0
  69. package/dist/unresolvedProviderDependencies/resolvedDependencyChecker.js +20 -0
  70. package/dist/unresolvedProviderDependencies/resolvedDependencyChecker.js.map +1 -0
  71. package/dist/unresolvedProviderDependencies/subgraphResolver.d.ts +16 -0
  72. package/dist/unresolvedProviderDependencies/subgraphResolver.d.ts.map +1 -0
  73. package/dist/unresolvedProviderDependencies/subgraphResolver.js +71 -0
  74. package/dist/unresolvedProviderDependencies/subgraphResolver.js.map +1 -0
  75. package/dist/unresolvedProviderDependencies/types.d.ts +5 -0
  76. package/dist/unresolvedProviderDependencies/types.d.ts.map +1 -0
  77. package/dist/unresolvedProviderDependencies/types.js +3 -0
  78. package/dist/unresolvedProviderDependencies/types.js.map +1 -0
  79. package/dist/utils/assertions.d.ts +2 -0
  80. package/dist/utils/assertions.d.ts.map +1 -0
  81. package/dist/utils/assertions.js +9 -0
  82. package/dist/utils/assertions.js.map +1 -0
  83. package/package.json +4 -4
  84. package/dist/unresolvedProviderDependencies/ASTFunctions.d.ts +0 -16
  85. package/dist/unresolvedProviderDependencies/ASTFunctions.d.ts.map +0 -1
  86. package/dist/unresolvedProviderDependencies/ASTFunctions.js +0 -137
  87. package/dist/unresolvedProviderDependencies/ASTFunctions.js.map +0 -1
  88. package/dist/unresolvedProviderDependencies/createFunction.d.ts +0 -7
  89. package/dist/unresolvedProviderDependencies/createFunction.d.ts.map +0 -1
  90. package/dist/unresolvedProviderDependencies/createFunction.js +0 -39
  91. package/dist/unresolvedProviderDependencies/createFunction.js.map +0 -1
  92. package/dist/unresolvedProviderDependencies/invalidGraphs.d.ts +0 -3
  93. package/dist/unresolvedProviderDependencies/invalidGraphs.d.ts.map +0 -1
  94. package/dist/unresolvedProviderDependencies/invalidGraphs.js +0 -27
  95. package/dist/unresolvedProviderDependencies/invalidGraphs.js.map +0 -1
  96. package/dist/unresolvedProviderDependencies/testUtils/subgraph.d.ts +0 -6
  97. package/dist/unresolvedProviderDependencies/testUtils/subgraph.d.ts.map +0 -1
  98. package/dist/unresolvedProviderDependencies/testUtils/subgraph.js +0 -38
  99. package/dist/unresolvedProviderDependencies/testUtils/subgraph.js.map +0 -1
  100. package/dist/unresolvedProviderDependencies/testUtils/validGraphs.d.ts +0 -3
  101. package/dist/unresolvedProviderDependencies/testUtils/validGraphs.d.ts.map +0 -1
  102. package/dist/unresolvedProviderDependencies/testUtils/validGraphs.js +0 -29
  103. package/dist/unresolvedProviderDependencies/testUtils/validGraphs.js.map +0 -1
@@ -0,0 +1,11 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import type { ArrayExpressionElement } from '../unresolvedProviderDependencies/types';
3
+ export declare function isClassLike(node: TSESTree.Node): node is TSESTree.ClassDeclaration;
4
+ export declare function isImportDeclaration(node: TSESTree.Node): node is TSESTree.ImportDeclaration;
5
+ export declare function isMethodDefinition(node: TSESTree.Node): node is TSESTree.MethodDefinition;
6
+ export declare function getClassDeclaration(node: TSESTree.Node): TSESTree.ClassDeclaration | undefined;
7
+ export declare function requireProgram(node: TSESTree.Node | undefined): TSESTree.Program;
8
+ export declare function isImportLike(node: TSESTree.Node): boolean;
9
+ export declare function getDecoratorProperty(decorator: TSESTree.Decorator, propertyName: string): TSESTree.Property | undefined;
10
+ export declare function mapArrayExpression<T>(array: TSESTree.ArrayExpression, map: (el: ArrayExpressionElement) => T): T[];
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../rules/ast/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAGtF,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAWlF;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,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,OAAO,CAQzD;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"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapArrayExpression = exports.getDecoratorProperty = exports.isImportLike = exports.requireProgram = exports.getClassDeclaration = exports.isMethodDefinition = exports.isImportDeclaration = exports.isClassLike = void 0;
4
+ const assertions_1 = require("../utils/assertions");
5
+ function isClassLike(node) {
6
+ switch (node.type) {
7
+ case 'ClassDeclaration':
8
+ return true;
9
+ case 'ExportDefaultDeclaration':
10
+ return isClassLike(node.declaration);
11
+ case 'ExportNamedDeclaration':
12
+ return isClassLike(node.declaration);
13
+ default:
14
+ return false;
15
+ }
16
+ }
17
+ exports.isClassLike = isClassLike;
18
+ function isImportDeclaration(node) {
19
+ return node.type === 'ImportDeclaration';
20
+ }
21
+ exports.isImportDeclaration = isImportDeclaration;
22
+ function isMethodDefinition(node) {
23
+ return node.type === 'MethodDefinition';
24
+ }
25
+ exports.isMethodDefinition = isMethodDefinition;
26
+ function getClassDeclaration(node) {
27
+ switch (node.type) {
28
+ case 'ClassDeclaration':
29
+ return node;
30
+ case 'ExportDefaultDeclaration':
31
+ return getClassDeclaration(node.declaration);
32
+ case 'ExportNamedDeclaration':
33
+ return getClassDeclaration(node.declaration);
34
+ default:
35
+ return undefined;
36
+ }
37
+ }
38
+ exports.getClassDeclaration = getClassDeclaration;
39
+ function requireProgram(node) {
40
+ (0, assertions_1.assertDefined)(node);
41
+ switch (node.type) {
42
+ case 'Program':
43
+ return node;
44
+ default:
45
+ return requireProgram(node.parent);
46
+ }
47
+ }
48
+ 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
+ function getDecoratorProperty(decorator, propertyName) {
60
+ const expression = decorator.expression;
61
+ const property = expression.arguments.map((argument) => {
62
+ return getObjectProperty(argument, propertyName);
63
+ })[0];
64
+ return property;
65
+ }
66
+ exports.getDecoratorProperty = getDecoratorProperty;
67
+ function getObjectProperty(obj, propertyName) {
68
+ return obj.properties.find((property) => {
69
+ return property.type === 'Property'
70
+ && property.key.type === 'Identifier'
71
+ && property.key.name === propertyName;
72
+ });
73
+ }
74
+ function mapArrayExpression(array, map) {
75
+ return array.elements.map(map);
76
+ }
77
+ exports.mapArrayExpression = mapArrayExpression;
78
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../rules/ast/utils.ts"],"names":[],"mappings":";;;AAEA,oDAAoD;AAEpD,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,WA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AAQ,EAAE,EAAE;QACrD,OAAO,iBAAiB,CAAC,QAAqC,EAAE,YAAY,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACN,OAAO,QAAQ,CAAC;AAClB,CAAC;AAND,oDAMC;AAED,SAAS,iBAAiB,CAAC,GAA8B,EAAE,YAAoB;IAC7E,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtC,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU;eAC9B,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;eAClC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;IAC1C,CAAC,CAAkC,CAAC;AACtC,CAAC;AAED,SAAgB,kBAAkB,CAAI,KAA+B,EAAE,GAAsC;IAC3G,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAFD,gDAEC"}
@@ -0,0 +1,14 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import { Decorator } from './decorator';
3
+ import { Method } from './method';
4
+ export declare class Clazz {
5
+ node: TSESTree.ClassDeclaration;
6
+ constructor(node: TSESTree.ClassDeclaration);
7
+ get decoratorNames(): string[];
8
+ get decorators(): Decorator[];
9
+ get body(): TSESTree.ClassElement[];
10
+ getDecoratedMethods(decoratorName: string): Method[];
11
+ requireDecorator(name: string): Decorator;
12
+ private get name();
13
+ }
14
+ //# sourceMappingURL=class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../rules/dto/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,KAAK;IACG,IAAI,EAAE,QAAQ,CAAC,gBAAgB;gBAA/B,IAAI,EAAE,QAAQ,CAAC,gBAAgB;IAIlD,IAAI,cAAc,aAIjB;IAED,IAAI,UAAU,gBAIb;IAED,IAAI,IAAI,4BAEP;IAEM,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE;IAOpD,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAQpC,OAAO,KAAK,IAAI,GAEf;CACF"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Clazz = void 0;
4
+ const decorator_1 = require("./decorator");
5
+ const assertions_1 = require("../utils/assertions");
6
+ const utils_1 = require("../ast/utils");
7
+ const method_1 = require("./method");
8
+ class Clazz {
9
+ constructor(node) {
10
+ this.node = node;
11
+ (0, assertions_1.assertDefined)(this.node);
12
+ }
13
+ get decoratorNames() {
14
+ return this.decorators.map((decorator) => {
15
+ return decorator.expression.callee.name;
16
+ }) || [];
17
+ }
18
+ get decorators() {
19
+ return this.node.decorators.map((decorator) => {
20
+ return new decorator_1.Decorator(decorator);
21
+ });
22
+ }
23
+ get body() {
24
+ return this.node.body.body;
25
+ }
26
+ getDecoratedMethods(decoratorName) {
27
+ return this.body
28
+ .filter(utils_1.isMethodDefinition)
29
+ .map((node) => new method_1.Method(node))
30
+ .filter((method) => method.isDecoratedWith(decoratorName));
31
+ }
32
+ requireDecorator(name) {
33
+ const decorator = this.decorators.find(($decorator) => {
34
+ return $decorator.expression.callee.name === name;
35
+ });
36
+ (0, assertions_1.assertDefined)(decorator, `Decorator ${name} not found on class ${this.name}`);
37
+ return decorator;
38
+ }
39
+ get name() {
40
+ var _a;
41
+ return (_a = this.node.id) === null || _a === void 0 ? void 0 : _a.name;
42
+ }
43
+ }
44
+ exports.Clazz = Clazz;
45
+ //# sourceMappingURL=class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.js","sourceRoot":"","sources":["../../rules/dto/class.ts"],"names":[],"mappings":";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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,8 @@
1
+ import type { Clazz } from './class';
2
+ import type { Import } from './import';
3
+ export declare class ClassWithImports {
4
+ readonly clazz: Clazz;
5
+ readonly imports: Import[];
6
+ constructor(clazz: Clazz, imports: Import[]);
7
+ }
8
+ //# sourceMappingURL=classWithImports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classWithImports.d.ts","sourceRoot":"","sources":["../../rules/dto/classWithImports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,qBAAa,gBAAgB;aAGT,KAAK,EAAE,KAAK;aACZ,OAAO,EAAE,MAAM,EAAE;gBADjB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,EAAE;CAEpC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClassWithImports = void 0;
4
+ class ClassWithImports {
5
+ constructor(clazz, imports) {
6
+ this.clazz = clazz;
7
+ this.imports = imports;
8
+ }
9
+ }
10
+ exports.ClassWithImports = ClassWithImports;
11
+ //# sourceMappingURL=classWithImports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classWithImports.js","sourceRoot":"","sources":["../../rules/dto/classWithImports.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAgB;IAE3B,YACkB,KAAY,EACZ,OAAiB;QADjB,UAAK,GAAL,KAAK,CAAO;QACZ,YAAO,GAAP,OAAO,CAAU;IAChC,CAAC;CACL;AAND,4CAMC"}
@@ -0,0 +1,13 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import { Property } from './property';
3
+ interface CallExpression extends TSESTree.CallExpression {
4
+ callee: TSESTree.Identifier;
5
+ }
6
+ export declare class Decorator {
7
+ private node;
8
+ constructor(node: TSESTree.Decorator);
9
+ get expression(): CallExpression;
10
+ getProperty(name: string): Property | undefined;
11
+ }
12
+ export {};
13
+ //# sourceMappingURL=decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../rules/dto/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,UAAU,cAAe,SAAQ,QAAQ,CAAC,cAAc;IACtD,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC;CAC7B;AAED,qBAAa,SAAS;IACR,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,SAAS;IAE5C,IAAI,UAAU,mBAEb;IAED,WAAW,CAAC,IAAI,EAAE,MAAM;CAIzB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Decorator = void 0;
4
+ const utils_1 = require("../ast/utils");
5
+ const property_1 = require("./property");
6
+ class Decorator {
7
+ constructor(node) {
8
+ this.node = node;
9
+ }
10
+ get expression() {
11
+ return this.node.expression;
12
+ }
13
+ getProperty(name) {
14
+ const property = (0, utils_1.getDecoratorProperty)(this.node, name);
15
+ return property && new property_1.Property(property);
16
+ }
17
+ }
18
+ exports.Decorator = Decorator;
19
+ //# sourceMappingURL=decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../rules/dto/decorator.ts"],"names":[],"mappings":";;;AACA,wCAAoD;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,4BAAoB,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvD,OAAO,QAAQ,IAAI,IAAI,mBAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF;AAXD,8BAWC"}
@@ -0,0 +1,15 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import { Clazz } from './class';
3
+ import { Import } from './import';
4
+ import { ClassWithImports } from './classWithImports';
5
+ export declare class File {
6
+ private program;
7
+ constructor(program: TSESTree.Program);
8
+ requireGraph(name: string): Clazz;
9
+ private get classNodes();
10
+ private get body();
11
+ toClassWithImports(): ClassWithImports[];
12
+ get imports(): Import[];
13
+ get graphs(): Clazz[];
14
+ }
15
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../rules/dto/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,qBAAa,IAAI;IACH,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,QAAQ,CAAC,OAAO;IAEtC,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;CACF"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.File = void 0;
4
+ const class_1 = require("./class");
5
+ const utils_1 = require("../ast/utils");
6
+ const import_1 = require("./import");
7
+ const classWithImports_1 = require("./classWithImports");
8
+ const assertions_1 = require("../utils/assertions");
9
+ class File {
10
+ constructor(program) {
11
+ this.program = program;
12
+ }
13
+ requireGraph(name) {
14
+ const graph = this.classNodes.find((node) => {
15
+ var _a;
16
+ return ((_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.name) === name;
17
+ });
18
+ (0, assertions_1.assertDefined)(graph, `Graph ${name} not found in file`);
19
+ return new class_1.Clazz(graph);
20
+ }
21
+ get classNodes() {
22
+ return this.body
23
+ .filter(utils_1.isClassLike)
24
+ .map(utils_1.getClassDeclaration);
25
+ }
26
+ get body() {
27
+ return this.program.body;
28
+ }
29
+ toClassWithImports() {
30
+ return this.graphs.map((graph) => {
31
+ return new classWithImports_1.ClassWithImports(graph, this.imports);
32
+ });
33
+ }
34
+ get imports() {
35
+ return this.body
36
+ .filter(utils_1.isImportDeclaration)
37
+ .map((node) => new import_1.Import(node));
38
+ }
39
+ get graphs() {
40
+ return this.body
41
+ .filter(utils_1.isClassLike)
42
+ .map((node) => {
43
+ const clazz = (0, utils_1.getClassDeclaration)(node);
44
+ return clazz && new class_1.Clazz(clazz);
45
+ })
46
+ .filter((clazz) => {
47
+ return clazz ? clazz.decoratorNames.includes('Graph') : false;
48
+ });
49
+ }
50
+ }
51
+ exports.File = File;
52
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","sourceRoot":"","sources":["../../rules/dto/file.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAChC,wCAAqF;AACrF,qCAAkC;AAClC,yDAAsD;AACtD,oDAAoD;AAEpD,MAAa,IAAI;IACf,YAAoB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IAAI,CAAC;IAE3C,YAAY,CAAC,IAAY;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,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CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAChE,CAAC,CAAY,CAAC;IAClB,CAAC;CACF;AA5CD,oBA4CC"}
@@ -0,0 +1,8 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ export declare class Import {
3
+ private node;
4
+ constructor(node: TSESTree.ImportDeclaration);
5
+ get path(): string;
6
+ includes(name: string): boolean;
7
+ }
8
+ //# sourceMappingURL=import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../rules/dto/import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAa,MAAM;IACL,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,iBAAiB;IAEpD,IAAI,IAAI,WAEP;IAEM,QAAQ,CAAC,IAAI,EAAE,MAAM;CAK7B"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Import = void 0;
4
+ class Import {
5
+ constructor(node) {
6
+ this.node = node;
7
+ }
8
+ get path() {
9
+ return this.node.source.value;
10
+ }
11
+ includes(name) {
12
+ return this.node.specifiers
13
+ .map((specifier) => specifier.local.name)
14
+ .includes(name);
15
+ }
16
+ }
17
+ exports.Import = Import;
18
+ //# sourceMappingURL=import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.js","sourceRoot":"","sources":["../../rules/dto/import.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IACjB,YAAoB,IAAgC;QAAhC,SAAI,GAAJ,IAAI,CAA4B;IAAI,CAAC;IAEzD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAChC,CAAC;IAEM,QAAQ,CAAC,IAAY;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU;aACxB,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC;aACxC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;CACF;AAZD,wBAYC"}
@@ -0,0 +1,11 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import { Parameter } from './parameter';
3
+ export declare class Method {
4
+ readonly node: TSESTree.MethodDefinition;
5
+ constructor(node: TSESTree.MethodDefinition);
6
+ get name(): string;
7
+ get parameters(): Parameter[];
8
+ isDecoratedWith(decoratorName: string): boolean;
9
+ private get decorators();
10
+ }
11
+ //# sourceMappingURL=method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../rules/dto/method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,MAAM;aAEW,IAAI,EAAE,QAAQ,CAAC,gBAAgB;gBAA/B,IAAI,EAAE,QAAQ,CAAC,gBAAgB;IAE3D,IAAI,IAAI,WAEP;IAED,IAAI,UAAU,gBAEb;IAED,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAM/C,OAAO,KAAK,UAAU,GAIrB;CACF"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Method = void 0;
4
+ const decorator_1 = require("./decorator");
5
+ const parameter_1 = require("./parameter");
6
+ class Method {
7
+ constructor(node) {
8
+ this.node = node;
9
+ }
10
+ get name() {
11
+ return this.node.key.name;
12
+ }
13
+ get parameters() {
14
+ return this.node.value.params.map((param) => new parameter_1.Parameter(param));
15
+ }
16
+ isDecoratedWith(decoratorName) {
17
+ return this.decorators.some((decorator) => {
18
+ return decorator.expression.callee.name === decoratorName;
19
+ });
20
+ }
21
+ get decorators() {
22
+ return this.node.decorators.map((decorator) => {
23
+ return new decorator_1.Decorator(decorator);
24
+ }) || [];
25
+ }
26
+ }
27
+ exports.Method = Method;
28
+ //# sourceMappingURL=method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method.js","sourceRoot":"","sources":["../../rules/dto/method.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,2CAAwC;AAExC,MAAa,MAAM;IAEjB,YAA4B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAAG,CAAC;IAE/D,IAAI,IAAI;QACN,OAAQ,IAAI,CAAC,IAAI,CAAC,GAA2B,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,eAAe,CAAC,aAAqB;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;YACxC,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAC5C,OAAO,IAAI,qBAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,EAAE,CAAC;IACX,CAAC;CACF;AAvBD,wBAuBC"}
@@ -0,0 +1,7 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ export declare class Parameter {
3
+ readonly node: TSESTree.Parameter;
4
+ constructor(node: TSESTree.Parameter);
5
+ get name(): string;
6
+ }
7
+ //# sourceMappingURL=parameter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter.d.ts","sourceRoot":"","sources":["../../rules/dto/parameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAa,SAAS;aACQ,IAAI,EAAE,QAAQ,CAAC,SAAS;gBAAxB,IAAI,EAAE,QAAQ,CAAC,SAAS;IAEpD,IAAI,IAAI,WAEP;CACF"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Parameter = void 0;
4
+ class Parameter {
5
+ constructor(node) {
6
+ this.node = node;
7
+ }
8
+ get name() {
9
+ return this.node.name;
10
+ }
11
+ }
12
+ exports.Parameter = Parameter;
13
+ //# sourceMappingURL=parameter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../rules/dto/parameter.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IACpB,YAA4B,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;IAAG,CAAC;IAExD,IAAI,IAAI;QACN,OAAQ,IAAI,CAAC,IAA4B,CAAC,IAAI,CAAC;IACjD,CAAC;CACF;AAND,8BAMC"}
@@ -0,0 +1,7 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ export declare class Property {
3
+ private node;
4
+ constructor(node: TSESTree.Property);
5
+ getValue<T>(): T;
6
+ }
7
+ //# sourceMappingURL=property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../rules/dto/property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAa,QAAQ;IACP,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,QAAQ;IAE3C,QAAQ,CAAC,CAAC;CAGX"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Property = void 0;
4
+ class Property {
5
+ constructor(node) {
6
+ this.node = node;
7
+ }
8
+ getValue() {
9
+ return this.node.value;
10
+ }
11
+ }
12
+ exports.Property = Property;
13
+ //# sourceMappingURL=property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property.js","sourceRoot":"","sources":["../../rules/dto/property.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IACnB,YAAoB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAE/C,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAU,CAAC;IAC9B,CAAC;CACF;AAND,4BAMC"}
@@ -0,0 +1,11 @@
1
+ import type { RuleContext } from '@typescript-eslint/utils/ts-eslint';
2
+ import type { PathResolver } from './pathResolver';
3
+ import { File } from '../dto/file';
4
+ export declare class FileReader {
5
+ private context;
6
+ private pathResolver;
7
+ constructor(context: RuleContext<any, any>, pathResolver: PathResolver);
8
+ read(relativeFilePath: string): File;
9
+ private parse;
10
+ }
11
+ //# sourceMappingURL=fileReader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileReader.d.ts","sourceRoot":"","sources":["../../rules/framework/fileReader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,qBAAa,UAAU;IACT,OAAO,CAAC,OAAO;IAAyB,OAAO,CAAC,YAAY;gBAApD,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAAU,YAAY,EAAE,YAAY;IAE/E,IAAI,CAAC,gBAAgB,EAAE,MAAM;IAOpC,OAAO,CAAC,KAAK;CAmBd"}
@@ -0,0 +1,59 @@
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.FileReader = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const parser_1 = require("@typescript-eslint/parser");
29
+ const file_1 = require("../dto/file");
30
+ class FileReader {
31
+ constructor(context, pathResolver) {
32
+ this.context = context;
33
+ this.pathResolver = pathResolver;
34
+ }
35
+ read(relativeFilePath) {
36
+ const filePath = this.pathResolver.resolve(this.context, relativeFilePath);
37
+ const fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
38
+ const fileAST = this.parse(fileContent, filePath);
39
+ return new file_1.File(fileAST);
40
+ }
41
+ parse(content, filePath) {
42
+ return (0, parser_1.parse)(content, {
43
+ ecmaVersion: 9,
44
+ ecmaFeatures: {
45
+ globalReturn: false,
46
+ jsx: true,
47
+ },
48
+ sourceType: 'module',
49
+ comment: true,
50
+ attachComment: true,
51
+ tokens: true,
52
+ loc: true,
53
+ range: true,
54
+ filePath,
55
+ });
56
+ }
57
+ }
58
+ exports.FileReader = FileReader;
59
+ //# sourceMappingURL=fileReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileReader.js","sourceRoot":"","sources":["../../rules/framework/fileReader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AACzB,sDAAkD;AAElD,sCAAmC;AAEnC,MAAa,UAAU;IACrB,YAAoB,OAA8B,EAAU,YAA0B;QAAlE,YAAO,GAAP,OAAO,CAAuB;QAAU,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAEnF,IAAI,CAAC,gBAAwB;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC3E,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO,IAAI,WAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,QAAgB;QAC7C,OAAO,IAAA,cAAK,EACV,OAAO,EACP;YACE,WAAW,EAAE,CAAC;YACd,YAAY,EAAE;gBACZ,YAAY,EAAE,KAAK;gBACnB,GAAG,EAAE,IAAI;aACV;YACD,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,IAAI;YACZ,GAAG,EAAE,IAAI;YACT,KAAK,EAAE,IAAI;YACX,QAAQ;SACT,CACF,CAAC;IACJ,CAAC;CACF;AA7BD,gCA6BC"}
@@ -0,0 +1,5 @@
1
+ import type { RuleContext } from '@typescript-eslint/utils/ts-eslint';
2
+ export declare class PathResolver {
3
+ resolve(context: RuleContext<any, any>, relativeFilePath: string): string;
4
+ }
5
+ //# sourceMappingURL=pathResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathResolver.d.ts","sourceRoot":"","sources":["../../rules/framework/pathResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGtE,qBAAa,YAAY;IAChB,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,gBAAgB,EAAE,MAAM;CAGxE"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PathResolver = void 0;
4
+ const path = require("path");
5
+ class PathResolver {
6
+ resolve(context, relativeFilePath) {
7
+ return path.join(path.dirname(context.getFilename()), `${relativeFilePath}.ts`);
8
+ }
9
+ }
10
+ exports.PathResolver = PathResolver;
11
+ //# sourceMappingURL=pathResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathResolver.js","sourceRoot":"","sources":["../../rules/framework/pathResolver.ts"],"names":[],"mappings":";;;AACA,6BAA+B;AAE/B,MAAa,YAAY;IAChB,OAAO,CAAC,OAA8B,EAAE,gBAAwB;QACrE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,GAAG,gBAAgB,KAAK,CAAC,CAAC;IAClF,CAAC;CACF;AAJD,oCAIC"}
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const { unresolvedProviderDependencies } = require('./unresolvedProviderDependencies');
3
+ const { unresolvedProviderDependenciesGenerator } = require('./unresolvedProviderDependencies');
4
4
  module.exports = {
5
5
  rules: {
6
- 'unresolved-provider-dependencies': unresolvedProviderDependencies,
6
+ 'unresolved-provider-dependencies': unresolvedProviderDependenciesGenerator(),
7
7
  },
8
8
  };
9
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../rules/index.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,8BAA8B,EAAE,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAEvF,MAAM,CAAC,OAAO,GAAG;IACf,KAAK,EAAE;QACL,kCAAkC,EAAE,8BAA8B;KACnE;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../rules/index.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,uCAAuC,EAAE,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAEhG,MAAM,CAAC,OAAO,GAAG;IACf,KAAK,EAAE;QACL,kCAAkC,EAAE,uCAAuC,EAAE;KAC9E;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import type { Context } from './types';
3
+ import { FileReader } from '../framework/fileReader';
4
+ export declare function create(context: Context, fileReader: FileReader): {
5
+ ImportDeclaration(node: TSESTree.ImportDeclaration): void;
6
+ ClassDeclaration(node: TSESTree.ClassDeclaration): void;
7
+ };
8
+ //# sourceMappingURL=createRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRule.d.ts","sourceRoot":"","sources":["../../rules/unresolvedProviderDependencies/createRule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU;4BAMnC,SAAS,iBAAiB;2BAG3B,SAAS,gBAAgB;EAInD"}