@angular-modernizer/plugin-solid 1.2.0 → 2.1.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.
@@ -2,40 +2,49 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SingleResponsibilityRule = void 0;
4
4
  const ts_morph_1 = require("ts-morph");
5
+ /** Angular lifecycle hooks, by exact name; they are not counted as methods. */
6
+ const LIFECYCLE_HOOKS = new Set([
7
+ 'ngOnInit',
8
+ 'ngOnDestroy',
9
+ 'ngOnChanges',
10
+ 'ngDoCheck',
11
+ 'ngAfterViewInit',
12
+ 'ngAfterViewChecked',
13
+ 'ngAfterContentInit',
14
+ 'ngAfterContentChecked',
15
+ ]);
5
16
  /**
6
- * SRP Violation Rule (`solid:srp-single-responsibility-violation`) - detects
7
- * Single Responsibility Principle violations in classes.
17
+ * SRP Violation Rule (`solid:srp-single-responsibility-violation`) - reports
18
+ * classes that are too large.
8
19
  *
9
- * Detection patterns (`violationType` in the metadata):
10
- * - `too-many-methods`: classes with more than 15 callable members. Get/set
11
- * accessors (a pair counts once) and arrow-function / function-expression
12
- * properties count as methods.
13
- * - `mixed-responsibilities`: member names that fall into 3 or more
14
- * responsibility categories. Base classes (abstract, or extended by 3 or
15
- * more classes in the project) with at least 8 public/protected callable
16
- * members are flagged at 2 categories, since every subclass inherits all
17
- * concerns; metadata then carries `isBaseClass`, `isAbstract` and
18
- * `subclassCount`.
19
- * - `single-method-multi-concern`: a method of 20 or more lines whose body
20
- * touches 4 or more categories.
20
+ * One finding per class (`violationType: 'too-many-methods'`, severity
21
+ * warning, at the class) when the class has more than 15 instance methods.
22
+ * Counted: method declarations that are not static, an overloaded method
23
+ * once; not counted: Angular lifecycle hooks (`ngOnInit`, `ngOnDestroy`,
24
+ * `ngOnChanges`, `ngDoCheck`, `ngAfterViewInit`, `ngAfterViewChecked`,
25
+ * `ngAfterContentInit`, `ngAfterContentChecked`), get/set accessors and
26
+ * properties, also function-valued ones and signal fields such as `input()`,
27
+ * `output()`, `model()`, `computed()` and `effect()`.
21
28
  *
22
- * Responsibility categories are matched by keywords: UI, Business, HTTP,
23
- * Data, Event and Lifecycle.
29
+ * Skipped: components (`Component` plus `parser.componentDecorators`; their
30
+ * size is reported by `architecture:component-complexity`) and static-only
31
+ * classes. The rule makes no claim about responsibilities: member names and
32
+ * method bodies are not read.
24
33
  *
25
34
  * @example
26
35
  * ```typescript
27
- * // Violation: class mixes HTTP, business, and UI concerns
28
- * class UserComponent {
29
- * fetchUsers() {} // HTTP concern
30
- * calculateTotal() {} // Business concern
31
- * renderChart() {} // UI concern
36
+ * // Reported: 16 instance methods
37
+ * @Injectable({ providedIn: 'root' })
38
+ * export class UserService {
39
+ * load(): void {}
40
+ * // ... 15 more methods
32
41
  * }
33
42
  * ```
34
43
  */
35
44
  class SingleResponsibilityRule {
36
45
  id = 'solid:srp-single-responsibility-violation';
37
46
  name = 'Single Responsibility Principle Violation';
38
- description = 'Detects classes with too many methods or mixed responsibilities';
47
+ description = 'Detects classes with more than 15 instance methods (lifecycle hooks, accessors and function properties not counted)';
39
48
  severity = 'warning';
40
49
  category = 'solid-violation';
41
50
  tags = [
@@ -45,377 +54,62 @@ class SingleResponsibilityRule {
45
54
  'architecture',
46
55
  'maintainability',
47
56
  ];
48
- /**
49
- * Default threshold for maximum number of methods in a class.
50
- */
57
+ /** Instance methods a class may have before it is reported. */
51
58
  maxMethodsThreshold = 15;
59
+ componentDecorators;
52
60
  /**
53
- * Minimum number of different responsibility categories to flag as mixed.
54
- */
55
- minMixedResponsibilities = 3;
56
- /**
57
- * Minimum number of mixed categories for base classes (abstract or
58
- * subclassed >= `minSubclassesForBase` times) with a large surface.
59
- */
60
- minMixedResponsibilitiesForBase = 2;
61
- /**
62
- * Number of subclasses in the project that make a class a base class.
61
+ * @param options - `componentDecorators`: decorator names that mark a
62
+ * component in addition to `Component` (the plugin passes
63
+ * `parser.componentDecorators`).
63
64
  */
64
- minSubclassesForBase = 3;
65
- /**
66
- * Public/protected callable members a base class needs to be evaluated.
67
- */
68
- baseClassSurfaceThreshold = 8;
69
- /**
70
- * Responsibility categories for method classification.
71
- */
72
- responsibilityCategories = [
73
- {
74
- name: 'UI',
75
- keywords: [
76
- 'render',
77
- 'display',
78
- 'show',
79
- 'hide',
80
- 'toggle',
81
- 'open',
82
- 'close',
83
- 'view',
84
- ],
85
- },
86
- {
87
- name: 'Business',
88
- keywords: [
89
- 'calculate',
90
- 'validate',
91
- 'process',
92
- 'transform',
93
- 'compute',
94
- 'check',
95
- ],
96
- },
97
- {
98
- name: 'HTTP',
99
- keywords: [
100
- 'fetch',
101
- 'get',
102
- 'post',
103
- 'put',
104
- 'delete',
105
- 'request',
106
- 'call',
107
- 'api',
108
- ],
109
- },
110
- {
111
- name: 'Data',
112
- keywords: [
113
- 'save',
114
- 'load',
115
- 'store',
116
- 'retrieve',
117
- 'persist',
118
- 'cache',
119
- 'read',
120
- 'write',
121
- ],
122
- },
123
- {
124
- name: 'Event',
125
- keywords: [
126
- 'emit',
127
- 'dispatch',
128
- 'trigger',
129
- 'fire',
130
- 'notify',
131
- 'publish',
132
- 'subscribe',
133
- ],
134
- },
135
- {
136
- name: 'Lifecycle',
137
- keywords: [
138
- 'init',
139
- 'destroy',
140
- 'cleanup',
141
- 'setup',
142
- 'teardown',
143
- 'start',
144
- 'stop',
145
- ],
146
- },
147
- ];
65
+ constructor(options = {}) {
66
+ this.componentDecorators = new Set([
67
+ 'Component',
68
+ ...(options.componentDecorators ?? []),
69
+ ]);
70
+ }
148
71
  async analyze(context) {
149
- const violations = [];
150
- const sourceFile = context.sourceFile;
151
- // Find all class declarations in the file
152
- const classes = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.ClassDeclaration);
153
- for (const classDecl of classes) {
154
- const classViolations = this.checkClass(classDecl, sourceFile.getFilePath());
155
- violations.push(...classViolations);
156
- }
157
- return Promise.resolve(violations);
72
+ const filePath = context.sourceFile.getFilePath();
73
+ const results = context.sourceFile
74
+ .getDescendantsOfKind(ts_morph_1.SyntaxKind.ClassDeclaration)
75
+ .flatMap((classDecl) => this.checkClass(classDecl, filePath));
76
+ return Promise.resolve(results);
158
77
  }
159
- /**
160
- * Check if a class violates SRP.
161
- */
162
78
  checkClass(classDecl, filePath) {
163
- const violations = [];
164
- try {
165
- const className = classDecl.getName() ?? '<anonymous>';
166
- const methods = classDecl.getMethods();
167
- const members = this.collectCallableMembers(classDecl);
168
- const accessorCount = members.filter((m) => m.kind === 'accessor').length;
169
- const functionPropertyCount = members.filter((m) => m.kind === 'function-property').length;
170
- // Check for too many methods (accessors and function properties count)
171
- if (members.length > this.maxMethodsThreshold) {
172
- const startLine = classDecl.getStartLineNumber();
173
- const startColumn = classDecl.getStart() - classDecl.getStartLinePos();
174
- const breakdown = accessorCount + functionPropertyCount > 0
175
- ? ` (incl. ${accessorCount} accessors, ${functionPropertyCount} function properties)`
176
- : '';
177
- violations.push({
178
- ruleId: this.id,
179
- message: `Class '${className}' has ${members.length} methods${breakdown} (threshold: ${this.maxMethodsThreshold}). Consider splitting into smaller, focused classes.`,
180
- filePath,
181
- line: startLine,
182
- column: startColumn,
183
- suggestedFix: `Refactor '${className}' by extracting related methods into separate classes, each with a single responsibility.`,
184
- metadata: {
185
- className,
186
- methodCount: members.length,
187
- accessorCount,
188
- functionPropertyCount,
189
- threshold: this.maxMethodsThreshold,
190
- violationType: 'too-many-methods',
191
- principle: 'SRP',
192
- },
193
- });
194
- }
195
- // Check for single-method multi-concern (Cat 2)
196
- for (const method of methods) {
197
- const methodViolation = this.analyzeMethodBodyConcerns(method, className, filePath);
198
- if (methodViolation) {
199
- violations.push(methodViolation);
200
- }
201
- }
202
- // Check for mixed responsibilities (base classes use a lower bar)
203
- const responsibilities = this.analyzeResponsibilities(members.map((m) => m.name));
204
- const baseSignal = this.detectBaseClassSignal(classDecl, members);
205
- const minMixed = baseSignal.isBaseClass
206
- ? this.minMixedResponsibilitiesForBase
207
- : this.minMixedResponsibilities;
208
- if (responsibilities.size >= minMixed) {
209
- const startLine = classDecl.getStartLineNumber();
210
- const startColumn = classDecl.getStart() - classDecl.getStartLinePos();
211
- const responsibilityList = Array.from(responsibilities).join(', ');
212
- violations.push({
213
- ruleId: this.id,
214
- message: baseSignal.isBaseClass
215
- ? `Base class '${className}' (${baseSignal.isAbstract ? 'abstract, ' : ''}${baseSignal.subclassCount} subclasses) appears to have mixed responsibilities: ${responsibilityList}. Every subclass inherits these concerns.`
216
- : `Class '${className}' appears to have mixed responsibilities: ${responsibilityList}. Consider separating these concerns.`,
217
- filePath,
218
- line: startLine,
219
- column: startColumn,
220
- suggestedFix: `Extract methods into separate classes based on their responsibilities.`,
221
- metadata: {
222
- className,
223
- responsibilities: Array.from(responsibilities),
224
- violationType: 'mixed-responsibilities',
225
- principle: 'SRP',
226
- isBaseClass: baseSignal.isBaseClass,
227
- isAbstract: baseSignal.isAbstract,
228
- subclassCount: baseSignal.subclassCount,
229
- nonPrivateSurface: baseSignal.nonPrivateSurface,
230
- },
231
- });
232
- }
233
- return violations;
234
- }
235
- catch (_error) {
236
- // If we can't analyze the class, skip it
237
- return violations;
238
- }
239
- }
240
- /**
241
- * Detect a single method that mixes ≥4 distinct concern categories AND is ≥20 lines.
242
- * Scans the full method body text for concern keywords (same categories as class-level).
243
- */
244
- analyzeMethodBodyConcerns(method, className, filePath) {
245
- const methodName = method.getName();
246
- if (!methodName) {
247
- return null;
248
- }
249
- // Skip Angular lifecycle hooks
250
- if (methodName.startsWith('ng')) {
251
- return null;
252
- }
253
- const body = method.getBody();
254
- if (!body) {
255
- return null;
256
- }
257
- // Too short to meaningfully mix concerns
258
- const lineCount = method.getEndLineNumber() - method.getStartLineNumber();
259
- if (lineCount < 20) {
260
- return null;
261
- }
262
- const bodyText = body.getFullText().toLowerCase();
263
- const detectedConcerns = [];
264
- for (const category of this.responsibilityCategories) {
265
- for (const keyword of category.keywords) {
266
- if (bodyText.includes(keyword)) {
267
- if (!detectedConcerns.includes(category.name)) {
268
- detectedConcerns.push(category.name);
269
- }
270
- break;
271
- }
272
- }
273
- }
274
- if (detectedConcerns.length < 4) {
275
- return null;
276
- }
277
- return {
278
- ruleId: this.id,
279
- message: `Method '${methodName}' in '${className}' mixes ${detectedConcerns.length} concerns (${detectedConcerns.join(', ')}) in one body.`,
280
- filePath,
281
- line: method.getStartLineNumber(),
282
- column: method.getStart() - method.getStartLinePos(),
283
- suggestedFix: `Extract each concern into a dedicated private method or service to honour the Single Responsibility Principle.`,
284
- metadata: {
285
- className,
286
- methodName,
287
- concerns: detectedConcerns,
288
- violationType: 'single-method-multi-concern',
289
- principle: 'SRP',
79
+ if (this.isComponent(classDecl)) {
80
+ return [];
81
+ }
82
+ const methodCount = classDecl
83
+ .getMethods()
84
+ .filter((method) => !method.isStatic())
85
+ .filter((method) => !LIFECYCLE_HOOKS.has(method.getName())).length;
86
+ if (methodCount <= this.maxMethodsThreshold) {
87
+ return [];
88
+ }
89
+ const className = classDecl.getName() ?? '<anonymous>';
90
+ return [
91
+ {
92
+ ruleId: this.id,
93
+ severity: 'warning',
94
+ message: `Class '${className}' has ${methodCount} instance methods without lifecycle hooks (threshold: ${this.maxMethodsThreshold}).`,
95
+ filePath,
96
+ line: classDecl.getStartLineNumber(),
97
+ column: classDecl.getStart() - classDecl.getStartLinePos(),
98
+ suggestedFix: `Split '${className}' into smaller classes, each with a focused set of methods.`,
99
+ metadata: {
100
+ className,
101
+ methodCount,
102
+ threshold: this.maxMethodsThreshold,
103
+ violationType: 'too-many-methods',
104
+ principle: 'SRP',
105
+ },
290
106
  },
291
- };
292
- }
293
- /**
294
- * Collects methods, get/set accessors (a get/set pair counts once) and
295
- * properties initialized with arrow functions or function expressions.
296
- */
297
- collectCallableMembers(classDecl) {
298
- const members = [];
299
- const isNonPrivate = (scope, name) => scope !== ts_morph_1.Scope.Private && !name.startsWith('#');
300
- for (const method of classDecl.getMethods()) {
301
- members.push({
302
- name: method.getName(),
303
- kind: 'method',
304
- isNonPrivate: isNonPrivate(method.getScope(), method.getName()),
305
- });
306
- }
307
- const accessorNames = new Set();
308
- const accessors = [
309
- ...classDecl.getGetAccessors(),
310
- ...classDecl.getSetAccessors(),
311
107
  ];
312
- for (const accessor of accessors) {
313
- const name = accessor.getName();
314
- if (accessorNames.has(name)) {
315
- continue;
316
- }
317
- accessorNames.add(name);
318
- members.push({
319
- name,
320
- kind: 'accessor',
321
- isNonPrivate: isNonPrivate(accessor.getScope(), name),
322
- });
323
- }
324
- for (const property of classDecl.getProperties()) {
325
- const initializer = property.getInitializer();
326
- const isFunction = initializer !== undefined &&
327
- (ts_morph_1.Node.isArrowFunction(initializer) ||
328
- ts_morph_1.Node.isFunctionExpression(initializer));
329
- if (!isFunction) {
330
- continue;
331
- }
332
- members.push({
333
- name: property.getName(),
334
- kind: 'function-property',
335
- isNonPrivate: isNonPrivate(property.getScope(), property.getName()),
336
- });
337
- }
338
- return members;
339
108
  }
340
- /**
341
- * Base-class signal: abstract classes, or classes extended by at least
342
- * `minSubclassesForBase` classes in the project, with a public/protected
343
- * callable surface of at least `baseClassSurfaceThreshold` members.
344
- * Subclasses are counted via references to the class name inside
345
- * `extends` heritage clauses (only computed for large surfaces).
346
- */
347
- detectBaseClassSignal(classDecl, members) {
348
- const nonPrivateSurface = members.filter((m) => m.isNonPrivate).length;
349
- const isAbstract = classDecl.isAbstract();
350
- const notBase = {
351
- isBaseClass: false,
352
- isAbstract,
353
- subclassCount: 0,
354
- nonPrivateSurface,
355
- };
356
- if (nonPrivateSurface < this.baseClassSurfaceThreshold) {
357
- return notBase;
358
- }
359
- const subclassCount = this.countSubclasses(classDecl);
360
- const isBaseClass = isAbstract || subclassCount >= this.minSubclassesForBase;
361
- return { isBaseClass, isAbstract, subclassCount, nonPrivateSurface };
362
- }
363
- countSubclasses(classDecl) {
364
- const nameNode = classDecl.getNameNode();
365
- if (!nameNode) {
366
- return 0;
367
- }
368
- try {
369
- const subclasses = new Set();
370
- for (const ref of nameNode.findReferencesAsNodes()) {
371
- const heritage = ref.getFirstAncestorByKind(ts_morph_1.SyntaxKind.HeritageClause);
372
- if (heritage?.getToken() !== ts_morph_1.SyntaxKind.ExtendsKeyword) {
373
- continue;
374
- }
375
- const owner = heritage.getParent();
376
- if (ts_morph_1.Node.isClassDeclaration(owner) || ts_morph_1.Node.isClassExpression(owner)) {
377
- subclasses.add(owner);
378
- }
379
- }
380
- return subclasses.size;
381
- }
382
- catch {
383
- return 0;
384
- }
385
- }
386
- /**
387
- * Analyze the responsibilities of callable members in a class.
388
- * Returns a set of responsibility category names found.
389
- */
390
- analyzeResponsibilities(memberNames) {
391
- const responsibilities = new Set();
392
- for (const methodName of memberNames) {
393
- try {
394
- if (!methodName) {
395
- continue;
396
- }
397
- // Skip Angular lifecycle methods (interface methods)
398
- if (methodName.startsWith('ng')) {
399
- continue;
400
- }
401
- // Convert to lowercase for case-insensitive matching
402
- const lowerName = methodName.toLowerCase();
403
- // Check each responsibility category
404
- for (const category of this.responsibilityCategories) {
405
- for (const keyword of category.keywords) {
406
- if (lowerName.includes(keyword)) {
407
- responsibilities.add(category.name);
408
- break; // Found a match for this category, move to next category
409
- }
410
- }
411
- }
412
- }
413
- catch (_error) {
414
- // Skip methods that can't be analyzed
415
- continue;
416
- }
417
- }
418
- return responsibilities;
109
+ isComponent(classDecl) {
110
+ return classDecl
111
+ .getDecorators()
112
+ .some((decorator) => this.componentDecorators.has(decorator.getName()));
419
113
  }
420
114
  }
421
115
  exports.SingleResponsibilityRule = SingleResponsibilityRule;
@@ -10,12 +10,12 @@ import type { Plugin, AnalysisRule, TransformRule, ValidationRule, IKernel } fro
10
10
  * ## Rules
11
11
  *
12
12
  * ### Analysis Rules
13
- * - {@link DIPViolationRule}: Detects direct service instantiation (DIP violation)
14
- * - {@link ServiceDipViolationRule}: Detects concrete constructor injection instead of interfaces (DIP violation)
15
- * - {@link SingleResponsibilityRule}: Detects classes with too many responsibilities (SRP violation)
16
- * - {@link LSPViolationRule}: Detects inheritance and interface implementation issues (LSP violation)
13
+ * - {@link DIPViolationRule}: `new` of project `@Injectable` classes and `Injector.get()` in class members (DIP violation)
14
+ * - {@link ServiceDipViolationRule}: deprecated, reports nothing
15
+ * - {@link SingleResponsibilityRule}: Detects classes with more than 15 instance methods (SRP violation)
16
+ * - {@link LSPViolationRule}: Deprecated, reports nothing (missing interface members and abstract methods are compile errors)
17
17
  * - {@link OCPViolationRule}: Detects code that violates the Open/Closed Principle (OCP violation)
18
- * - {@link ISPViolationRule}: Detects interface segregation violations (ISP violation)
18
+ * - {@link ISPViolationRule}: Detects interfaces with more than 5 methods (ISP violation)
19
19
  * - {@link GodSwitchAnalysisRule}: Detects large switch statements (God Switch anti-pattern)
20
20
  *
21
21
  * ### Transform Rules
@@ -43,12 +43,17 @@ export declare class SolidPlugin implements Plugin {
43
43
  * Plugin author.
44
44
  */
45
45
  readonly author = "Angular Modernization Platform";
46
+ /** Project component decorators (`parser.componentDecorators`), added to `Component`. */
47
+ private componentDecorators;
46
48
  /**
47
- * Initialize the plugin.
49
+ * Initialize the plugin: reads `parser.componentDecorators` from the
50
+ * project's `.angular-modernizer.json` (no config file: `Component` only).
48
51
  *
49
- * @param _kernel - The Kernel instance for accessing infrastructure
52
+ * @param kernel - The Kernel instance; provides the project root.
53
+ * @throws When `.angular-modernizer.json` is not valid JSON or does not
54
+ * match the schema.
50
55
  */
51
- initialize(_kernel: IKernel): Promise<void>;
56
+ initialize(kernel: IKernel): Promise<void>;
52
57
  /**
53
58
  * Get all analysis rules provided by this plugin.
54
59
  *
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolidPlugin = void 0;
4
+ const core_1 = require("@angular-modernizer/core");
4
5
  const dip_violation_rule_js_1 = require("./rules/dip-violation.rule.js");
5
6
  const srp_violation_rule_js_1 = require("./rules/srp-violation.rule.js");
6
7
  const lsp_violation_rule_js_1 = require("./rules/lsp-violation.rule.js");
@@ -21,12 +22,12 @@ const service_dip_violation_analysis_rule_js_1 = require("./rules/service-dip-vi
21
22
  * ## Rules
22
23
  *
23
24
  * ### Analysis Rules
24
- * - {@link DIPViolationRule}: Detects direct service instantiation (DIP violation)
25
- * - {@link ServiceDipViolationRule}: Detects concrete constructor injection instead of interfaces (DIP violation)
26
- * - {@link SingleResponsibilityRule}: Detects classes with too many responsibilities (SRP violation)
27
- * - {@link LSPViolationRule}: Detects inheritance and interface implementation issues (LSP violation)
25
+ * - {@link DIPViolationRule}: `new` of project `@Injectable` classes and `Injector.get()` in class members (DIP violation)
26
+ * - {@link ServiceDipViolationRule}: deprecated, reports nothing
27
+ * - {@link SingleResponsibilityRule}: Detects classes with more than 15 instance methods (SRP violation)
28
+ * - {@link LSPViolationRule}: Deprecated, reports nothing (missing interface members and abstract methods are compile errors)
28
29
  * - {@link OCPViolationRule}: Detects code that violates the Open/Closed Principle (OCP violation)
29
- * - {@link ISPViolationRule}: Detects interface segregation violations (ISP violation)
30
+ * - {@link ISPViolationRule}: Detects interfaces with more than 5 methods (ISP violation)
30
31
  * - {@link GodSwitchAnalysisRule}: Detects large switch statements (God Switch anti-pattern)
31
32
  *
32
33
  * ### Transform Rules
@@ -54,14 +55,19 @@ class SolidPlugin {
54
55
  * Plugin author.
55
56
  */
56
57
  author = 'Angular Modernization Platform';
58
+ /** Project component decorators (`parser.componentDecorators`), added to `Component`. */
59
+ componentDecorators = [];
57
60
  /**
58
- * Initialize the plugin.
61
+ * Initialize the plugin: reads `parser.componentDecorators` from the
62
+ * project's `.angular-modernizer.json` (no config file: `Component` only).
59
63
  *
60
- * @param _kernel - The Kernel instance for accessing infrastructure
64
+ * @param kernel - The Kernel instance; provides the project root.
65
+ * @throws When `.angular-modernizer.json` is not valid JSON or does not
66
+ * match the schema.
61
67
  */
62
- async initialize(_kernel) {
63
- // No initialization needed for now
64
- // Future: Load configuration, register analyzers, etc.
68
+ async initialize(kernel) {
69
+ const config = new core_1.ConfigLoader().load(kernel.getProjectRoot());
70
+ this.componentDecorators = config.parser?.componentDecorators ?? [];
65
71
  }
66
72
  /**
67
73
  * Get all analysis rules provided by this plugin.
@@ -71,7 +77,7 @@ class SolidPlugin {
71
77
  getAnalysisRules() {
72
78
  return [
73
79
  new dip_violation_rule_js_1.DIPViolationRule(),
74
- new srp_violation_rule_js_1.SingleResponsibilityRule(),
80
+ new srp_violation_rule_js_1.SingleResponsibilityRule({ componentDecorators: this.componentDecorators }),
75
81
  new lsp_violation_rule_js_1.LSPViolationRule(),
76
82
  new ocp_violation_rule_js_1.OCPViolationRule(),
77
83
  new isp_violation_rule_js_1.ISPViolationRule(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-modernizer/plugin-solid",
3
- "version": "1.2.0",
3
+ "version": "2.1.0",
4
4
  "description": "Analysis plugin for detecting SOLID principle violations.",
5
5
  "keywords": [
6
6
  "angular",
@@ -16,14 +16,15 @@
16
16
  "homepage": "https://eiweiss.github.io/angular-modernizer-docs/",
17
17
  "main": "./dist/index.js",
18
18
  "files": [
19
+ "CHANGELOG.md",
19
20
  "dist",
20
21
  "!dist/**/__tests__/**",
21
22
  "!dist/**/*.map"
22
23
  ],
23
24
  "dependencies": {
24
- "@angular-modernizer/core": "1.2.0",
25
- "@angular-modernizer/plugin-system": "1.2.0",
26
- "@angular-modernizer/api": "1.2.0"
25
+ "@angular-modernizer/core": "2.1.0",
26
+ "@angular-modernizer/plugin-system": "2.1.0",
27
+ "@angular-modernizer/api": "2.1.0"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/jest": "^30.0.0",
@@ -57,7 +58,7 @@
57
58
  "test": "jest",
58
59
  "test:watch": "jest --watch",
59
60
  "test:coverage": "jest --coverage",
60
- "lint": "eslint src/**/*.ts",
61
- "lint:fix": "eslint src/**/*.ts --fix"
61
+ "lint": "eslint src __tests__",
62
+ "lint:fix": "eslint src __tests__ --fix"
62
63
  }
63
64
  }