Skip to content

Commit 3650502

Browse files
authored
style: enable all angular eslint rules (#DS-2920) (#732)
1 parent 77d0133 commit 3650502

File tree

17 files changed

+67
-44
lines changed

17 files changed

+67
-44
lines changed

.eslintrc.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ const typescriptRules = {
116116
tsconfigRootDir: __dirname
117117
},
118118
extends: [
119+
/** @see https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/all.ts */
119120
'plugin:@typescript-eslint/recommended',
120-
'plugin:@angular-eslint/recommended',
121+
/** @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/angular-eslint/src/configs/ts-all.ts */
122+
'plugin:@angular-eslint/all',
121123
'plugin:@angular-eslint/template/process-inline-templates',
122124
'plugin:rxjs/recommended'
123125
],
@@ -144,8 +146,21 @@ const typescriptRules = {
144146
'@angular-eslint/no-input-rename': 0,
145147
'@angular-eslint/no-outputs-metadata-property': 0,
146148
'@angular-eslint/no-output-native': 0,
147-
'@angular-eslint/no-async-lifecycle-method': 1,
148-
'@angular-eslint/contextual-decorator': 1,
149+
'@angular-eslint/prefer-on-push-component-change-detection': 0,
150+
'@angular-eslint/relative-url-prefix': 0,
151+
'@angular-eslint/component-max-inline-declarations': 0,
152+
'@angular-eslint/consistent-component-styles': 0,
153+
'@angular-eslint/use-component-view-encapsulation': 0,
154+
'@angular-eslint/use-injectable-provided-in': 0,
155+
'@angular-eslint/no-forward-ref': 0,
156+
'@angular-eslint/prefer-standalone-component': 0,
157+
'@angular-eslint/prefer-standalone': 0,
158+
'@angular-eslint/sort-lifecycle-methods': 0,
159+
'@angular-eslint/prefer-output-readonly': 0,
160+
'@angular-eslint/no-conflicting-lifecycle': 0,
161+
'@angular-eslint/no-attribute-decorator': 0,
162+
'@angular-eslint/no-pipe-impure': 0,
163+
'@angular-eslint/sort-ngmodule-metadata-arrays': 0,
149164

150165
// plugin:rxjs
151166
'rxjs/no-implicit-any-catch': 0,
@@ -165,8 +180,8 @@ const typescriptRules = {
165180
const templateRules = {
166181
files: ['*.html'],
167182
extends: [
168-
'plugin:@angular-eslint/template/recommended',
169-
'plugin:@angular-eslint/template/accessibility'
183+
/** @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/angular-eslint/src/configs/template-all.ts */
184+
'plugin:@angular-eslint/template/all'
170185
],
171186
rules: {
172187
// plugin:@angular-eslint/template
@@ -175,8 +190,14 @@ const templateRules = {
175190
'@angular-eslint/template/click-events-have-key-events': 0,
176191
'@angular-eslint/template/interactive-supports-focus': 0,
177192
'@angular-eslint/template/label-has-associated-control': 0,
178-
'@angular-eslint/template/prefer-self-closing-tags': 1,
179-
'@angular-eslint/template/prefer-control-flow': 1
193+
'@angular-eslint/template/i18n': 0,
194+
'@angular-eslint/template/no-call-expression': 0,
195+
'@angular-eslint/template/prefer-ngsrc': 0,
196+
'@angular-eslint/template/no-inline-styles': 0,
197+
'@angular-eslint/template/button-has-type': 0,
198+
'@angular-eslint/template/no-interpolation-in-attributes': 0,
199+
'@angular-eslint/template/attributes-order': 0,
200+
'@angular-eslint/template/no-any': 0
180201
}
181202
};
182203

@@ -205,7 +226,7 @@ const componentsDevRules = {
205226
style: 'kebab-case'
206227
}
207228
],
208-
'@angular-eslint/prefer-standalone-component': 1,
229+
'@angular-eslint/prefer-standalone': 1,
209230
'@angular-eslint/use-component-selector': 1,
210231
'@angular-eslint/prefer-on-push-component-change-detection': 1,
211232

@@ -224,7 +245,7 @@ const componentsDevRules = {
224245
const componentsExamplesRules = {
225246
files: ['packages/docs-examples/**/*.ts'],
226247
rules: {
227-
'@angular-eslint/prefer-standalone-component': 1,
248+
'@angular-eslint/prefer-standalone': 1,
228249
'@angular-eslint/use-component-selector': 1
229250
}
230251
};
@@ -235,7 +256,6 @@ const componentsExamplesRules = {
235256
* @type {import('eslint').Linter.ConfigOverride}
236257
*/
237258
const appDocsRules = {
238-
// Override rules for docs app
239259
files: ['apps/docs/**/*.ts'],
240260
rules: {
241261
// plugin:eslint
@@ -258,7 +278,7 @@ const appDocsRules = {
258278
style: 'kebab-case'
259279
}
260280
],
261-
'@angular-eslint/prefer-standalone-component': 1,
281+
'@angular-eslint/prefer-standalone': 1,
262282
'@angular-eslint/use-component-selector': 1
263283
}
264284
};
@@ -269,7 +289,6 @@ const appDocsRules = {
269289
* @type {import('eslint').Linter.ConfigOverride}
270290
*/
271291
const specRules = {
272-
// Override rules for test files
273292
files: ['*.spec.ts', '*.karma-spec.ts'],
274293
rules: {
275294
'@angular-eslint/use-component-selector': 0,
@@ -295,14 +314,15 @@ const config = {
295314
'file-progress'
296315
],
297316
extends: [
298-
'plugin:eslint-comments/recommended'
317+
'plugin:@eslint-community/eslint-comments/recommended'
299318
],
300319
rules: {
301320
// plugin:file-progress
302321
'file-progress/activate': isCI ? 0 : 1,
303322

304-
// plugin:eslint-comments
305-
'eslint-comments/no-unused-disable': 1
323+
// plugin:@eslint-community/eslint-comments
324+
'@eslint-community/eslint-comments/no-unused-disable': 1,
325+
'@eslint-community/eslint-comments/disable-enable-pair': [1, { allowWholeFile: true }]
306326
},
307327
overrides: [
308328
javascriptAndTypescriptRules,

apps/docs/src/app/components/navbar/navbar.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export class DocsNavbarComponent extends DocsLocaleState implements OnDestroy {
107107
}
108108

109109
ngOnDestroy() {
110+
// eslint-disable-next-line @angular-eslint/no-lifecycle-call
110111
this.themeService.ngOnDestroy();
111112

112113
try {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"@commitlint/config-conventional": "^19.5.0",
6363
"@cspell/dict-markdown": "^2.0.2",
6464
"@cspell/dict-ru_ru": "^2.2.1",
65+
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
6566
"@koobiq/design-tokens": "^3.12.1",
6667
"@koobiq/luxon-date-adapter": "^3.1.4",
6768
"@koobiq/moment-date-adapter": "^3.1.4",
@@ -107,7 +108,6 @@
107108
"dotenv": "^16.4.5",
108109
"eslint": "^8.57.1",
109110
"eslint-config-prettier": "^9.1.0",
110-
"eslint-plugin-eslint-comments": "^3.2.0",
111111
"eslint-plugin-file-progress": "^1.5.0",
112112
"eslint-plugin-prettier": "^5.2.6",
113113
"eslint-plugin-promise": "^7.2.1",

packages/components-dev/list/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h5>single selection</h5>
1313
Normal
1414
<kbq-option-action
1515
[kbqDropdownTriggerFor]="dropdown"
16-
[kbqPlacement]="$any('right')"
16+
[kbqPlacement]="popUpPlacements.Right"
1717
[kbqTooltip]="'Tooltip text'"
1818
/>
1919
</kbq-list-option>

packages/components-dev/popover/module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,16 @@ export class DevApp {
150150
return this.activatedPosition === value && this.selectedPlacement !== this.activatedPosition;
151151
}
152152

153-
getOrder(forElement: string) {
153+
getOrder(forElement: string): number {
154154
if (forElement === 'config') {
155-
return this.selectedOrder ? { order: 2 } : { order: 1 };
155+
return this.selectedOrder ? 2 : 1;
156156
}
157157

158158
if (forElement === 'result') {
159-
return this.selectedOrder ? { order: 1 } : { order: 2 };
159+
return this.selectedOrder ? 1 : 2;
160160
}
161+
162+
return 1;
161163
}
162164

163165
get isFallbackActivated(): boolean {

packages/components-dev/popover/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<dev-examples />
4242

4343
<div class="dev-container flex-100 layout-column layout-align-start-start">
44-
<div class="kbq-form-vertical layout-row layou-align-start-start dev-config" [style]="getOrder('config')">
44+
<div class="kbq-form-vertical layout-row layou-align-start-start dev-config" [style.order]="getOrder('config')">
4545
<div class="flex-20 kbq-form__fieldset">
4646
<div class="kbq-form__row">
4747
<label for="order" class="kbq-form__label">Inverse layout order</label>
@@ -291,7 +291,7 @@ <h3>Configuration:</h3>
291291
</div>
292292
</div>
293293

294-
<div cdkScrollable style="overflow: scroll" class="{{ layoutClass }} dev-result" [style]="getOrder('result')">
294+
<div cdkScrollable style="overflow: scroll" class="{{ layoutClass }} dev-result" [style.order]="getOrder('result')">
295295
<div style="min-width: 1500px; display: flex; justify-content: center">
296296
@switch (showElement()) {
297297
@case (ELEMENTS.BUTTON) {

packages/components/datepicker/calendar.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export class KbqCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
207207

208208
/** Updates today's date after an update of the active date */
209209
updateTodaysDate() {
210+
// eslint-disable-next-line @angular-eslint/no-lifecycle-call
210211
this.monthView.ngAfterContentInit();
211212
}
212213

packages/components/datepicker/datepicker-module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { KbqMonthView } from './month-view.component';
2525
OverlayModule,
2626
A11yModule,
2727
PortalModule,
28-
KbqButtonModule,
2928
KbqSelectModule,
3029
KbqIconModule,
3130
NgClass,

packages/components/empty-state/empty-state.module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
KbqEmptyStateIcon,
2121
KbqEmptyStateText,
2222
KbqEmptyStateTitle,
23-
KbqEmptyStateTitle,
2423
KbqEmptyStateActions
2524
],
2625
exports: [

packages/components/textarea/textarea.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export class KbqTextarea
205205
// Force setter to be called in case id was not specified.
206206
this.id = this.id;
207207

208+
// eslint-disable-next-line @angular-eslint/no-lifecycle-call
208209
this.parent?.animationDone.subscribe(() => this.ngOnInit());
209210

210211
this.growSubscription = this.stateChanges.subscribe(this.grow);

packages/components/tree-select/tree-select.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ export class KbqTreeSelect
574574
}
575575
});
576576

577+
// eslint-disable-next-line @angular-eslint/no-lifecycle-call
577578
this.tree.ngAfterContentInit();
578579

579580
this.initKeyManager();

packages/docs-examples/components/accordion/accordion-in-section/accordion-in-section-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import { KbqAccordionModule } from '@koobiq/components/accordion';
99
selector: 'accordion-in-section-example',
1010
templateUrl: 'accordion-in-section-example.html',
1111
styleUrls: ['accordion-in-section-example.css'],
12-
imports: [KbqAccordionModule, KbqAccordionModule]
12+
imports: [KbqAccordionModule]
1313
})
1414
export class AccordionInSectionExample {}

packages/docs-examples/components/input/input-number-overview/input-number-overview-example.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import { KbqInputModule } from '@koobiq/components/input';
1414
KbqFormFieldModule,
1515
KbqInputModule,
1616
FormsModule,
17-
KbqFormsModule,
18-
KbqInputModule
17+
KbqFormsModule
1918
],
2019
template: `
2120
<div class="kbq-text-big">

packages/docs-examples/components/layout-flex/layout-flex-overview/layout-flex-overview-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { KbqRadioModule } from '@koobiq/components/radio';
1818
<kbq-radio-button [value]="'layout-column'">layout-column</kbq-radio-button>
1919
<kbq-radio-button [value]="'layout-row'">layout-row</kbq-radio-button>
2020
</kbq-radio-group>
21-
<div class="layout-margin-top-4xl" [class]="layoutDirection">
21+
<div class="layout-margin-top-4xl {{ layoutDirection }}">
2222
<div class="flex example-block">first</div>
2323
<div class="flex example-block">second</div>
2424
<div class="flex example-block">third</div>

tools/public_api_guard/components/datepicker.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export class KbqDatepickerModule {
407407
// Warning: (ae-forgotten-export) The symbol "i7" needs to be exported by the entry point index.d.ts
408408
//
409409
// (undocumented)
410-
static ɵmod: i0.ɵɵNgModuleDeclaration<KbqDatepickerModule, [typeof i1.KbqCalendar, typeof i2.KbqCalendarBody, typeof i3.KbqDatepicker, typeof i3.KbqDatepickerContent, typeof i4.KbqDatepickerInput, typeof i5.KbqDatepickerToggle, typeof i5.KbqDatepickerToggleIcon, typeof i6.KbqMonthView, typeof i7.KbqCalendarHeader], [typeof i8.KbqButtonModule, typeof i9.OverlayModule, typeof i10.A11yModule, typeof i11.PortalModule, typeof i8.KbqButtonModule, typeof i12.KbqSelectModule, typeof i13.KbqIconModule, typeof i14.NgClass, typeof i14.TitleCasePipe], [typeof i1.KbqCalendar, typeof i2.KbqCalendarBody, typeof i3.KbqDatepicker, typeof i3.KbqDatepickerContent, typeof i4.KbqDatepickerInput, typeof i5.KbqDatepickerToggle, typeof i5.KbqDatepickerToggleIcon, typeof i6.KbqMonthView, typeof i7.KbqCalendarHeader]>;
410+
static ɵmod: i0.ɵɵNgModuleDeclaration<KbqDatepickerModule, [typeof i1.KbqCalendar, typeof i2.KbqCalendarBody, typeof i3.KbqDatepicker, typeof i3.KbqDatepickerContent, typeof i4.KbqDatepickerInput, typeof i5.KbqDatepickerToggle, typeof i5.KbqDatepickerToggleIcon, typeof i6.KbqMonthView, typeof i7.KbqCalendarHeader], [typeof i8.KbqButtonModule, typeof i9.OverlayModule, typeof i10.A11yModule, typeof i11.PortalModule, typeof i12.KbqSelectModule, typeof i13.KbqIconModule, typeof i14.NgClass, typeof i14.TitleCasePipe], [typeof i1.KbqCalendar, typeof i2.KbqCalendarBody, typeof i3.KbqDatepicker, typeof i3.KbqDatepickerContent, typeof i4.KbqDatepickerInput, typeof i5.KbqDatepickerToggle, typeof i5.KbqDatepickerToggleIcon, typeof i6.KbqMonthView, typeof i7.KbqCalendarHeader]>;
411411
}
412412

413413
// @public (undocumented)

tools/public_api_guard/components/empty-state.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class KbqEmptyStateModule {
5858
// Warning: (ae-forgotten-export) The symbol "i1" needs to be exported by the entry point index.d.ts
5959
//
6060
// (undocumented)
61-
static ɵmod: i0.ɵɵNgModuleDeclaration<KbqEmptyStateModule, [typeof i1.KbqEmptyState, typeof i1.KbqEmptyStateIcon, typeof i1.KbqEmptyStateText, typeof i1.KbqEmptyStateTitle, typeof i1.KbqEmptyStateTitle, typeof i1.KbqEmptyStateActions], [typeof i2.A11yModule, typeof i3.PlatformModule], [typeof i1.KbqEmptyState, typeof i1.KbqEmptyStateIcon, typeof i1.KbqEmptyStateText, typeof i1.KbqEmptyStateTitle, typeof i1.KbqEmptyStateActions]>;
61+
static ɵmod: i0.ɵɵNgModuleDeclaration<KbqEmptyStateModule, [typeof i1.KbqEmptyState, typeof i1.KbqEmptyStateIcon, typeof i1.KbqEmptyStateText, typeof i1.KbqEmptyStateTitle, typeof i1.KbqEmptyStateActions], [typeof i2.A11yModule, typeof i3.PlatformModule], [typeof i1.KbqEmptyState, typeof i1.KbqEmptyStateIcon, typeof i1.KbqEmptyStateText, typeof i1.KbqEmptyStateTitle, typeof i1.KbqEmptyStateActions]>;
6262
}
6363

6464
// @public (undocumented)

yarn.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4014,6 +4014,18 @@ __metadata:
40144014
languageName: node
40154015
linkType: hard
40164016

4017+
"@eslint-community/eslint-plugin-eslint-comments@npm:^4.5.0":
4018+
version: 4.5.0
4019+
resolution: "@eslint-community/eslint-plugin-eslint-comments@npm:4.5.0"
4020+
dependencies:
4021+
escape-string-regexp: "npm:^4.0.0"
4022+
ignore: "npm:^5.2.4"
4023+
peerDependencies:
4024+
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
4025+
checksum: 10c0/19013d30b0c29517f19028718af4bd6b6fd357e5f9b927ee1cf3499ffe3b2852440e9651401947f4f82e962ecd1d228afa1c08f6146751f5158fe0748d924702
4026+
languageName: node
4027+
linkType: hard
4028+
40174029
"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0":
40184030
version: 4.4.0
40194031
resolution: "@eslint-community/eslint-utils@npm:4.4.0"
@@ -10969,18 +10981,6 @@ __metadata:
1096910981
languageName: node
1097010982
linkType: hard
1097110983

10972-
"eslint-plugin-eslint-comments@npm:^3.2.0":
10973-
version: 3.2.0
10974-
resolution: "eslint-plugin-eslint-comments@npm:3.2.0"
10975-
dependencies:
10976-
escape-string-regexp: "npm:^1.0.5"
10977-
ignore: "npm:^5.0.5"
10978-
peerDependencies:
10979-
eslint: ">=4.19.1"
10980-
checksum: 10c0/c71db824592dc8ea498021572a0bd33d763ef26126bdb3b84a027ca75a1adbe0894ec95024f7de39ef12308560e62cbf8af0d06ffe472be5ba8bd9169c928e96
10981-
languageName: node
10982-
linkType: hard
10983-
1098410984
"eslint-plugin-file-progress@npm:^1.5.0":
1098510985
version: 1.5.0
1098610986
resolution: "eslint-plugin-file-progress@npm:1.5.0"
@@ -12942,7 +12942,7 @@ __metadata:
1294212942
languageName: node
1294312943
linkType: hard
1294412944

12945-
"ignore@npm:^5.0.5, ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1":
12945+
"ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1":
1294612946
version: 5.3.1
1294712947
resolution: "ignore@npm:5.3.1"
1294812948
checksum: 10c0/703f7f45ffb2a27fb2c5a8db0c32e7dee66b33a225d28e8db4e1be6474795f606686a6e3bcc50e1aa12f2042db4c9d4a7d60af3250511de74620fbed052ea4cd
@@ -14773,6 +14773,7 @@ __metadata:
1477314773
"@cspell/dict-ru_ru": "npm:^2.2.1"
1477414774
"@docsearch/css": "npm:^3.6.2"
1477514775
"@docsearch/js": "npm:^3.6.2"
14776+
"@eslint-community/eslint-plugin-eslint-comments": "npm:^4.5.0"
1477614777
"@fontsource/inter": "npm:^5.1.0"
1477714778
"@fontsource/jetbrains-mono": "npm:^5.1.1"
1477814779
"@koobiq/ag-grid-angular-theme": "npm:^30.0.6"
@@ -14827,7 +14828,6 @@ __metadata:
1482714828
dotenv: "npm:^16.4.5"
1482814829
eslint: "npm:^8.57.1"
1482914830
eslint-config-prettier: "npm:^9.1.0"
14830-
eslint-plugin-eslint-comments: "npm:^3.2.0"
1483114831
eslint-plugin-file-progress: "npm:^1.5.0"
1483214832
eslint-plugin-prettier: "npm:^5.2.6"
1483314833
eslint-plugin-promise: "npm:^7.2.1"

0 commit comments

Comments
 (0)