@ethlete/eslint-plugin 0.1.0-next.0 → 0.1.0-next.2

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 (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +3 -4
  3. package/src/configs/recommended.js +380 -0
  4. package/src/index.js +126 -0
  5. package/src/rules/angular-decorator-property-order.js +205 -0
  6. package/src/rules/enforce-routing-view-naming.js +84 -0
  7. package/src/rules/guard-return-newline.js +81 -0
  8. package/src/rules/inject-member-accessibility.js +304 -0
  9. package/src/rules/no-angular-router-api.js +158 -0
  10. package/src/rules/no-angular-seo-services.js +82 -0
  11. package/src/rules/no-direct-dom-manipulation.js +160 -0
  12. package/src/rules/no-document-cookie.js +55 -0
  13. package/src/rules/no-dom-query.js +81 -0
  14. package/src/rules/no-empty-angular-metadata-arrays.js +104 -0
  15. package/src/rules/no-empty-newlines-between-imports.js +45 -0
  16. package/src/rules/no-inject-chain.js +44 -0
  17. package/src/rules/no-leading-underscore-class-member.js +120 -0
  18. package/src/rules/no-legacy-angular-decorators.js +405 -0
  19. package/src/rules/no-locale-id.js +57 -0
  20. package/src/rules/no-member-alias.js +151 -0
  21. package/src/rules/no-native-observers.js +102 -0
  22. package/src/rules/no-pipe-logic.js +76 -0
  23. package/src/rules/no-public-property.js +50 -0
  24. package/src/rules/no-readonly-signal.js +119 -0
  25. package/src/rules/no-rxjs-in-effect.js +88 -0
  26. package/src/rules/no-screaming-case-local.js +113 -0
  27. package/src/rules/no-standalone-flag.js +95 -0
  28. package/src/rules/no-subscribe-in-pipe.js +89 -0
  29. package/src/rules/no-subscribe-with-body.js +95 -0
  30. package/src/rules/no-trivial-return-type.js +104 -0
  31. package/src/rules/no-trivial-wrapper-method.js +120 -0
  32. package/src/rules/no-type-only-import.js +79 -0
  33. package/src/rules/no-unused-class-member.js +209 -0
  34. package/src/rules/no-window-location.js +109 -0
  35. package/src/rules/prefer-clone-equal.js +112 -0
  36. package/src/rules/prefer-concise-angular-host-directives.js +225 -0
  37. package/src/rules/prefer-concise-angular-style-metadata.js +108 -0
  38. package/src/rules/prefer-element-dimensions.js +128 -0
  39. package/src/rules/prefer-linked-signal.js +124 -0
  40. package/src/rules/prefer-match-media.js +101 -0
  41. package/src/rules/prefer-rxjs-timer.js +82 -0
  42. package/src/rules/prefer-scroll-state.js +158 -0
  43. package/src/rules/prefer-viewport-size.js +75 -0
  44. package/src/rules/require-dollar-suffix.js +123 -0
  45. package/src/rules/require-on-push-change-detection.js +271 -0
  46. package/src/rules/require-view-encapsulation-none.js +264 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2957](https://github.com/ethlete-io/ethdk/pull/2957) [`81173d4`](https://github.com/ethlete-io/ethdk/commit/81173d426d1a53ea2a7af0d16d6eb0fe4a16dbd9) Thanks [@github-actions](https://github.com/apps/github-actions)! - Add missing auto fixers
8
+
9
+ ## 0.1.0-next.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`6ec51b4`](https://github.com/ethlete-io/ethdk/commit/6ec51b49497ba53bf34ec0aabcf519957ba0e412) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix plugin not including js files
14
+
3
15
  ## 0.1.0-next.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/eslint-plugin",
3
- "version": "0.1.0-next.0",
3
+ "version": "0.1.0-next.2",
4
4
  "license": "MIT",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -9,6 +9,5 @@
9
9
  "@typescript-eslint/eslint-plugin": ">=8.0.0",
10
10
  "eslint": ">=9.0.0",
11
11
  "tslib": "2.8.1"
12
- },
13
- "types": "./src/index.d.ts"
14
- }
12
+ }
13
+ }
@@ -0,0 +1,380 @@
1
+ // @ts-check
2
+ 'use strict';
3
+
4
+ /**
5
+ * Flat config entries for TypeScript files.
6
+ * Covers all lintable rules from the Ethlete styleguide.
7
+ *
8
+ * @type {import('eslint').Linter.Config}
9
+ */
10
+ const recommendedTs = {
11
+ files: ['**/*.ts'],
12
+ plugins: {
13
+ // The plugin itself is injected by the caller (see index.js)
14
+ },
15
+ rules: {
16
+ // ── TypeScript ──────────────────────────────────────────────────────────
17
+
18
+ // No interface — use type
19
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
20
+
21
+ // No any
22
+ '@typescript-eslint/no-explicit-any': 'error',
23
+
24
+ // No declared-but-never-read variables, parameters, or imports
25
+ // Args prefixed with _ are exempt (intentionally unused callback params)
26
+ 'no-unused-vars': 'off', // disabled in favour of the TS-aware version below
27
+ '@typescript-eslint/no-unused-vars': [
28
+ 'error',
29
+ {
30
+ vars: 'all',
31
+ args: 'all',
32
+ argsIgnorePattern: '^_',
33
+ caughtErrors: 'all',
34
+ caughtErrorsIgnorePattern: '^_',
35
+ ignoreRestSiblings: true,
36
+ },
37
+ ],
38
+
39
+ // ── Naming & formatting ─────────────────────────────────────────────────
40
+
41
+ // No var
42
+ 'no-var': 'error',
43
+
44
+ // No unnecessary let — default to const
45
+ 'prefer-const': 'error',
46
+
47
+ // Never declare multiple variables in one statement
48
+ 'one-var': ['error', 'never'],
49
+
50
+ // Always === / !==
51
+ eqeqeq: ['error', 'always'],
52
+
53
+ // Max two function parameters
54
+ 'max-params': ['error', 2],
55
+
56
+ // No _ or # prefixes; enforce camelCase / PascalCase / UPPER_CASE
57
+ '@typescript-eslint/naming-convention': [
58
+ 'error',
59
+ {
60
+ selector: 'default',
61
+ leadingUnderscore: 'forbid',
62
+ trailingUnderscore: 'forbid',
63
+ format: null,
64
+ },
65
+ // Allow any format for object literal properties that require quotes
66
+ // (e.g. Angular host binding keys: '[class.foo]', '(click)', '[attr.aria-label]')
67
+ {
68
+ selector: 'objectLiteralProperty',
69
+ modifiers: ['requiresQuotes'],
70
+ format: null,
71
+ },
72
+ {
73
+ selector: ['variable', 'parameter', 'property', 'parameterProperty', 'accessor'],
74
+ leadingUnderscore: 'allow',
75
+ trailingUnderscore: 'forbid',
76
+ format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
77
+ },
78
+ {
79
+ selector: 'method',
80
+ leadingUnderscore: 'allow',
81
+ trailingUnderscore: 'forbid',
82
+ format: null,
83
+ },
84
+ {
85
+ selector: 'typeLike',
86
+ leadingUnderscore: 'forbid',
87
+ trailingUnderscore: 'forbid',
88
+ format: ['PascalCase'],
89
+ },
90
+ // Generic type parameters must be T-prefixed: TValue, TResult — never bare T
91
+ {
92
+ selector: 'typeParameter',
93
+ leadingUnderscore: 'forbid',
94
+ trailingUnderscore: 'forbid',
95
+ prefix: ['T'],
96
+ format: ['PascalCase'],
97
+ },
98
+ {
99
+ selector: 'enumMember',
100
+ leadingUnderscore: 'forbid',
101
+ trailingUnderscore: 'forbid',
102
+ format: ['UPPER_CASE', 'PascalCase'],
103
+ },
104
+ ],
105
+
106
+ // ── Banned syntax ───────────────────────────────────────────────────────
107
+
108
+ 'no-restricted-syntax': [
109
+ 'error',
110
+ // No enum — use const object + derived union type
111
+ {
112
+ selector: 'TSEnumDeclaration',
113
+ message: 'No enums. Use a const object + derived union type instead.',
114
+ },
115
+ // No standalone function declarations / expressions — use arrow functions
116
+ {
117
+ selector: 'FunctionDeclaration',
118
+ message: 'No function declarations. Use arrow functions instead.',
119
+ },
120
+ {
121
+ selector: "FunctionExpression:not([parent.type='Property']):not([parent.type='MethodDefinition'])",
122
+ message: 'No function expressions outside of object methods or class methods. Use arrow functions.',
123
+ },
124
+ // No arrow properties in classes — use regular methods
125
+ {
126
+ selector: 'PropertyDefinition > ArrowFunctionExpression',
127
+ message: 'No arrow function properties in classes. Use regular methods.',
128
+ },
129
+ // No async/await — use RxJS
130
+ {
131
+ selector: 'FunctionDeclaration[async=true]',
132
+ message: 'No async/await. Use RxJS for all async operations.',
133
+ },
134
+ {
135
+ selector: 'ArrowFunctionExpression[async=true]',
136
+ message: 'No async/await. Use RxJS for all async operations.',
137
+ },
138
+ {
139
+ selector: 'FunctionExpression[async=true]',
140
+ message: 'No async/await. Use RxJS for all async operations.',
141
+ },
142
+ // No public keyword on class members
143
+ {
144
+ selector: "MethodDefinition[accessibility='public']",
145
+ message: 'No public keyword on class members.',
146
+ },
147
+ // No static class members
148
+ {
149
+ selector: 'MethodDefinition[static=true]',
150
+ message: 'No static class members.',
151
+ },
152
+ {
153
+ selector: 'PropertyDefinition[static=true]',
154
+ message: 'No static class members.',
155
+ },
156
+ // No # prefix — use private keyword
157
+ {
158
+ selector: "PropertyDefinition[key.type='PrivateIdentifier']",
159
+ message: 'No # prefix on class members. Use the private keyword instead.',
160
+ },
161
+ {
162
+ selector: "MethodDefinition[key.type='PrivateIdentifier']",
163
+ message: 'No # prefix on class members. Use the private keyword instead.',
164
+ },
165
+ // No constructor injection — use inject()
166
+ {
167
+ selector: 'TSParameterProperty[accessibility]',
168
+ message: 'No constructor injection. Use inject() instead.',
169
+ },
170
+ // No legacy Angular lifecycle hooks
171
+ {
172
+ selector:
173
+ 'MethodDefinition[key.name=/^ngOnChanges$|^ngAfterViewInit$|^ngAfterContentInit$|^ngAfterContentChecked$|^ngAfterViewChecked$|^ngDoCheck$/]',
174
+ message:
175
+ 'No legacy Angular lifecycle hooks. Use afterNextRender, inject(DestroyRef).onDestroy, or constructor-based effects instead.',
176
+ },
177
+ // No @Injectable — use createRootProvider / createProvider from @ethlete/core
178
+ {
179
+ selector: "Decorator[expression.callee.name='Injectable'], Decorator[expression.name='Injectable']",
180
+ message: 'No @Injectable services. Use createRootProvider / createProvider from @ethlete/core instead.',
181
+ },
182
+ // No route guards — handle access control inside the component itself
183
+ {
184
+ selector:
185
+ 'TSClassImplements > Identifier.expression[name=/^CanActivate$|^CanDeactivate$|^CanActivateChild$|^CanMatch$|^CanLoad$/]',
186
+ message: 'No route guards. Handle access control inside the component itself.',
187
+ },
188
+ // No route resolvers — use the query library to fetch data
189
+ {
190
+ selector: "TSClassImplements > Identifier.expression[name='Resolve']",
191
+ message: 'No route resolvers. Use the query library to fetch data instead.',
192
+ },
193
+ // No barrel imports — import directly from the source file
194
+ {
195
+ selector: 'ImportDeclaration[source.value=/(^|[/])index$/]',
196
+ message:
197
+ 'No barrel imports (index files). Import directly from the source file to avoid breaking lazy loading.',
198
+ },
199
+ ],
200
+
201
+ // ── Native DOM globals ──────────────────────────────────────────────────
202
+
203
+ // No direct document/window access — use inject(DOCUMENT) / inject(WINDOW) instead
204
+ 'no-restricted-globals': [
205
+ 'error',
206
+ {
207
+ name: 'document',
208
+ message: "Use inject(DOCUMENT) from '@angular/common' instead of the global document.",
209
+ },
210
+ {
211
+ name: 'window',
212
+ message: 'Avoid accessing the global window directly. Use platform detection or a dedicated injection token.',
213
+ },
214
+ ],
215
+
216
+ // ── Custom plugin rules ─────────────────────────────────────────────────
217
+
218
+ // No inject(X).member chaining — assign to a const first
219
+ 'ethlete/no-inject-chain': 'error',
220
+
221
+ // No public properties except explicit injected external APIs
222
+ 'ethlete/no-public-property': 'error',
223
+
224
+ // No explicit trivial return types TypeScript can infer
225
+ 'ethlete/no-trivial-return-type': 'error',
226
+
227
+ // Empty line required before return in multi-statement if-blocks (guard clauses)
228
+ 'ethlete/guard-return-newline': 'error',
229
+
230
+ // No code in subscribe() callbacks — use tap() instead
231
+ 'ethlete/no-subscribe-with-body': 'error',
232
+
233
+ // Observable variables/properties must end with $
234
+ 'ethlete/require-dollar-suffix': 'error',
235
+
236
+ // No .subscribe() inside a .pipe() callback
237
+ 'ethlete/no-subscribe-in-pipe': 'error',
238
+
239
+ // No .subscribe() inside effect() or computed()
240
+ 'ethlete/no-rxjs-in-effect': 'error',
241
+
242
+ // No readonly on reactive class properties (signals, inputs, computed, inject, etc.)
243
+ 'ethlete/no-readonly-signal': 'error',
244
+
245
+ // No SCREAMING_CASE variable names inside function bodies
246
+ 'ethlete/no-screaming-case-local': 'error',
247
+
248
+ // Prefer RxJS timer/interval/fromEvent over setTimeout/setInterval/addEventListener
249
+ 'ethlete/prefer-rxjs-timer': 'error',
250
+
251
+ // Prefer linkedSignal over signal + .set() inside effect()
252
+ 'ethlete/prefer-linked-signal': 'warn',
253
+
254
+ // No trivial wrapper methods that only forward all args to another call
255
+ 'ethlete/no-trivial-wrapper-method': 'error',
256
+
257
+ // No direct DOM manipulation — use injectRenderer() from @ethlete/core instead
258
+ 'ethlete/no-direct-dom-manipulation': 'error',
259
+
260
+ // No raw IntersectionObserver / MutationObserver / ResizeObserver — use @ethlete/core signal utils
261
+ 'ethlete/no-native-observers': 'error',
262
+
263
+ // Prefer injectViewportSize() over window.innerWidth / innerHeight / outerWidth / outerHeight
264
+ 'ethlete/prefer-viewport-size': 'warn',
265
+
266
+ // Prefer injectMediaQueryIsMatched() / injectBreakpointIsMatched() etc. over .matchMedia()
267
+ 'ethlete/prefer-match-media': 'error',
268
+
269
+ // Prefer signalElementDimensions() / signalHostElementDimensions() in reactive contexts
270
+ 'ethlete/prefer-element-dimensions': 'warn',
271
+
272
+ // Prefer signalElementScrollState() / signalHostElementScrollState() in reactive contexts
273
+ 'ethlete/prefer-scroll-state': 'warn',
274
+
275
+ // No `import type { Foo }` or `import { type Foo }` — use regular value imports
276
+ 'ethlete/no-type-only-import': 'error',
277
+
278
+ // No empty blank lines between import declarations
279
+ 'ethlete/no-empty-newlines-between-imports': 'error',
280
+
281
+ // No legacy Angular decorators — use signal-based APIs (input, output, viewChild, etc.)
282
+ // and host: {} bindings (instead of @HostBinding / @HostListener)
283
+ 'ethlete/no-legacy-angular-decorators': 'error',
284
+
285
+ // No Angular Title/Meta services — use @ethlete/core SEO utilities instead
286
+ // (injectTitleBinding, injectMetaBinding, injectLinkBinding, etc.)
287
+ 'ethlete/no-angular-seo-services': 'error',
288
+
289
+ // No JSON.parse(JSON.stringify()), structuredClone, or lodash cloneDeep / isEqual
290
+ // — use clone() / equal() from '@ethlete/core' instead
291
+ 'ethlete/prefer-clone-equal': 'error',
292
+
293
+ // No direct document.cookie access
294
+ // — use getCookie / setCookie / hasCookie / deleteCookie from '@ethlete/core' instead
295
+ 'ethlete/no-document-cookie': 'error',
296
+
297
+ // Injected providers must be private by default, and protected only when
298
+ // referenced from an Angular template or host binding.
299
+ 'ethlete/inject-member-accessibility': 'error',
300
+
301
+ // No ActivatedRoute (fully replaced by inject* router utilities from @ethlete/core)
302
+ // No inject(Router) for state reading — use injectUrl/injectRoute/injectQueryParam etc.
303
+ 'ethlete/no-angular-router-api': 'warn',
304
+
305
+ // No window.location.* reads for URL state — use injectUrl/injectRoute/injectQueryParam etc.
306
+ // No new URLSearchParams(window.location.search) — use injectQueryParams()
307
+ 'ethlete/no-window-location': 'warn',
308
+
309
+ // No inject(LOCALE_ID) — use injectLocale() from '@ethlete/core'
310
+ 'ethlete/no-locale-id': 'error',
311
+
312
+ // No class members that are pure aliases for a nested property of another member
313
+ // — widen the accessibility of the source member instead
314
+ 'ethlete/no-member-alias': 'error',
315
+
316
+ // No leading underscores on class members; auto-fix private members when safe
317
+ 'ethlete/no-leading-underscore-class-member': 'error',
318
+
319
+ // No declared-but-never-read private/protected class members
320
+ 'ethlete/no-unused-class-member': 'error',
321
+
322
+ // No direct DOM query methods (querySelector, getElementById, etc.)
323
+ // — use viewChild() / viewChildren() or contentChild() / contentChildren() instead
324
+ 'ethlete/no-dom-query': 'error',
325
+
326
+ // Remove empty imports: [] and hostDirectives: [] metadata noise
327
+ 'ethlete/no-empty-angular-metadata-arrays': 'error',
328
+
329
+ // Remove standalone metadata — standalone is implicit and should not be declared
330
+ 'ethlete/no-standalone-flag': 'error',
331
+
332
+ // ── Angular outputs ─────────────────────────────────────────────────────
333
+
334
+ // No on-prefixed outputs (onSelectDate → selectDate)
335
+ '@angular-eslint/no-output-on-prefix': 'error',
336
+
337
+ // No outputs named after native DOM events (change, click, etc.)
338
+ '@angular-eslint/no-output-native': 'error',
339
+
340
+ // ── Angular components ──────────────────────────────────────────────────
341
+
342
+ // Always use ChangeDetectionStrategy.OnPush
343
+ 'ethlete/require-on-push-change-detection': 'error',
344
+
345
+ // Always use ViewEncapsulation.None (angular-eslint's use-component-view-encapsulation does the
346
+ // opposite — it disallows None, so we use our own custom rule instead)
347
+ 'ethlete/require-view-encapsulation-none': 'error',
348
+
349
+ // Keep Angular @Component / @Directive metadata in a consistent order
350
+ 'ethlete/angular-decorator-property-order': 'error',
351
+
352
+ // Prefer shorthand hostDirectives entries and keep extended host directive configs ordered
353
+ 'ethlete/prefer-concise-angular-host-directives': 'error',
354
+
355
+ // Prefer concise Angular style metadata when there is only one entry
356
+ 'ethlete/prefer-concise-angular-style-metadata': 'error',
357
+
358
+ // No logic in pipe transform — assign to an external utility function instead
359
+ 'ethlete/no-pipe-logic': 'error',
360
+
361
+ // Routing components must use paths containing "-view" and class names ending in "ViewComponent"
362
+ 'ethlete/enforce-routing-view-naming': 'error',
363
+ },
364
+ };
365
+
366
+ /**
367
+ * Flat config entries for Angular HTML template files.
368
+ * @type {import('eslint').Linter.Config}
369
+ */
370
+ const recommendedTemplate = {
371
+ files: ['**/*.html'],
372
+ rules: {
373
+ // No $any() in templates
374
+ '@angular-eslint/template/no-any': 'error',
375
+ // Prefer plain attribute over unnecessary property binding for static strings: etIcon="foo" not [etIcon]="'foo'"
376
+ '@angular-eslint/template/prefer-static-string-properties': 'error',
377
+ },
378
+ };
379
+
380
+ module.exports = { recommendedTs, recommendedTemplate };
package/src/index.js ADDED
@@ -0,0 +1,126 @@
1
+ // @ts-check
2
+ 'use strict';
3
+
4
+ const noInjectChain = require('./rules/no-inject-chain');
5
+ const noTrivialReturnType = require('./rules/no-trivial-return-type');
6
+ const noSubscribeInPipe = require('./rules/no-subscribe-in-pipe');
7
+ const noRxjsInEffect = require('./rules/no-rxjs-in-effect');
8
+ const noReadonlySignal = require('./rules/no-readonly-signal');
9
+ const noScreamingCaseLocal = require('./rules/no-screaming-case-local');
10
+ const preferRxjsTimer = require('./rules/prefer-rxjs-timer');
11
+ const preferLinkedSignal = require('./rules/prefer-linked-signal');
12
+ const noTrivialWrapperMethod = require('./rules/no-trivial-wrapper-method');
13
+ const noDirectDomManipulation = require('./rules/no-direct-dom-manipulation');
14
+ const noNativeObservers = require('./rules/no-native-observers');
15
+ const preferViewportSize = require('./rules/prefer-viewport-size');
16
+ const preferMatchMedia = require('./rules/prefer-match-media');
17
+ const preferElementDimensions = require('./rules/prefer-element-dimensions');
18
+ const preferScrollState = require('./rules/prefer-scroll-state');
19
+ const noTypeOnlyImport = require('./rules/no-type-only-import');
20
+ const guardReturnNewline = require('./rules/guard-return-newline');
21
+ const noSubscribeWithBody = require('./rules/no-subscribe-with-body');
22
+ const requireDollarSuffix = require('./rules/require-dollar-suffix');
23
+ const noPipeLogic = require('./rules/no-pipe-logic');
24
+ const enforceRoutingViewNaming = require('./rules/enforce-routing-view-naming');
25
+ const requireOnPushChangeDetection = require('./rules/require-on-push-change-detection');
26
+ const requireViewEncapsulationNone = require('./rules/require-view-encapsulation-none');
27
+ const noLegacyAngularDecorators = require('./rules/no-legacy-angular-decorators');
28
+ const noAngularSeoServices = require('./rules/no-angular-seo-services');
29
+ const preferCloneEqual = require('./rules/prefer-clone-equal');
30
+ const noDocumentCookie = require('./rules/no-document-cookie');
31
+ const injectMemberAccessibility = require('./rules/inject-member-accessibility');
32
+ const noPublicProperty = require('./rules/no-public-property');
33
+ const noAngularRouterApi = require('./rules/no-angular-router-api');
34
+ const noWindowLocation = require('./rules/no-window-location');
35
+ const noLocaleId = require('./rules/no-locale-id');
36
+ const noMemberAlias = require('./rules/no-member-alias');
37
+ const noUnusedClassMember = require('./rules/no-unused-class-member');
38
+ const noDomQuery = require('./rules/no-dom-query');
39
+ const noLeadingUnderscoreClassMember = require('./rules/no-leading-underscore-class-member');
40
+ const noEmptyAngularMetadataArrays = require('./rules/no-empty-angular-metadata-arrays');
41
+ const noStandaloneFlag = require('./rules/no-standalone-flag');
42
+ const noEmptyNewlinesBetweenImports = require('./rules/no-empty-newlines-between-imports');
43
+ const angularDecoratorPropertyOrder = require('./rules/angular-decorator-property-order');
44
+ const preferConciseAngularHostDirectives = require('./rules/prefer-concise-angular-host-directives');
45
+ const preferConciseAngularStyleMetadata = require('./rules/prefer-concise-angular-style-metadata');
46
+ const { recommendedTs, recommendedTemplate } = require('./configs/recommended');
47
+
48
+ /** @type {import('eslint').ESLint.Plugin} */
49
+ const plugin = {
50
+ meta: {
51
+ name: '@ethlete/eslint-plugin',
52
+ version: '0.0.1',
53
+ },
54
+ rules: {
55
+ 'no-inject-chain': noInjectChain,
56
+ 'no-trivial-return-type': noTrivialReturnType,
57
+ 'no-subscribe-in-pipe': noSubscribeInPipe,
58
+ 'no-rxjs-in-effect': noRxjsInEffect,
59
+ 'no-readonly-signal': noReadonlySignal,
60
+ 'no-screaming-case-local': noScreamingCaseLocal,
61
+ 'prefer-rxjs-timer': preferRxjsTimer,
62
+ 'prefer-linked-signal': preferLinkedSignal,
63
+ 'no-trivial-wrapper-method': noTrivialWrapperMethod,
64
+ 'no-direct-dom-manipulation': noDirectDomManipulation,
65
+ 'no-native-observers': noNativeObservers,
66
+ 'prefer-viewport-size': preferViewportSize,
67
+ 'prefer-match-media': preferMatchMedia,
68
+ 'prefer-element-dimensions': preferElementDimensions,
69
+ 'prefer-scroll-state': preferScrollState,
70
+ 'no-type-only-import': noTypeOnlyImport,
71
+ 'guard-return-newline': guardReturnNewline,
72
+ 'no-subscribe-with-body': noSubscribeWithBody,
73
+ 'require-dollar-suffix': requireDollarSuffix,
74
+ 'no-pipe-logic': noPipeLogic,
75
+ 'enforce-routing-view-naming': enforceRoutingViewNaming,
76
+ 'require-on-push-change-detection': requireOnPushChangeDetection,
77
+ 'require-view-encapsulation-none': requireViewEncapsulationNone,
78
+ 'no-legacy-angular-decorators': noLegacyAngularDecorators,
79
+ 'no-angular-seo-services': noAngularSeoServices,
80
+ 'prefer-clone-equal': preferCloneEqual,
81
+ 'no-document-cookie': noDocumentCookie,
82
+ 'inject-member-accessibility': injectMemberAccessibility,
83
+ 'no-public-property': noPublicProperty,
84
+ 'no-angular-router-api': noAngularRouterApi,
85
+ 'no-window-location': noWindowLocation,
86
+ 'no-locale-id': noLocaleId,
87
+ 'no-member-alias': noMemberAlias,
88
+ 'no-unused-class-member': noUnusedClassMember,
89
+ 'no-dom-query': noDomQuery,
90
+ 'no-leading-underscore-class-member': noLeadingUnderscoreClassMember,
91
+ 'no-empty-angular-metadata-arrays': noEmptyAngularMetadataArrays,
92
+ 'no-standalone-flag': noStandaloneFlag,
93
+ 'no-empty-newlines-between-imports': noEmptyNewlinesBetweenImports,
94
+ 'angular-decorator-property-order': angularDecoratorPropertyOrder,
95
+ 'prefer-concise-angular-host-directives': preferConciseAngularHostDirectives,
96
+ 'prefer-concise-angular-style-metadata': preferConciseAngularStyleMetadata,
97
+ },
98
+ };
99
+
100
+ // Inject the plugin reference into the configs so consumers don't have to
101
+ /** @type {import('eslint').Linter.Config} */
102
+ const recommendedTsWithPlugin = {
103
+ ...recommendedTs,
104
+ plugins: { ethlete: plugin },
105
+ };
106
+
107
+ /** @type {import('eslint').Linter.Config} */
108
+ const recommendedTemplateWithPlugin = {
109
+ ...recommendedTemplate,
110
+ };
111
+
112
+ const configs = {
113
+ /** TypeScript rules (merged into a files: ['**\/*.ts'] block) */
114
+ recommendedTs: recommendedTsWithPlugin,
115
+ /** Angular template rules (merged into a files: ['**\/*.html'] block) */
116
+ recommendedTemplate: recommendedTemplateWithPlugin,
117
+ /**
118
+ * Both together as a flat array — the most common usage:
119
+ * export default [...baseConfig, ...ethlete.configs.recommended]
120
+ */
121
+ recommended: [recommendedTsWithPlugin, recommendedTemplateWithPlugin],
122
+ };
123
+
124
+ const ethletePlugin = { ...plugin, configs };
125
+
126
+ module.exports = ethletePlugin;