Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linting-1): biome fixes #1549

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c45abcd
feat(linting-1): biome intro
matthew2564 Aug 13, 2024
c21e385
fix(linting-1): disable rules
matthew2564 Aug 13, 2024
c933c30
chore(linting-1): enable useTemplate
matthew2564 Aug 13, 2024
2693501
chore(linting-1): enable no this in static
matthew2564 Aug 13, 2024
4deb3c9
chore(linting-1): enable use optional chain
matthew2564 Aug 13, 2024
fa40771
chore(linting-1): enable no accumulating spread
matthew2564 Aug 13, 2024
339272f
chore(linting-1): enable no shadow restricted names
matthew2564 Aug 13, 2024
8890b32
chore(linting-1): enable no void type return
matthew2564 Aug 13, 2024
aceeb0a
chore(linting-1): enable no assign in expressions
matthew2564 Aug 13, 2024
0429d40
chore(linting-1): enable no invalid use before declaration
matthew2564 Aug 13, 2024
60ae90a
chore(linting-1): enable no switch declarations
matthew2564 Aug 13, 2024
64c2e38
chore(linting-1): enable no prototype builtins
matthew2564 Aug 13, 2024
351875b
chore(linting-1): enable no parameter assign
matthew2564 Aug 13, 2024
a1351f2
chore(linting-1): enable no non null assertion
matthew2564 Aug 13, 2024
7c4d383
chore(linting-1): enable no banned types
matthew2564 Aug 14, 2024
b17790d
fix(linting-1): conflicts
matthew2564 Aug 14, 2024
301d643
fix(linting-1): revert api dir
matthew2564 Aug 14, 2024
5966ece
chore(linting-1): enable no implicit any let
matthew2564 Aug 14, 2024
96f5ab1
chore(linting-1): enable no duplicate test hooks
matthew2564 Aug 14, 2024
191981f
chore(linting-1): enable use regex literals
matthew2564 Aug 14, 2024
c93f0c0
Merge branch 'develop' into feat/biome-integration-config-fixes
matthew2564 Aug 15, 2024
29c5874
fix(build-1): provider hoisting
matthew2564 Aug 15, 2024
6341588
fix(linting-1): lint fix
matthew2564 Aug 15, 2024
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
21 changes: 1 addition & 20 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,17 @@
"linter": {
"rules": {
"complexity": {
"noBannedTypes": "off",
"noForEach": "off",
"noThisInStatic": "off",
"noUselessConstructor": "off",
"useLiteralKeys": "off",
"useOptionalChain": "off",
"useRegexLiterals": "off"
},
"correctness": {
"noInvalidUseBeforeDeclaration": "off",
"noVoidTypeReturn": "off",
"noSwitchDeclarations": "off"
"useLiteralKeys": "off"
},
"performance": {
"noAccumulatingSpread": "off",
"noDelete": "off"
},
"suspicious": {
"noAssignInExpressions": "off",
"noDoubleEquals": "off",
"noDuplicateTestHooks": "off",
"noExplicitAny": "off",
"noImplicitAnyLet": "off",
"noPrototypeBuiltins": "off",
"noShadowRestrictedNames": "off",
"useValidTypeof": "off"
},
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "off"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/accessible-autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ declare module 'accessible-autocomplete/dist/accessible-autocomplete.min' {
defaultValue?: string;
autoselect?: boolean;
showAllValues?: boolean;
dropdownArrow?: Function;
dropdownArrow?: () => unknown;
}

export interface AutocompleteParams extends DefaultParams, ElementParam {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ describe('BreadcrumbsComponent', () => {
imports: [RouterTestingModule],
providers: [RouterService, provideMockStore({ initialState: initialAppState })],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(BreadcrumbsComponent);
component = fixture.componentInstance;
store = TestBed.inject(MockStore);
Expand Down
2 changes: 0 additions & 2 deletions src/app/core/components/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ describe('FooterComponent', () => {
await TestBed.configureTestingModule({
declarations: [FooterComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ describe('GlobalErrorComponent', () => {
imports: [],
providers: [GlobalErrorService, provideMockStore({ initialState: initialAppState })],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(MockComponent);
component = fixture.debugElement.query(By.directive(GlobalErrorComponent)).componentInstance;
fixture.detectChanges();
Expand Down
15 changes: 0 additions & 15 deletions src/app/core/components/global-error/global-error.stories.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ describe('GlobalWarningComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [GlobalWarningComponent, MockComponent],
imports: [],
providers: [GlobalWarningService, provideMockStore({ initialState: initialAppState })],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(MockComponent);
component = fixture.debugElement.query(By.directive(GlobalWarningComponent)).componentInstance;
fixture.detectChanges();
Expand Down
2 changes: 0 additions & 2 deletions src/app/core/components/header/header.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ describe('HeaderComponent', () => {
await TestBed.configureTestingModule({
declarations: [HeaderComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe('PageNotFoundComponent', () => {
await TestBed.configureTestingModule({
declarations: [PageNotFoundComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(PageNotFoundComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ describe('PhaseBannerComponent', () => {
await TestBed.configureTestingModule({
declarations: [PhaseBannerComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(PhaseBannerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe('ServerErrorComponent', () => {
await TestBed.configureTestingModule({
declarations: [ServerErrorComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ServerErrorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ describe('HomeButtonComponent', () => {
declarations: [HomeButtonComponent],
imports: [RouterTestingModule],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(HomeButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
2 changes: 0 additions & 2 deletions src/app/features/home/home.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ describe('HomeComponent', () => {
},
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ describe('ReferenceDataCreateComponent', () => {
{ provide: ReferenceDataService, useValue: mockRefDataService },
],
}).compileComponents();
});

beforeEach(() => {
store = TestBed.inject(MockStore);
fixture = TestBed.createComponent(ReferenceDataCreateComponent);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ describe('ReferenceDataAmendHistoryComponent', () => {
{ provide: UserService, useValue: {} },
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ReferenceDataAmendHistoryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ describe('ReferenceDataAmendComponent', () => {
{ provide: ReferenceDataService, useValue: mockRefDataService },
],
}).compileComponents();
});

beforeEach(() => {
store = TestBed.inject(MockStore);
fixture = TestBed.createComponent(ReferenceDataAmendComponent);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ describe('ReferenceDataAddComponent', () => {
{ provide: UserService, useValue: {} },
],
}).compileComponents();
});

beforeEach(() => {
store = TestBed.inject(MockStore);
fixture = TestBed.createComponent(ReferenceDataDeleteComponent);
component = fixture.componentInstance;
Expand All @@ -44,6 +42,7 @@ describe('ReferenceDataAddComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

describe('navigateBack', () => {
it('should clear all errors', () => {
jest.spyOn(router, 'navigate').mockImplementation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ describe('DataTypeListComponent', () => {
},
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ReferenceDataDeletedListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ describe('DataTypeListComponent', () => {
{ provide: UserService, useValue: { roles$: of([Roles.ReferenceDataView]) } },
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ReferenceDataListComponent);
component = fixture.componentInstance;
route = TestBed.inject(ActivatedRoute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ describe('ReferenceDataComponent', () => {
{ provide: UserService, useValue: { roles$: of([Roles.ReferenceDataView]) } },
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ReferenceDataSelectTypeComponent);
component = fixture.componentInstance;
router = TestBed.inject(Router);
Expand Down
2 changes: 0 additions & 2 deletions src/app/features/search/search.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ describe('SearchComponent', () => {
imports: [HttpClientTestingModule, RouterTestingModule],
providers: [GlobalErrorService, TechnicalRecordService, provideMockStore({ initialState: initialAppState })],
}).compileComponents();
});

beforeEach(() => {
store = TestBed.inject(MockStore);
store.overrideSelector(globalErrorState, expectedErrors);
fixture = TestBed.createComponent(SearchComponent);
Expand Down
7 changes: 4 additions & 3 deletions src/app/features/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ export class SearchComponent {
this.globalErrorService.clearErrors();
this.store.dispatch(clearAllSectionStates());
this.store.dispatch(clearScrollPosition());
term = term.trim();

if (!term) {
const formattedTerm = term.trim();

if (!formattedTerm) {
this.globalErrorService.addError({ error: this.missingTermErrorMessage, anchorLink: 'search-term' });
} else if (!Object.values(SEARCH_TYPES).includes(type as SEARCH_TYPES)) {
this.globalErrorService.addError({ error: this.missingTypeErrorMessage, anchorLink: 'search-type' });
} else {
void this.router.navigate(['/search/results'], { queryParams: { [type]: term } });
void this.router.navigate(['/search/results'], { queryParams: { [type]: formattedTerm } });
}
}

Expand Down
31 changes: 0 additions & 31 deletions src/app/features/search/search.stories.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ describe('SingleSearchResultComponent', () => {
},
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(SingleSearchResultComponent);
component = fixture.componentInstance;
component.searchResult = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ describe('AdrGenerateCertificateComponent', () => {
let store: MockStore;
let technicalRecordService: TechnicalRecordService;

beforeEach(async () => {
await TestBed.configureTestingModule({
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [AdrGenerateCertificateComponent],
providers: [
GlobalErrorService,
Expand All @@ -52,8 +52,7 @@ describe('AdrGenerateCertificateComponent', () => {
],
imports: [RouterTestingModule, SharedModule, ReactiveFormsModule, DynamicFormsModule, HttpClientTestingModule],
}).compileComponents();
});
beforeEach(() => {

fixture = TestBed.createComponent(AdrGenerateCertificateComponent);
errorService = TestBed.inject(GlobalErrorService);
route = TestBed.inject(ActivatedRoute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ export class AdrGenerateCertificateComponent implements OnInit, OnDestroy {

handleSubmit(): void {
this.globalErrorService.clearErrors();

if (!this.form.value.certificateType) {
return this.globalErrorService.addError({
this.globalErrorService.addError({
error: 'ADR Certificate Type is required',
anchorLink: 'certificateType',
});
return;
}

this.store.dispatch(
generateADRCertificate({
systemNumber: this.systemNumber ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ describe('EditTechRecordButtonComponent', () => {
],
imports: [DynamicFormsModule, HttpClientTestingModule, RouterTestingModule, SharedModule],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(EditTechRecordButtonComponent);
router = TestBed.inject(Router);
store = TestBed.inject(MockStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ describe('TechRecordAmendReasonComponent', () => {

route = TestBed.inject(ActivatedRoute);
router = TestBed.inject(Router);
});

beforeEach(() => {
fixture = TestBed.createComponent(TechRecordAmendReasonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ describe('TechRecordChangeVinComponent', () => {
],
imports: [RouterTestingModule, SharedModule, ReactiveFormsModule, DynamicFormsModule],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(AmendVinComponent);
errorService = TestBed.inject(GlobalErrorService);
route = TestBed.inject(ActivatedRoute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ describe('TechRecordChangeVrmComponent', () => {
],
imports: [RouterTestingModule, SharedModule, ReactiveFormsModule, DynamicFormsModule, HttpClientTestingModule],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(AmendVrmReasonComponent);
errorService = TestBed.inject(GlobalErrorService);
router = TestBed.inject(Router);
Expand Down
Loading
Loading