Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
53589dc
Remove unused-vars debt in wrappers, elements, pipes, formly
fpigeonjr Sep 3, 2026
e0117d2
Remove unused-vars/prefer-const debt in utilities
fpigeonjr Sep 3, 2026
048c601
Remove unused-vars/prefer-const debt in directives
fpigeonjr Sep 3, 2026
7b6ee35
Remove unused-vars/prefer-const debt in layout-deprecated
fpigeonjr Sep 3, 2026
7806208
Convert prefer-const debt in hierarchical-test-service.spec.ts
fpigeonjr Sep 3, 2026
f916b5e
Remove unused-vars/prefer-const debt in autocomplete-search.component.ts
fpigeonjr Sep 3, 2026
80534e0
Remove unused-vars/prefer-const debt in form-controls/autocomplete
fpigeonjr Sep 3, 2026
6f917ed
Remove unused-vars/prefer-const debt in menu-item, hierarchical-tree-…
fpigeonjr Sep 3, 2026
e540ffc
Remove unused-vars/prefer-const debt in pagination spec, hierarchical…
fpigeonjr Sep 3, 2026
c24f8ff
Remove unused-vars/prefer-const debt in autocomplete-search spec, ext…
fpigeonjr Sep 3, 2026
9cc79fc
Remove unused-vars/prefer-const debt in sidenav, date-range-v2 spec, …
fpigeonjr Sep 3, 2026
b7094b6
Remove unused-vars/prefer-const debt in abstract-combobox, hierarchic…
fpigeonjr Sep 3, 2026
1806160
Remove unused-vars/prefer-const debt in comments, data-table, paginat…
fpigeonjr Sep 3, 2026
8010913
Remove unused-vars/prefer-const debt in input-mask, picker, search, v…
fpigeonjr Sep 3, 2026
8ca3240
Remove unused-vars/prefer-const debt in autocomplete.service, radiobu…
fpigeonjr Sep 3, 2026
d8bca02
Remove unused-vars/prefer-const debt in accordion, actions-dropdown, …
fpigeonjr Sep 3, 2026
eeefcdc
Remove unused-vars/prefer-const debt in actions-list, date-range-v2, …
fpigeonjr Sep 3, 2026
d65b7cb
Remove unused-vars/prefer-const debt in breadcrumbs, alert, abstract-…
fpigeonjr Sep 3, 2026
b8561a6
Remove unused-vars/prefer-const debt in autocomplete, date-time, sele…
fpigeonjr Sep 3, 2026
8a419ae
Remove unused-vars/prefer-const debt in comments, download, header, p…
fpigeonjr Sep 3, 2026
aeb58f1
Remove final unused-vars/prefer-const debt (hierarchical, form-contro…
fpigeonjr Sep 3, 2026
78588f1
Promote no-unused-vars and prefer-const to errors
fpigeonjr Sep 3, 2026
d5d6365
Lower root ESLint warning baseline: 1619 -> 1031
fpigeonjr Sep 3, 2026
f03bb99
Apply Prettier formatting to files touched by unused-vars/prefer-cons…
fpigeonjr Sep 3, 2026
a93cdb3
Restore parameters required by existing typed/template call sites
fpigeonjr Sep 3, 2026
dd08470
Merge remote-tracking branch 'origin/master' into gh-585-remove-unuse…
fpigeonjr Sep 9, 2026
c7a8806
Merge remote-tracking branch 'origin/master' into gh-585-remove-unuse…
fpigeonjr Sep 10, 2026
6cf896e
Merge remote-tracking branch 'origin/master' into gh-585-remove-unuse…
fpigeonjr Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export default tseslint.config(
rules: {
...recommendedTypeScriptWarnings,
"no-restricted-syntax": ["error", noUnboundRxjsOperatorRule],
// GSA/sam-ui-elements#585: promoted to errors once the codebase reached
// zero warnings for these two rules (unused declarations/imports/params
// and never-reassigned `let` bindings are fully cleaned up).
"prefer-const": "error",
"@typescript-eslint/no-unused-vars": "error",
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ViewChild,
ChangeDetectorRef,
} from "@angular/core";
import { SamAutocompleteComponent, AutocompleteService } from "../../../ui-kit";
import { SamAutocompleteComponent } from "../../../ui-kit";

import { AbstractSamFormly } from "../../sam-formly";

Expand Down
1 change: 1 addition & 0 deletions src/formly/components/autocomplete/test.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class TestAutocompleteService implements AutocompleteService {
public setFetchMethod() {}

public fetch(val: string): Observable<unknown> {
void val;
return of([
{ key: "MD", value: "Maryland", category: "Places" },
{ key: "VA", value: "Virginia", category: "Places" },
Expand Down
6 changes: 2 additions & 4 deletions src/ui-kit/components/accordion/accordion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
waitForAsync,
ComponentFixtureAutoDetect,
ComponentFixture,
TestBed,
} from "@angular/core/testing";
import { Component } from "@angular/core";
Expand Down Expand Up @@ -58,7 +57,7 @@
})
class AccordionInitialized {}

function getComponent(fix: any) {

Check warning on line 60 in src/ui-kit/components/accordion/accordion.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return fix.debugElement.query(By.directive(SamAccordionComponent))
.componentInstance;
}
Expand All @@ -67,19 +66,18 @@
describe("isolated tests", () => {
let component: SamAccordionComponent;
let sectionComponent: SamAccordionSection;
let sectionComponent2: SamAccordionSection;
beforeEach(() => {
component = new SamAccordionComponent();
sectionComponent = new SamAccordionSection(component);
sectionComponent2 = new SamAccordionSection(component);
new SamAccordionSection(component);
});
// section
it('should check for "name" prop and throw error', () => {
try {
sectionComponent.ngOnInit();
// shouldn't get here
expect(false).toBe(true);
} catch (e) {
} catch {
expect(true).toBe(true);
}
});
Expand Down Expand Up @@ -127,7 +125,7 @@

describe("integration tests", () => {
let component: SamAccordionComponent;
let fixture: any;

Check warning on line 128 in src/ui-kit/components/accordion/accordion.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
import { Component, Input, Output, EventEmitter } from "@angular/core";
import { SamActionInterface } from "../action-interface";

@Component({
Expand All @@ -18,11 +18,11 @@
/**
* EventEmitter that emits action name when button is clicked
*/
@Output() emitAction: EventEmitter<any> = new EventEmitter<any>();

Check warning on line 21 in src/ui-kit/components/actions/action-button/action-button.component.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check warning on line 21 in src/ui-kit/components/actions/action-button/action-button.component.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
/**
* Emits the results of the callback
*/
@Output() emitCallback: EventEmitter<any> = new EventEmitter<any>();

Check warning on line 25 in src/ui-kit/components/actions/action-button/action-button.component.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check warning on line 25 in src/ui-kit/components/actions/action-button/action-button.component.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

actionClicked() {
this.emitCallback.emit(this.action.callback());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Output,
EventEmitter,
ViewChild,
ElementRef,
ViewChildren,
} from "@angular/core";

Expand Down Expand Up @@ -55,7 +54,8 @@ export class SamActionsDropdownComponent {
showActions = false;
focusIndex = -1;

hideActions(event) {
hideActions(event: Event) {
void event;
return (this.showActions = false);
}

Expand Down Expand Up @@ -88,7 +88,7 @@ export class SamActionsDropdownComponent {
}

setFocusOnFirstItem() {
this.actionsList.changes.subscribe((t) => {
this.actionsList.changes.subscribe(() => {
this.ngForRendered();
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Injectable } from "@angular/core";
import { Injectable } from "@angular/core";
import { AlertType } from "../../types";
@Injectable()
export class SamAlertFooterService {
Expand Down
5 changes: 1 addition & 4 deletions src/ui-kit/components/alert-footer/alert-footer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { TestBed, inject } from "@angular/core/testing";
import { Observable } from "rxjs";
import { By } from "@angular/platform-browser";

// Load the implementations that should be tested
import { SamAlertFooterComponent, SamAlertFooterService } from "./index";
import { SamAlertComponent } from "../alert/alert.component";

describe("The AlertFooter component", () => {
describe("isolated tests", () => {
let component: SamAlertFooterComponent;
let service: SamAlertFooterService;
beforeEach(() => {
service = new SamAlertFooterService();
component = new SamAlertFooterComponent(service);
new SamAlertFooterComponent(service);
service.registerFooterAlert({
description: "hello",
title: "alert title",
Expand Down
1 change: 0 additions & 1 deletion src/ui-kit/components/alert/alert.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TestBed } from "@angular/core/testing";
import { RouterTestingModule } from "@angular/router/testing";
import { By } from "@angular/platform-browser";
import { SimpleChanges } from "@angular/core";

// Load the implementations that should be tested
import { SamAlertComponent } from "./alert.component";
Expand Down
1 change: 0 additions & 1 deletion src/ui-kit/components/banner/banner.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { TestBed } from "@angular/core/testing";
import { By } from "@angular/platform-browser";

// Load the implementations that should be tested
import { SamBannerComponent } from "./banner.component";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Input, Output, EventEmitter } from "@angular/core";
import { NavigationEnd, UrlSegment } from "@angular/router";
import { IBreadcrumb } from "../../types";

@Component({
Expand Down
2 changes: 0 additions & 2 deletions src/ui-kit/components/breadcrumbs/breadcrumbs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { TestBed } from "@angular/core/testing";
import { By } from "@angular/platform-browser";
import { RouterTestingModule } from "@angular/router/testing";
import { Observable, Subject } from "rxjs";
import { ActivatedRoute } from "@angular/router";

// Load the implementations that should be tested
import { SamBreadcrumbsComponent } from "./breadcrumbs.component";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class SamCommentComponent {
*/
@Output() delete: EventEmitter<any> = new EventEmitter<any>();

emitClick(comment: Event) {
emitClick() {
this.delete.emit(this.comment);
}
}
1 change: 0 additions & 1 deletion src/ui-kit/components/comments/comment/comment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { TestBed } from "@angular/core/testing";
import { CommonModule } from "@angular/common";
import moment from "moment";
import { By } from "@angular/platform-browser";

Expand Down
12 changes: 3 additions & 9 deletions src/ui-kit/components/comments/comments.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ import {
Component,
Input,
OnInit,
Optional,
ViewChild,
ElementRef,
OnDestroy,
} from "@angular/core";
import {
FormBuilder,
FormGroup,
Validators,
ControlValueAccessor,
} from "@angular/forms";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";

import { Observable, Subscription, Subject, of, fromEvent } from "rxjs";
import { flatMap, catchError, merge } from "rxjs/operators";
Expand Down Expand Up @@ -103,15 +97,15 @@ export class SamCommentsComponent implements OnInit, OnDestroy {

// Map DOM events to actions
this.getCommentsStream = this.showButtonStream.pipe(
flatMap((event) => {
flatMap(() => {
return this.commentsService
.getComments()
.pipe(catchError((error) => of(error)));
})
);

this.collapseCommentsStream = this.hideCommentsStream.pipe(
flatMap((event) => {
flatMap(() => {
return this.commentsService
.getInitialState()
.pipe(catchError((error) => of(error)));
Expand Down
1 change: 0 additions & 1 deletion src/ui-kit/components/comments/comments.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms";

import { SamCommentsComponent } from "./comments.component";
import { SamCommentComponent } from "./comment";
import { CommentsService } from "./comments.service";

import { SamPipesModule } from "../../pipes";
import { SamTextAreaModule } from "../../form-controls/textarea";
Expand Down
5 changes: 4 additions & 1 deletion src/ui-kit/components/comments/comments.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class CommentsService {
}

isCommentDeletable(comment: Comment): boolean {
void comment;
return true;
}

Expand All @@ -23,11 +24,13 @@ export class CommentsService {
return of(this._comments);
}

postComment(_: any): Observable<Comment[]> {
postComment(comment: Comment): Observable<Comment[]> {
void comment;
return of(this._comments);
}

deleteComment(comment: Comment): Observable<Comment[]> {
void comment;
return of(this._comments);
}

Expand Down
6 changes: 2 additions & 4 deletions src/ui-kit/components/comments/comments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
CommentsService,
Comment,
} from "./";
import { SamPipesModule } from "../../pipes";

import { Observable, of, throwError } from "rxjs";

Expand Down Expand Up @@ -88,7 +87,7 @@ export class CommentsDemoService implements CommentsService {
return this._disabled;
}

isCommentDeletable(comment: Comment): boolean {
isCommentDeletable(): boolean {
return true;
}

Expand Down Expand Up @@ -126,11 +125,10 @@ export class CommentsDemoService implements CommentsService {

describe("The Sam Comments component", () => {
describe("isolated tests", () => {
let component: SamCommentsComponent;
let service: CommentsService;
beforeEach(() => {
service = new CommentsService();
component = new SamCommentsComponent(service, undefined);
new SamCommentsComponent(service, undefined);
});
// service
it("service should tell us if commenting is disabled", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { SamSortable, SamSortDirective } from "./";
import { merge } from "rxjs";
import { map } from "rxjs/operators";
import { DataSource } from "@angular/cdk/collections";
import { fromEvent } from "rxjs";
import { RECORDS } from "./data.sample.spec";
import { BehaviorSubject } from "rxjs";
/* tslint:disable */
Expand Down
13 changes: 1 addition & 12 deletions src/ui-kit/components/data-table/data-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ import {
Input,
OnChanges,
} from "@angular/core";
import {
CdkTable,
STICKY_POSITIONING_LISTENER,
CDK_TABLE,
} from "@angular/cdk/table";
import { CdkTable, CDK_TABLE } from "@angular/cdk/table";

import {
_DisposeViewRepeaterStrategy,
_RecycleViewRepeaterStrategy,
_VIEW_REPEATER_STRATEGY,
} from "@angular/cdk/collections";

Expand Down Expand Up @@ -83,9 +78,3 @@ export class SamDataTableComponent<T>
}
}
}
function Directive(arg0: {
selector: string;
providers: { provide: any; useClass: any }[];
}) {
throw new Error("Function not implemented.");
}
1 change: 0 additions & 1 deletion src/ui-kit/components/download/download.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TestBed, ComponentFixture } from "@angular/core/testing";
import { By } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { DebugElement } from "@angular/core";
import { AccessType, ExpansionType } from "../../types";
import { SamDownloadComponent } from "./download.component";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Host } from "@angular/core";
import { Component } from "@angular/core";

@Component({
selector: "sam-footer-nav-item",
Expand Down
2 changes: 1 addition & 1 deletion src/ui-kit/components/header-next/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class SamHeaderNextComponent {
// we know the user's viewport has been resized to be larger.
// Let's make the page state consistent by deactivating the mobile nav.
@HostListener("window:resize", ["$event"])
onBrowserResize(event) {
onBrowserResize() {
if (
this.mobileNavActive &&
this.closeNavBtn.nativeElement.getBoundingClientRect().width === 0
Expand Down
2 changes: 0 additions & 2 deletions src/ui-kit/components/header/header.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe("The Sam Header component", () => {
});

describe("rendered test", () => {
let component: SamHeaderComponent;
let fixture: any;

// provide our implementations or mocks to the dependency injector
Expand All @@ -31,7 +30,6 @@ describe("The Sam Header component", () => {
declarations: [SamHeaderComponent],
});
fixture = TestBed.createComponent(SamHeaderComponent);
component = fixture.componentInstance;
});

it("should compile", function () {
Expand Down
2 changes: 1 addition & 1 deletion src/ui-kit/components/history/history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, waitForAsync } from "@angular/core/testing";
import { TestBed } from "@angular/core/testing";

import { By } from "@angular/platform-browser";
import { RouterTestingModule } from "@angular/router/testing";
Expand Down
6 changes: 3 additions & 3 deletions src/ui-kit/components/image/image.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class SamImageComponent implements OnInit {
this.editModeSubscription = this.editButtonStream
.pipe(merge(this.cancelButtonStream), merge(this.saveButtonStream))
.subscribe(
(event) => {
() => {
if (this.editable) {
this.toggleEdit();
}
Expand All @@ -85,7 +85,7 @@ export class SamImageComponent implements OnInit {
);

this.cancelButtonSubscription = this.cancelButtonStream.subscribe(
(event) => {
() => {
this.tmpValue = undefined;
this.tmpSrc = undefined;
},
Expand All @@ -95,7 +95,7 @@ export class SamImageComponent implements OnInit {
);

this.saveButtonSubscription = this.saveButtonStream.subscribe(
(event) => {
() => {
if (this.isImageTemporary()) {
this.value = this.tmpValue;
this.src = this.tmpSrc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TestBed } from "@angular/core/testing";

import { SamMultiSelectDropdownComponent } from "./multiselect-dropdown.component";
import { SamUIKitModule } from "../../index";
import { SamFormControlsModule } from "../../form-controls";
import { SamFormService } from "../../form-service";

Expand Down
2 changes: 1 addition & 1 deletion src/ui-kit/components/page-title/page-title.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, HostBinding } from "@angular/core";
import { Component, Input } from "@angular/core";

@Component({
selector: "sam-page-title",
Expand Down
2 changes: 1 addition & 1 deletion src/ui-kit/components/pagination/pagination.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, waitForAsync, fakeAsync, tick } from "@angular/core/testing";
import { TestBed } from "@angular/core/testing";

import { By } from "@angular/platform-browser";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, waitForAsync, fakeAsync, tick } from "@angular/core/testing";
import { TestBed } from "@angular/core/testing";

import { By } from "@angular/platform-browser";

Expand Down
Loading
Loading