@depup/angular-eslint__eslint-plugin 21.3.1-depup.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 (166) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/changes.json +10 -0
  4. package/dist/configs/README.md +44 -0
  5. package/dist/configs/all.json +54 -0
  6. package/dist/configs/recommended.json +18 -0
  7. package/dist/index.d.ts +233 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +145 -0
  10. package/dist/rules/component-class-suffix.d.ts +15 -0
  11. package/dist/rules/component-class-suffix.d.ts.map +1 -0
  12. package/dist/rules/component-class-suffix.js +56 -0
  13. package/dist/rules/component-max-inline-declarations.d.ts +17 -0
  14. package/dist/rules/component-max-inline-declarations.d.ts.map +1 -0
  15. package/dist/rules/component-max-inline-declarations.js +107 -0
  16. package/dist/rules/component-selector.d.ts +14 -0
  17. package/dist/rules/component-selector.d.ts.map +1 -0
  18. package/dist/rules/component-selector.js +218 -0
  19. package/dist/rules/computed-must-return.d.ts +11 -0
  20. package/dist/rules/computed-must-return.d.ts.map +1 -0
  21. package/dist/rules/computed-must-return.js +62 -0
  22. package/dist/rules/consistent-component-styles.d.ts +12 -0
  23. package/dist/rules/consistent-component-styles.d.ts.map +1 -0
  24. package/dist/rules/consistent-component-styles.js +97 -0
  25. package/dist/rules/contextual-decorator.d.ts +12 -0
  26. package/dist/rules/contextual-decorator.d.ts.map +1 -0
  27. package/dist/rules/contextual-decorator.js +61 -0
  28. package/dist/rules/contextual-lifecycle.d.ts +11 -0
  29. package/dist/rules/contextual-lifecycle.d.ts.map +1 -0
  30. package/dist/rules/contextual-lifecycle.js +61 -0
  31. package/dist/rules/directive-class-suffix.d.ts +13 -0
  32. package/dist/rules/directive-class-suffix.d.ts.map +1 -0
  33. package/dist/rules/directive-class-suffix.js +60 -0
  34. package/dist/rules/directive-selector.d.ts +14 -0
  35. package/dist/rules/directive-selector.d.ts.map +1 -0
  36. package/dist/rules/directive-selector.js +156 -0
  37. package/dist/rules/no-async-lifecycle-method.d.ts +11 -0
  38. package/dist/rules/no-async-lifecycle-method.d.ts.map +1 -0
  39. package/dist/rules/no-async-lifecycle-method.js +45 -0
  40. package/dist/rules/no-attribute-decorator.d.ts +11 -0
  41. package/dist/rules/no-attribute-decorator.d.ts.map +1 -0
  42. package/dist/rules/no-attribute-decorator.js +32 -0
  43. package/dist/rules/no-conflicting-lifecycle.d.ts +11 -0
  44. package/dist/rules/no-conflicting-lifecycle.d.ts.map +1 -0
  45. package/dist/rules/no-conflicting-lifecycle.js +74 -0
  46. package/dist/rules/no-developer-preview.d.ts +11 -0
  47. package/dist/rules/no-developer-preview.d.ts.map +1 -0
  48. package/dist/rules/no-developer-preview.js +45 -0
  49. package/dist/rules/no-duplicates-in-metadata-arrays.d.ts +11 -0
  50. package/dist/rules/no-duplicates-in-metadata-arrays.d.ts.map +1 -0
  51. package/dist/rules/no-duplicates-in-metadata-arrays.js +67 -0
  52. package/dist/rules/no-empty-lifecycle-method.d.ts +11 -0
  53. package/dist/rules/no-empty-lifecycle-method.d.ts.map +1 -0
  54. package/dist/rules/no-empty-lifecycle-method.js +75 -0
  55. package/dist/rules/no-experimental.d.ts +11 -0
  56. package/dist/rules/no-experimental.d.ts.map +1 -0
  57. package/dist/rules/no-experimental.js +45 -0
  58. package/dist/rules/no-forward-ref.d.ts +12 -0
  59. package/dist/rules/no-forward-ref.d.ts.map +1 -0
  60. package/dist/rules/no-forward-ref.js +33 -0
  61. package/dist/rules/no-implicit-take-until-destroyed.d.ts +11 -0
  62. package/dist/rules/no-implicit-take-until-destroyed.d.ts.map +1 -0
  63. package/dist/rules/no-implicit-take-until-destroyed.js +83 -0
  64. package/dist/rules/no-input-prefix.d.ts +13 -0
  65. package/dist/rules/no-input-prefix.d.ts.map +1 -0
  66. package/dist/rules/no-input-prefix.js +118 -0
  67. package/dist/rules/no-input-rename.d.ts +13 -0
  68. package/dist/rules/no-input-rename.d.ts.map +1 -0
  69. package/dist/rules/no-input-rename.js +213 -0
  70. package/dist/rules/no-inputs-metadata-property.d.ts +11 -0
  71. package/dist/rules/no-inputs-metadata-property.d.ts.map +1 -0
  72. package/dist/rules/no-inputs-metadata-property.js +53 -0
  73. package/dist/rules/no-lifecycle-call.d.ts +11 -0
  74. package/dist/rules/no-lifecycle-call.d.ts.map +1 -0
  75. package/dist/rules/no-lifecycle-call.js +49 -0
  76. package/dist/rules/no-output-native.d.ts +11 -0
  77. package/dist/rules/no-output-native.d.ts.map +1 -0
  78. package/dist/rules/no-output-native.js +47 -0
  79. package/dist/rules/no-output-on-prefix.d.ts +11 -0
  80. package/dist/rules/no-output-on-prefix.d.ts.map +1 -0
  81. package/dist/rules/no-output-on-prefix.js +48 -0
  82. package/dist/rules/no-output-rename.d.ts +11 -0
  83. package/dist/rules/no-output-rename.d.ts.map +1 -0
  84. package/dist/rules/no-output-rename.js +172 -0
  85. package/dist/rules/no-outputs-metadata-property.d.ts +11 -0
  86. package/dist/rules/no-outputs-metadata-property.d.ts.map +1 -0
  87. package/dist/rules/no-outputs-metadata-property.js +53 -0
  88. package/dist/rules/no-pipe-impure.d.ts +11 -0
  89. package/dist/rules/no-pipe-impure.d.ts.map +1 -0
  90. package/dist/rules/no-pipe-impure.js +42 -0
  91. package/dist/rules/no-queries-metadata-property.d.ts +11 -0
  92. package/dist/rules/no-queries-metadata-property.d.ts.map +1 -0
  93. package/dist/rules/no-queries-metadata-property.js +38 -0
  94. package/dist/rules/no-uncalled-signals.d.ts +12 -0
  95. package/dist/rules/no-uncalled-signals.d.ts.map +1 -0
  96. package/dist/rules/no-uncalled-signals.js +92 -0
  97. package/dist/rules/pipe-prefix.d.ts +15 -0
  98. package/dist/rules/pipe-prefix.d.ts.map +1 -0
  99. package/dist/rules/pipe-prefix.js +92 -0
  100. package/dist/rules/prefer-host-metadata-property.d.ts +10 -0
  101. package/dist/rules/prefer-host-metadata-property.d.ts.map +1 -0
  102. package/dist/rules/prefer-host-metadata-property.js +40 -0
  103. package/dist/rules/prefer-inject.d.ts +11 -0
  104. package/dist/rules/prefer-inject.d.ts.map +1 -0
  105. package/dist/rules/prefer-inject.js +86 -0
  106. package/dist/rules/prefer-on-push-component-change-detection.d.ts +11 -0
  107. package/dist/rules/prefer-on-push-component-change-detection.d.ts.map +1 -0
  108. package/dist/rules/prefer-on-push-component-change-detection.js +81 -0
  109. package/dist/rules/prefer-output-emitter-ref.d.ts +10 -0
  110. package/dist/rules/prefer-output-emitter-ref.d.ts.map +1 -0
  111. package/dist/rules/prefer-output-emitter-ref.js +30 -0
  112. package/dist/rules/prefer-output-readonly.d.ts +11 -0
  113. package/dist/rules/prefer-output-readonly.d.ts.map +1 -0
  114. package/dist/rules/prefer-output-readonly.js +51 -0
  115. package/dist/rules/prefer-signal-model.d.ts +10 -0
  116. package/dist/rules/prefer-signal-model.d.ts.map +1 -0
  117. package/dist/rules/prefer-signal-model.js +71 -0
  118. package/dist/rules/prefer-signals.d.ts +20 -0
  119. package/dist/rules/prefer-signals.d.ts.map +1 -0
  120. package/dist/rules/prefer-signals.js +174 -0
  121. package/dist/rules/prefer-standalone.d.ts +11 -0
  122. package/dist/rules/prefer-standalone.d.ts.map +1 -0
  123. package/dist/rules/prefer-standalone.js +66 -0
  124. package/dist/rules/relative-url-prefix.d.ts +11 -0
  125. package/dist/rules/relative-url-prefix.d.ts.map +1 -0
  126. package/dist/rules/relative-url-prefix.js +59 -0
  127. package/dist/rules/require-lifecycle-on-prototype.d.ts +11 -0
  128. package/dist/rules/require-lifecycle-on-prototype.d.ts.map +1 -0
  129. package/dist/rules/require-lifecycle-on-prototype.js +72 -0
  130. package/dist/rules/require-localize-metadata.d.ts +17 -0
  131. package/dist/rules/require-localize-metadata.d.ts.map +1 -0
  132. package/dist/rules/require-localize-metadata.js +123 -0
  133. package/dist/rules/runtime-localize.d.ts +11 -0
  134. package/dist/rules/runtime-localize.d.ts.map +1 -0
  135. package/dist/rules/runtime-localize.js +45 -0
  136. package/dist/rules/sort-keys-in-type-decorator.d.ts +16 -0
  137. package/dist/rules/sort-keys-in-type-decorator.d.ts.map +1 -0
  138. package/dist/rules/sort-keys-in-type-decorator.js +191 -0
  139. package/dist/rules/sort-lifecycle-methods.d.ts +11 -0
  140. package/dist/rules/sort-lifecycle-methods.d.ts.map +1 -0
  141. package/dist/rules/sort-lifecycle-methods.js +45 -0
  142. package/dist/rules/use-component-selector.d.ts +11 -0
  143. package/dist/rules/use-component-selector.d.ts.map +1 -0
  144. package/dist/rules/use-component-selector.js +41 -0
  145. package/dist/rules/use-component-view-encapsulation.d.ts +11 -0
  146. package/dist/rules/use-component-view-encapsulation.d.ts.map +1 -0
  147. package/dist/rules/use-component-view-encapsulation.js +49 -0
  148. package/dist/rules/use-injectable-provided-in.d.ts +13 -0
  149. package/dist/rules/use-injectable-provided-in.d.ts.map +1 -0
  150. package/dist/rules/use-injectable-provided-in.js +63 -0
  151. package/dist/rules/use-lifecycle-interface.d.ts +11 -0
  152. package/dist/rules/use-lifecycle-interface.d.ts.map +1 -0
  153. package/dist/rules/use-lifecycle-interface.js +65 -0
  154. package/dist/rules/use-pipe-transform-interface.d.ts +11 -0
  155. package/dist/rules/use-pipe-transform-interface.d.ts.map +1 -0
  156. package/dist/rules/use-pipe-transform-interface.js +49 -0
  157. package/dist/utils/create-eslint-rule.d.ts +8 -0
  158. package/dist/utils/create-eslint-rule.d.ts.map +1 -0
  159. package/dist/utils/create-eslint-rule.js +28 -0
  160. package/dist/utils/jsdoc.d.ts +11 -0
  161. package/dist/utils/jsdoc.d.ts.map +1 -0
  162. package/dist/utils/jsdoc.js +174 -0
  163. package/dist/utils/signals.d.ts +2 -0
  164. package/dist/utils/signals.d.ts.map +1 -0
  165. package/dist/utils/signals.js +10 -0
  166. package/package.json +56 -0
@@ -0,0 +1,11 @@
1
+ export type Options = [];
2
+ export type MessageIds = 'lifecycleMethodsNotSorted';
3
+ export declare const RULE_NAME = "sort-lifecycle-methods";
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"lifecycleMethodsNotSorted", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ export default _default;
8
+ export declare const RULE_DOCS_EXTENSION: {
9
+ rationale: string;
10
+ };
11
+ //# sourceMappingURL=sort-lifecycle-methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-lifecycle-methods.d.ts","sourceRoot":"","sources":["../../src/rules/sort-lifecycle-methods.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACrD,eAAO,MAAM,SAAS,2BAA2B,CAAC;;;;AAElD,wBAyDG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
+ exports.RULE_NAME = 'sort-lifecycle-methods';
7
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
8
+ name: exports.RULE_NAME,
9
+ meta: {
10
+ type: 'problem',
11
+ docs: {
12
+ description: 'Ensures that lifecycle methods are declared in order of execution',
13
+ },
14
+ schema: [],
15
+ messages: {
16
+ lifecycleMethodsNotSorted: `Lifecycle Methods are not declared in order of execution`,
17
+ },
18
+ },
19
+ defaultOptions: [],
20
+ create(context) {
21
+ const isBefore = (method1, method2) => {
22
+ const methodIndex1 = utils_1.ASTUtils.angularLifecycleMethodsOrdered.indexOf(utils_1.ASTUtils.getMethodName(method1));
23
+ const methodIndex2 = utils_1.ASTUtils.angularLifecycleMethodsOrdered.indexOf(utils_1.ASTUtils.getMethodName(method2));
24
+ return methodIndex1 < methodIndex2;
25
+ };
26
+ return {
27
+ [utils_1.Selectors.COMPONENT_CLASS_DECORATOR](node) {
28
+ const declaredMethods = utils_1.ASTUtils.getDeclaredMethods(node.parent);
29
+ const declaredLifeCycleMethods = declaredMethods.filter((method) => utils_1.ASTUtils.isAngularLifecycleMethod(utils_1.ASTUtils.getMethodName(method) ?? ''));
30
+ for (let i = 1; i < declaredLifeCycleMethods.length; ++i) {
31
+ const before = isBefore(declaredLifeCycleMethods[i], declaredLifeCycleMethods[i - 1]);
32
+ if (before) {
33
+ context.report({
34
+ node: declaredLifeCycleMethods[i].key,
35
+ messageId: 'lifecycleMethodsNotSorted',
36
+ });
37
+ }
38
+ }
39
+ },
40
+ };
41
+ },
42
+ });
43
+ exports.RULE_DOCS_EXTENSION = {
44
+ rationale: "Organizing lifecycle methods in the order they execute (ngOnChanges, ngOnInit, ngDoCheck, ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy) makes the component lifecycle easier to understand and follow. When methods appear in execution order, developers can mentally trace the component's lifecycle from initialization through destruction just by reading down the file. This natural ordering helps both when writing new code (you know where to add lifecycle logic) and when debugging (you can follow the execution path visually). Randomly ordered lifecycle methods force developers to jump around the file and mentally reconstruct the execution sequence. Consistent ordering is a simple organizational principle that significantly improves code readability.",
45
+ };
@@ -0,0 +1,11 @@
1
+ export type Options = [];
2
+ export type MessageIds = 'useComponentSelector';
3
+ export declare const RULE_NAME = "use-component-selector";
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"useComponentSelector", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ export default _default;
8
+ export declare const RULE_DOCS_EXTENSION: {
9
+ rationale: string;
10
+ };
11
+ //# sourceMappingURL=use-component-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-component-selector.d.ts","sourceRoot":"","sources":["../../src/rules/use-component-selector.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAChD,eAAO,MAAM,SAAS,2BAA2B,CAAC;;;;AAElD,wBAkCG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const utils_2 = require("@typescript-eslint/utils");
6
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
7
+ exports.RULE_NAME = 'use-component-selector';
8
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
9
+ name: exports.RULE_NAME,
10
+ meta: {
11
+ type: 'suggestion',
12
+ docs: {
13
+ description: 'Component selector must be declared',
14
+ },
15
+ schema: [],
16
+ messages: {
17
+ useComponentSelector: 'The selector of the component is mandatory',
18
+ },
19
+ },
20
+ defaultOptions: [],
21
+ create(context) {
22
+ return {
23
+ [utils_1.Selectors.COMPONENT_CLASS_DECORATOR](node) {
24
+ const selector = utils_1.ASTUtils.getDecoratorPropertyValue(node, 'selector');
25
+ if (selector &&
26
+ ((utils_1.ASTUtils.isStringLiteral(selector) && selector.value.length) ||
27
+ utils_1.ASTUtils.isTemplateLiteral(selector) ||
28
+ utils_2.ASTUtils.isIdentifier(selector))) {
29
+ return;
30
+ }
31
+ context.report({
32
+ node,
33
+ messageId: 'useComponentSelector',
34
+ });
35
+ },
36
+ };
37
+ },
38
+ });
39
+ exports.RULE_DOCS_EXTENSION = {
40
+ rationale: "Every component should have a selector that defines how it's used in templates. Omitting the selector makes the component unusable in templates and can only be used with dynamic component loading or routing, which is rarely the intent. When debugging, components without selectors are harder to identify in the component tree and browser DevTools. If a component is truly only meant for dynamic loading (like a modal or route component), you can disable this rule for that component, but in most cases, every component should have a meaningful selector.",
41
+ };
@@ -0,0 +1,11 @@
1
+ export type Options = [];
2
+ export type MessageIds = 'useComponentViewEncapsulation' | 'suggestRemoveViewEncapsulationNone';
3
+ export declare const RULE_NAME = "use-component-view-encapsulation";
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ export default _default;
8
+ export declare const RULE_DOCS_EXTENSION: {
9
+ rationale: string;
10
+ };
11
+ //# sourceMappingURL=use-component-view-encapsulation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-component-view-encapsulation.d.ts","sourceRoot":"","sources":["../../src/rules/use-component-view-encapsulation.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAClB,+BAA+B,GAC/B,oCAAoC,CAAC;AACzC,eAAO,MAAM,SAAS,qCAAqC,CAAC;;;;AAG5D,wBAwDG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
+ exports.RULE_NAME = 'use-component-view-encapsulation';
7
+ const VIEW_ENCAPSULATION_NONE = 'ViewEncapsulation.None';
8
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
9
+ name: exports.RULE_NAME,
10
+ meta: {
11
+ type: 'suggestion',
12
+ docs: {
13
+ description: `Disallows using \`${VIEW_ENCAPSULATION_NONE}\``,
14
+ },
15
+ hasSuggestions: true,
16
+ schema: [],
17
+ messages: {
18
+ useComponentViewEncapsulation: `Using \`${VIEW_ENCAPSULATION_NONE}\` makes your styles global, which may have an unintended effect`,
19
+ suggestRemoveViewEncapsulationNone: `Remove \`${VIEW_ENCAPSULATION_NONE}\``,
20
+ },
21
+ },
22
+ defaultOptions: [],
23
+ create(context) {
24
+ const sourceCode = context.sourceCode;
25
+ return {
26
+ [`${utils_1.Selectors.COMPONENT_CLASS_DECORATOR} ${utils_1.Selectors.metadataProperty('encapsulation')} > MemberExpression[object.name='ViewEncapsulation'] > Identifier[name='None']`](node) {
27
+ context.report({
28
+ node,
29
+ messageId: 'useComponentViewEncapsulation',
30
+ suggest: [
31
+ {
32
+ messageId: 'suggestRemoveViewEncapsulationNone',
33
+ fix: (fixer) => {
34
+ const importDeclarations = utils_1.ASTUtils.getImportDeclarations(node, '@angular/core') ?? [];
35
+ return [
36
+ utils_1.RuleFixes.getNodeToCommaRemoveFix(sourceCode, node.parent.parent, fixer),
37
+ utils_1.RuleFixes.getImportRemoveFix(sourceCode, importDeclarations, 'ViewEncapsulation', fixer),
38
+ ].filter(utils_1.isNotNullOrUndefined);
39
+ },
40
+ },
41
+ ],
42
+ });
43
+ },
44
+ };
45
+ },
46
+ });
47
+ exports.RULE_DOCS_EXTENSION = {
48
+ rationale: "Setting encapsulation to ViewEncapsulation.None disables Angular's view encapsulation, making the component's styles global and affecting the entire application. This breaks component isolation and can cause unexpected styling conflicts throughout your app. When multiple components use ViewEncapsulation.None, their styles can interfere with each other in unpredictable ways, making it extremely difficult to reason about styling. A style intended for one component might accidentally affect completely unrelated components. This defeats one of Angular's key benefits: component style isolation. ViewEncapsulation.None is occasionally necessary for specific edge cases (like styling dynamically inserted content), but it should be avoided in normal component development. Use the default Emulated encapsulation, or ShadowDom for native Shadow DOM, to keep component styles properly isolated.",
49
+ };
@@ -0,0 +1,13 @@
1
+ export type Options = [{
2
+ readonly ignoreClassNamePattern?: string;
3
+ }];
4
+ export type MessageIds = 'useInjectableProvidedIn' | 'suggestInjector';
5
+ export declare const RULE_NAME = "use-injectable-provided-in";
6
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
7
+ name: string;
8
+ };
9
+ export default _default;
10
+ export declare const RULE_DOCS_EXTENSION: {
11
+ rationale: string;
12
+ };
13
+ //# sourceMappingURL=use-injectable-provided-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-injectable-provided-in.d.ts","sourceRoot":"","sources":["../../src/rules/use-injectable-provided-in.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,CAAC;IAAE,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACrE,MAAM,MAAM,UAAU,GAAG,yBAAyB,GAAG,iBAAiB,CAAC;AACvE,eAAO,MAAM,SAAS,+BAA+B,CAAC;;;;AAGtD,wBA2DG;AAEH,eAAO,MAAM,mBAAmB;;CAE/B,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
+ exports.RULE_NAME = 'use-injectable-provided-in';
7
+ const METADATA_PROPERTY_NAME = 'providedIn';
8
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
9
+ name: exports.RULE_NAME,
10
+ meta: {
11
+ type: 'suggestion',
12
+ docs: {
13
+ description: `Using the \`${METADATA_PROPERTY_NAME}\` property makes \`Injectables\` tree-shakable`,
14
+ },
15
+ hasSuggestions: true,
16
+ schema: [
17
+ {
18
+ type: 'object',
19
+ properties: {
20
+ ignoreClassNamePattern: {
21
+ type: 'string',
22
+ },
23
+ },
24
+ additionalProperties: false,
25
+ },
26
+ ],
27
+ messages: {
28
+ useInjectableProvidedIn: `The \`${METADATA_PROPERTY_NAME}\` property is mandatory for \`Injectables\``,
29
+ suggestInjector: `Use \`${METADATA_PROPERTY_NAME}: '{{injector}}'\``,
30
+ },
31
+ },
32
+ defaultOptions: [{}],
33
+ create(context, [{ ignoreClassNamePattern }]) {
34
+ const injectableClassDecorator = `ClassDeclaration:not([id.name=${ignoreClassNamePattern}]):not(:has(TSClassImplements:matches([expression.property.name='HttpInterceptor'], [expression.name='HttpInterceptor']))) > Decorator[expression.callee.name="Injectable"]`;
35
+ const providedInMetadataProperty = utils_1.Selectors.metadataProperty(METADATA_PROPERTY_NAME);
36
+ const withoutProvidedInDecorator = `${injectableClassDecorator}:matches([expression.arguments.length=0], [expression.arguments.0.type='ObjectExpression']:not(:has(${providedInMetadataProperty})))`;
37
+ const nullableProvidedInProperty = `${injectableClassDecorator} ${providedInMetadataProperty}:matches([value.type='Identifier'][value.name='undefined'], [value.type='Literal'][value.raw='null'])`;
38
+ const selectors = [
39
+ withoutProvidedInDecorator,
40
+ nullableProvidedInProperty,
41
+ ].join(',');
42
+ return {
43
+ [selectors](node) {
44
+ context.report({
45
+ node: utils_1.ASTUtils.isProperty(node) ? node.value : node,
46
+ messageId: 'useInjectableProvidedIn',
47
+ suggest: ['any', 'platform', 'root'].map((injector) => ({
48
+ messageId: 'suggestInjector',
49
+ fix: (fixer) => {
50
+ return utils_1.ASTUtils.isProperty(node)
51
+ ? fixer.replaceText(node.value, `'${injector}'`)
52
+ : (utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${METADATA_PROPERTY_NAME}: '${injector}'`) ?? []);
53
+ },
54
+ data: { injector },
55
+ })),
56
+ });
57
+ },
58
+ };
59
+ },
60
+ });
61
+ exports.RULE_DOCS_EXTENSION = {
62
+ rationale: `Using 'providedIn' in the @Injectable() decorator (like '@Injectable({ providedIn: "root" })') enables tree-shaking, which means Angular can remove the service from your production bundle if it's never actually used. Without 'providedIn', services must be registered in a module's providers array, and Angular must include them in the bundle even if they're unused. This can significantly increase bundle size. Additionally, 'providedIn' makes services easier to use (no need to add them to module providers) and makes circular dependencies less likely. The 'providedIn' syntax is the modern, recommended way to provide services.`,
63
+ };
@@ -0,0 +1,11 @@
1
+ export type Options = [];
2
+ export type MessageIds = 'useLifecycleInterface';
3
+ export declare const RULE_NAME = "use-lifecycle-interface";
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"useLifecycleInterface", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ export default _default;
8
+ export declare const RULE_DOCS_EXTENSION: {
9
+ rationale: string;
10
+ };
11
+ //# sourceMappingURL=use-lifecycle-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-lifecycle-interface.d.ts","sourceRoot":"","sources":["../../src/rules/use-lifecycle-interface.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC;AACjD,eAAO,MAAM,SAAS,4BAA4B,CAAC;;;;AAInD,wBAyEG;AAEH,eAAO,MAAM,mBAAmB;;CAE/B,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
+ exports.RULE_NAME = 'use-lifecycle-interface';
7
+ const STYLE_GUIDE_LINK = 'https://angular.dev/style-guide#use-lifecycle-hook-interfaces';
8
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
9
+ name: exports.RULE_NAME,
10
+ meta: {
11
+ type: 'suggestion',
12
+ docs: {
13
+ description: `Ensures that classes implement lifecycle interfaces corresponding to the declared lifecycle methods. See more at ${STYLE_GUIDE_LINK}`,
14
+ },
15
+ schema: [],
16
+ messages: {
17
+ useLifecycleInterface: `Lifecycle interface '{{interfaceName}}' should be implemented for method '{{methodName}}'. (${STYLE_GUIDE_LINK})`,
18
+ },
19
+ fixable: 'code',
20
+ },
21
+ defaultOptions: [],
22
+ create(context) {
23
+ const angularLifecycleMethodsPattern = (0, utils_1.toPattern)([
24
+ ...utils_1.ASTUtils.ANGULAR_LIFECYCLE_METHODS,
25
+ ]);
26
+ return {
27
+ [`MethodDefinition[key.name=${angularLifecycleMethodsPattern}]`](node) {
28
+ const { key, parent: { parent }, } = node;
29
+ if (!utils_1.ASTUtils.getAngularClassDecorator(parent))
30
+ return;
31
+ // Do not report the method if it has the override keyword because it implies the base class is responsible for the implementation
32
+ if (node.override) {
33
+ return;
34
+ }
35
+ const declaredLifecycleInterfaces = utils_1.ASTUtils.getDeclaredAngularLifecycleInterfaces(parent);
36
+ const methodName = key
37
+ .name;
38
+ const interfaceName = utils_1.ASTUtils.getLifecycleInterfaceByMethodName(methodName);
39
+ const isMethodImplemented = declaredLifecycleInterfaces.includes(utils_1.ASTUtils.AngularLifecycleInterfaces[interfaceName]);
40
+ if (isMethodImplemented)
41
+ return;
42
+ context.report({
43
+ node: key,
44
+ messageId: 'useLifecycleInterface',
45
+ data: { interfaceName, methodName },
46
+ fix: (fixer) => {
47
+ const { implementsNodeReplace, implementsTextReplace } = utils_1.RuleFixes.getImplementsSchemaFixer(parent, interfaceName);
48
+ return [
49
+ utils_1.RuleFixes.getImportAddFix({
50
+ fixer,
51
+ importName: interfaceName,
52
+ moduleName: '@angular/core',
53
+ node: parent,
54
+ }),
55
+ fixer.insertTextAfter(implementsNodeReplace, implementsTextReplace),
56
+ ].filter(utils_1.isNotNullOrUndefined);
57
+ },
58
+ });
59
+ },
60
+ };
61
+ },
62
+ });
63
+ exports.RULE_DOCS_EXTENSION = {
64
+ rationale: `Implementing lifecycle interfaces (like OnInit, OnDestroy, AfterViewInit) provides TypeScript compile-time checking to ensure you've spelled the lifecycle method names correctly and used the right method signatures. For example, if you typo 'ngOnInit' as 'ngOninit', TypeScript will catch this error if your class implements OnInit. The interfaces also serve as self-documentation, making it immediately clear which lifecycle hooks a component uses. While Angular will still call correctly-named lifecycle methods even without the interface, using the interface leverages TypeScript's type safety to catch errors earlier in development.`,
65
+ };
@@ -0,0 +1,11 @@
1
+ export type Options = [];
2
+ export type MessageIds = 'usePipeTransformInterface';
3
+ export declare const RULE_NAME = "use-pipe-transform-interface";
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"usePipeTransformInterface", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ export default _default;
8
+ export declare const RULE_DOCS_EXTENSION: {
9
+ rationale: string;
10
+ };
11
+ //# sourceMappingURL=use-pipe-transform-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pipe-transform-interface.d.ts","sourceRoot":"","sources":["../../src/rules/use-pipe-transform-interface.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACrD,eAAO,MAAM,SAAS,iCAAiC,CAAC;;;;AAGxD,wBAgDG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
+ exports.RULE_NAME = 'use-pipe-transform-interface';
7
+ const PIPE_TRANSFORM = 'PipeTransform';
8
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
9
+ name: exports.RULE_NAME,
10
+ meta: {
11
+ type: 'suggestion',
12
+ docs: {
13
+ description: `Ensures that \`Pipes\` implement \`${PIPE_TRANSFORM}\` interface`,
14
+ recommended: 'recommended',
15
+ },
16
+ fixable: 'code',
17
+ schema: [],
18
+ messages: {
19
+ usePipeTransformInterface: `Pipes should implement \`${PIPE_TRANSFORM}\` interface`,
20
+ },
21
+ },
22
+ defaultOptions: [],
23
+ create(context) {
24
+ return {
25
+ [`ClassDeclaration:not(:has(TSClassImplements:matches([expression.name='${PIPE_TRANSFORM}'], [expression.property.name='${PIPE_TRANSFORM}']))) > Decorator[expression.callee.name='Pipe']`]({ parent: classDeclaration, }) {
26
+ context.report({
27
+ node: classDeclaration.id ?? classDeclaration,
28
+ messageId: 'usePipeTransformInterface',
29
+ fix: (fixer) => {
30
+ const { implementsNodeReplace, implementsTextReplace } = utils_1.RuleFixes.getImplementsSchemaFixer(classDeclaration, PIPE_TRANSFORM);
31
+ return [
32
+ utils_1.RuleFixes.getImportAddFix({
33
+ compatibleWithTypeOnlyImport: true,
34
+ fixer,
35
+ importName: PIPE_TRANSFORM,
36
+ moduleName: '@angular/core',
37
+ node: classDeclaration,
38
+ }),
39
+ fixer.insertTextAfter(implementsNodeReplace, implementsTextReplace),
40
+ ].filter(utils_1.isNotNullOrUndefined);
41
+ },
42
+ });
43
+ },
44
+ };
45
+ },
46
+ });
47
+ exports.RULE_DOCS_EXTENSION = {
48
+ rationale: "Implementing the PipeTransform interface provides TypeScript compile-time checking to ensure your pipe has the correct transform() method signature. Without the interface, typos in the method name or incorrect parameters won't be caught until runtime. The interface also serves as self-documentation and enables better IDE support like autocomplete and inline documentation. While Angular requires pipes to have a transform() method, using the PipeTransform interface leverages TypeScript's type system to catch implementation errors during development rather than at runtime.",
49
+ };
@@ -0,0 +1,8 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export interface RuleDocs {
3
+ recommended?: string;
4
+ }
5
+ export declare const createESLintRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, RuleDocs>>) => ESLintUtils.RuleModule<MessageIds, Options, RuleDocs, ESLintUtils.RuleListener> & {
6
+ name: string;
7
+ };
8
+ //# sourceMappingURL=create-eslint-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-eslint-rule.d.ts","sourceRoot":"","sources":["../../src/utils/create-eslint-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiCD,eAAO,MAAM,gBAAgB;;CAG5B,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createESLintRule = void 0;
4
+ const utils_1 = require("@typescript-eslint/utils");
5
+ /**
6
+ * We need to patch the RuleCreator in order to preserve the defaultOptions
7
+ * to use as part of documentation generation.
8
+ */
9
+ const patchedRuleCreator = (urlCreator) => {
10
+ return function createRule({ name, meta, defaultOptions, create }) {
11
+ const resolvedDefaultOptions = (defaultOptions ?? []);
12
+ return {
13
+ name,
14
+ meta: Object.assign(Object.assign({}, meta), {
15
+ docs: Object.assign(Object.assign({}, meta.docs), {
16
+ url: urlCreator(name),
17
+ }),
18
+ }),
19
+ defaultOptions: resolvedDefaultOptions,
20
+ create(context) {
21
+ const optionsWithDefault = utils_1.ESLintUtils.applyDefault(resolvedDefaultOptions, context.options);
22
+ return create(context, optionsWithDefault);
23
+ },
24
+ };
25
+ };
26
+ };
27
+ patchedRuleCreator.withoutDocs = utils_1.ESLintUtils.RuleCreator.withoutDocs;
28
+ exports.createESLintRule = patchedRuleCreator((ruleName) => `https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/${ruleName}.md`);
@@ -0,0 +1,11 @@
1
+ import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/utils';
2
+ import ts from 'typescript';
3
+ export type CallLikeNode = TSESTree.CallExpression | TSESTree.NewExpression | TSESTree.TaggedTemplateExpression;
4
+ export declare function getCallLikeNode(node: TSESTree.Node): CallLikeNode | undefined;
5
+ export declare function getSymbols(node: TSESTree.Identifier, services: ParserServicesWithTypeInformation, checker: ts.TypeChecker): (ts.Symbol | undefined)[];
6
+ export declare function isNodeCalleeOfParent(node: TSESTree.Node): node is CallLikeNode;
7
+ export declare function hasJsDocTag(symbols: (ts.Symbol | undefined)[], tagName: string): boolean;
8
+ export declare function getCallLikeNodeSymbol(node: CallLikeNode, services: ParserServicesWithTypeInformation, checker: ts.TypeChecker): ts.Symbol | undefined;
9
+ export declare function isDeclaration(node: TSESTree.Identifier): boolean;
10
+ export declare function isInsideExportOrImport(node: TSESTree.Node): boolean;
11
+ //# sourceMappingURL=jsdoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsdoc.d.ts","sourceRoot":"","sources":["../../src/utils/jsdoc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,MAAM,MAAM,YAAY,GACpB,QAAQ,CAAC,cAAc,GACvB,QAAQ,CAAC,aAAa,GACtB,QAAQ,CAAC,wBAAwB,CAAC;AAEtC,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,YAAY,GAAG,SAAS,CAW7E;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,QAAQ,CAAC,UAAU,EACzB,QAAQ,EAAE,iCAAiC,EAC3C,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAqB3B;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAClB,IAAI,IAAI,YAAY,CAYtB;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAIT;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,iCAAiC,EAC3C,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,EAAE,CAAC,MAAM,GAAG,SAAS,CAMvB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,OAAO,CA2ChE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,OAAO,CAuBnE"}