diff --git a/src/accordion/accordion-item.component.ts b/src/accordion/accordion-item.component.ts index 9fd3e20dc4..a2912d0573 100644 --- a/src/accordion/accordion-item.component.ts +++ b/src/accordion/accordion-item.component.ts @@ -48,7 +48,7 @@ import { display: list-item; } `], - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush }) export class AccordionItem { static accordionItemCount = 0; diff --git a/src/breadcrumb/breadcrumb-item.component.ts b/src/breadcrumb/breadcrumb-item.component.ts index c87f89b2ff..40fa851a3b 100644 --- a/src/breadcrumb/breadcrumb-item.component.ts +++ b/src/breadcrumb/breadcrumb-item.component.ts @@ -29,7 +29,7 @@ import { Router } from "@angular/router"; } `, - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush }) export class BreadcrumbItemComponent { @Input() set href(v: string) { diff --git a/src/breadcrumb/breadcrumb.component.ts b/src/breadcrumb/breadcrumb.component.ts index 972bed7226..ac1923e4be 100644 --- a/src/breadcrumb/breadcrumb.component.ts +++ b/src/breadcrumb/breadcrumb.component.ts @@ -123,7 +123,7 @@ const MINIMUM_OVERFLOW_THRESHOLD = 4; } `, - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush }) export class Breadcrumb implements AfterContentInit { @ContentChildren(BreadcrumbItemComponent) children: QueryList; diff --git a/src/checkbox/checkbox-exported-tests.ts b/src/checkbox/checkbox-exported-tests.ts index 6b9c17811e..ca1a4bba01 100644 --- a/src/checkbox/checkbox-exported-tests.ts +++ b/src/checkbox/checkbox-exported-tests.ts @@ -33,10 +33,10 @@ class CheckboxExportedTests extends ComponentTests { afterClickState }); }), - runComparison: results => { - // eslint-disable-next-line no-unused-expressions + runComparison: results => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions expect(results.initialState).to.be.false; - // eslint-disable-next-line no-unused-expressions + // eslint-disable-next-line @typescript-eslint/no-unused-expressions expect(results.afterClickState).to.be.true; } } diff --git a/src/checkbox/stories/reactive-form.component.ts b/src/checkbox/stories/reactive-form.component.ts index 83913aff4c..6458c51a02 100644 --- a/src/checkbox/stories/reactive-form.component.ts +++ b/src/checkbox/stories/reactive-form.component.ts @@ -34,6 +34,7 @@ export class ReactiveFormsStory implements OnInit { toggleDisable() { const checkbox = this.formGroup.get("checkbox"); if (checkbox != null) { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions checkbox.disabled ? checkbox.enable() : checkbox.disable(); } } diff --git a/src/code-snippet/code-snippet.component.ts b/src/code-snippet/code-snippet.component.ts index f82a59866d..b543b70c71 100644 --- a/src/code-snippet/code-snippet.component.ts +++ b/src/code-snippet/code-snippet.component.ts @@ -67,7 +67,12 @@ export enum SnippetType { } } @if (!skeleton) { -
+
+						
+					
} @if (hasLeft) { @@ -85,7 +90,12 @@ export enum SnippetType { (click)="toggleSnippetExpansion()" type="button"> {{expanded ? translations.SHOW_LESS : translations.SHOW_MORE}} - + } } diff --git a/src/common/tab.service.ts b/src/common/tab.service.ts index f099372613..d251cf847a 100644 --- a/src/common/tab.service.ts +++ b/src/common/tab.service.ts @@ -1,7 +1,7 @@ -export let tabbableSelector = "a[href], area[href], input:not([disabled]):not([tabindex=\'-1\']), " + - "button:not([disabled]):not([tabindex=\'-1\']),select:not([disabled]):not([tabindex=\'-1\']), " + - "textarea:not([disabled]):not([tabindex=\'-1\']), " + - "iframe, object, embed, *[tabindex]:not([tabindex=\'-1\']), *[contenteditable=true]"; +export let tabbableSelector = "a[href], area[href], input:not([disabled]):not([tabindex='-1']), " + + "button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']), " + + "textarea:not([disabled]):not([tabindex='-1']), " + + "iframe, object, embed, *[tabindex]:not([tabindex='-1']), *[contenteditable=true]"; export let tabbableSelectorIgnoreTabIndex = "a[href], area[href], input:not([disabled]), " + "button:not([disabled]),select:not([disabled]), " + diff --git a/src/contained-list/contained-list.component.spec.ts b/src/contained-list/contained-list.component.spec.ts index 97e292cba4..2b1a807e62 100644 --- a/src/contained-list/contained-list.component.spec.ts +++ b/src/contained-list/contained-list.component.spec.ts @@ -115,7 +115,8 @@ describe("ContainedList", () => { const wrapperFixture: ComponentFixture = TestBed.createComponent(WrapperComponent); wrapperFixture.detectChanges(); - const actionElementRef = wrapperFixture.nativeElement.querySelector(".cds--contained-list .cds--contained-list__action ibm-icon-button"); + const actionElementRef = wrapperFixture.nativeElement + .querySelector(".cds--contained-list .cds--contained-list__action ibm-icon-button"); expect(actionElementRef).toBeTruthy(); }); }); @@ -141,7 +142,8 @@ describe("ContainedList", () => { const wrapperFixture: ComponentFixture = TestBed.createComponent(WrapperComponent); wrapperFixture.detectChanges(); - const iconElement = wrapperFixture.debugElement.query(By.css(".cds--contained-list-item:nth-child(3) svg[ng-reflect-ibm-icon='apple']")); + const iconElement = wrapperFixture.debugElement + .query(By.css(".cds--contained-list-item:nth-child(3) svg[ng-reflect-ibm-icon='apple']")); expect(iconElement).toBeTruthy(); }); diff --git a/src/contained-list/contained-list.stories.ts b/src/contained-list/contained-list.stories.ts index e5e1b77cbc..74cb64ae16 100644 --- a/src/contained-list/contained-list.stories.ts +++ b/src/contained-list/contained-list.stories.ts @@ -82,7 +82,12 @@ const usageExamplesTemplate = () => ({ - + View details Edit Remove diff --git a/src/context-menu/context-menu.component.ts b/src/context-menu/context-menu.component.ts index 6f10afde8c..ca191938df 100644 --- a/src/context-menu/context-menu.component.ts +++ b/src/context-menu/context-menu.component.ts @@ -75,7 +75,7 @@ export class ContextMenuComponent implements OnChanges { const menuItems: HTMLElement[] = ( Array.from(list.querySelectorAll(".cds--menu-item")) as HTMLElement[]) .filter(menuItem => !subMenus.some(subMenu => subMenu.contains(menuItem)) - ); + ); const currentIndex = menuItems.findIndex(menuItem => parseInt(menuItem.getAttribute("tabindex"), 10) === 0); const currentMenuItem = menuItems[currentIndex]; diff --git a/src/datepicker/carbon-flatpickr-month-select.ts b/src/datepicker/carbon-flatpickr-month-select.ts index 5ce6e77421..7fd5d045c3 100644 --- a/src/datepicker/carbon-flatpickr-month-select.ts +++ b/src/datepicker/carbon-flatpickr-month-select.ts @@ -48,6 +48,7 @@ export const carbonFlatpickrMonthSelectPlugin = fp => { 0, fp.monthElements.length, ...fp.monthElements.map(() => { + // eslint-disable-next-line no-underscore-dangle const monthElement = fp._createElement( "span", config.classFlatpickrCurrentMonth diff --git a/src/datepicker/datepicker.component.ts b/src/datepicker/datepicker.component.ts index d3d1ef84da..02b3521a55 100644 --- a/src/datepicker/datepicker.component.ts +++ b/src/datepicker/datepicker.component.ts @@ -643,7 +643,7 @@ export class DatePicker implements singleDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[0], this.dateFormat); singleDate = this.flatpickrInstance.formatDate(singleDate, this.dateFormat); // if date is not a string we can assume it's a Date and we should format - } else if (!!this.flatpickrInstance.selectedDates[0]) { + } else if (this.flatpickrInstance.selectedDates[0]) { singleDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[0], this.dateFormat); } @@ -655,7 +655,7 @@ export class DatePicker implements rangeDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[1].toString(), this.dateFormat); rangeDate = this.flatpickrInstance.formatDate(rangeDate, this.dateFormat); // if date is not a string we can assume it's a Date and we should format - } else if (!!this.flatpickrInstance.selectedDates[1]) { + } else if (this.flatpickrInstance.selectedDates[1]) { rangeDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[1], this.dateFormat); } setTimeout(() => { diff --git a/src/dialog/dialog.component.ts b/src/dialog/dialog.component.ts index 54abf74508..ecfb33ccee 100644 --- a/src/dialog/dialog.component.ts +++ b/src/dialog/dialog.component.ts @@ -137,7 +137,7 @@ export class Dialog implements OnInit, AfterViewInit, OnDestroy { }); } } - ); + ); } this.placeDialog(); diff --git a/src/dialog/overflow-menu/overflow-menu-option.component.ts b/src/dialog/overflow-menu/overflow-menu-option.component.ts index df383e26ad..199f936829 100644 --- a/src/dialog/overflow-menu/overflow-menu-option.component.ts +++ b/src/dialog/overflow-menu/overflow-menu-option.component.ts @@ -109,7 +109,7 @@ export class OverflowMenuOption implements AfterViewInit { @Input() set target(value: Target) { if (!Object.values(Target).includes(value)) { console.warn( -`\`target\` must have one of the following values: ${Object.values(Target).join(", ")}. + `\`target\` must have one of the following values: ${Object.values(Target).join(", ")}. Please use the \`Target\` enum exported by carbon-components-angular`); return; } diff --git a/src/dialog/overflow-menu/overflow-menu.stories.ts b/src/dialog/overflow-menu/overflow-menu.stories.ts index 15a0259046..22e85a8fd9 100644 --- a/src/dialog/overflow-menu/overflow-menu.stories.ts +++ b/src/dialog/overflow-menu/overflow-menu.stories.ts @@ -18,7 +18,7 @@ export default { }) ], args: { - placement: "bottom" + placement: "bottom" }, argTypes: { code: { @@ -87,10 +87,18 @@ const LinkTemplate = (args) => ({ An example option that is really long to show what should be done to handle long text - Option 2 + Option 2 Option 3 Option 4 - Disabled + Disabled Danger option diff --git a/src/dropdown/list/dropdown-list.component.spec.ts b/src/dropdown/list/dropdown-list.component.spec.ts index 808bc9b13b..18a07531f3 100644 --- a/src/dropdown/list/dropdown-list.component.spec.ts +++ b/src/dropdown/list/dropdown-list.component.spec.ts @@ -12,8 +12,8 @@ import { I18nModule } from "../../i18n/index"; }) class DropdownListTest { items = [ - {content: "one", selected: false}, - {content: "two", selected: false} + ({content: "one", selected: false} as ListItem), + ({content: "two", selected: false} as ListItem) ]; selected: ListItem; onSelect(ev) { @@ -26,8 +26,8 @@ class DropdownListTest { }) class MultiTest { items = [ - {content: "one", selected: false}, - {content: "two", selected: false} + ({content: "one", selected: false} as ListItem), + ({content: "two", selected: false} as ListItem) ]; selected: ListItem[]; onSelect(ev) { @@ -71,9 +71,9 @@ describe("Dropdown list", () => { it("should disable a list-item", () => { wrapper.items = [ - {content: "one", selected: false}, - {content: "two", selected: false, disabled: false}, - {content: "three", selected: false, disabled: true} + ({content: "one", selected: false} as ListItem), + ({content: "two", selected: false, disabled: false} as ListItem), + ({content: "three", selected: false, disabled: true} as ListItem) ]; fixture.detectChanges(); const disabledEls = fixture.debugElement.queryAll(By.css(".cds--list-box__menu-item[disabled]")); @@ -126,9 +126,9 @@ describe("Dropdown multi list", () => { it("should disable a list-item and its checkbox", () => { wrapper.items = [ - {content: "one", selected: false}, - {content: "two", selected: false, disabled: false}, - {content: "three", selected: false, disabled: true} + ({content: "one", selected: false} as ListItem), + ({content: "two", selected: false, disabled: false} as ListItem), + ({content: "three", selected: false, disabled: true} as ListItem) ]; fixture.detectChanges(); const disabledEls = fixture.debugElement.queryAll(By.css(".cds--list-box__menu-item[disabled]")); diff --git a/src/file-uploader/file-uploader.component.spec.ts b/src/file-uploader/file-uploader.component.spec.ts index 621d32725d..85b26b18e8 100644 --- a/src/file-uploader/file-uploader.component.spec.ts +++ b/src/file-uploader/file-uploader.component.spec.ts @@ -74,7 +74,7 @@ describe("FileUploader", () => { it("should only accept .txt files", () => { fixture = TestBed.createComponent(FileUploaderTest); fixture.detectChanges(); - element = fixture.debugElement.query(By.css("cds-file-uploader")); + element = fixture.debugElement.query(By.css("cds-file-uploader")); expect(element.nativeElement.querySelector(".cds--file-input").getAttribute("accept")).toEqual(".txt"); }); diff --git a/src/i18n/i18n.service.ts b/src/i18n/i18n.service.ts index 7dbf098202..a37dbbebf2 100644 --- a/src/i18n/i18n.service.ts +++ b/src/i18n/i18n.service.ts @@ -135,7 +135,7 @@ export class Overridable { /** * An object of strings, should follow the same format as src/i18n/en.json */ -export type TranslationStrings = { [key: string]: string }; +export interface TranslationStrings { [key: string]: string } /** diff --git a/src/index.stories.ts b/src/index.stories.ts index 8dbf39961a..20766ced3f 100644 --- a/src/index.stories.ts +++ b/src/index.stories.ts @@ -112,7 +112,7 @@ import { IconModule } from "./icon/icon.module"; `, - /* eslint-disable max-len */ + styles: [` .overview-page__banner { height: 100vh; diff --git a/src/input/label.component.ts b/src/input/label.component.ts index fb684586eb..650228fd24 100644 --- a/src/input/label.component.ts +++ b/src/input/label.component.ts @@ -211,7 +211,7 @@ export class Label implements AfterContentInit, AfterViewInit { @ContentChild(TextInput, { static: false }) textInput: TextInput; @ContentChild(PasswordInput, { static: false }) - passwordInput: PasswordInput; + passwordInput: PasswordInput; @HostBinding("class.cds--form-item") get labelClass() { return this.type === undefined; diff --git a/src/layer/layer.directive.ts b/src/layer/layer.directive.ts index db9f3791cb..90b5c0c90c 100644 --- a/src/layer/layer.directive.ts +++ b/src/layer/layer.directive.ts @@ -59,6 +59,7 @@ export class LayerDirective implements AfterContentInit { if (layer === this) { return; } + // eslint-disable-next-line no-underscore-dangle layer.layer = typeof layer._passedLevel === "number" ? layer._passedLevel : this.layer + 1; }); } diff --git a/src/modal/modal.component.ts b/src/modal/modal.component.ts index b2c926525b..981c671a2f 100644 --- a/src/modal/modal.component.ts +++ b/src/modal/modal.component.ts @@ -41,7 +41,13 @@ import { BaseModalService } from "./base-modal.service"; Header text