Skip to content

Commit

Permalink
refactor(eslint): application code changes from tslint to eslint
Browse files Browse the repository at this point in the history
- changed from `tslint:disable` to `eslint-disable`
- whitespace changes (jsdoc, test title)

BREAKING CHANGE: Switch linting from `tslint` to `eslint`.
  • Loading branch information
MaxKless committed Jan 17, 2022
1 parent 4d8114e commit 23578b9
Show file tree
Hide file tree
Showing 159 changed files with 310 additions and 158 deletions.
1 change: 0 additions & 1 deletion projects/organization-management/src/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { User } from 'ish-core/models/user/user.model';
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
// tslint:disable-next-line: component-creation-test
export class AppComponent implements OnInit {
user$: Observable<User>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
updateUser,
} from '../store/users';

// tslint:disable:member-ordering
/* eslint-disable @typescript-eslint/member-ordering */
@Injectable({ providedIn: 'root' })
export class OrganizationManagementFacade {
constructor(private store: Store) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Cost Center Create Page Component', () => {
expect(element.querySelector('ish-cost-center-form')).toBeTruthy();
});

it('should not submit a form when the user does not fill all required fields ', () => {
it('should not submit a form when the user does not fill all required fields', () => {
component.form = fb.group({
costCenterId: ['', [Validators.required]],
});
Expand All @@ -70,7 +70,7 @@ describe('Cost Center Create Page Component', () => {
expect(component.formDisabled).toBeTrue();
});

it('should submit a form when the user fills all required fields ', () => {
it('should submit a form when the user fills all required fields', () => {
fixture.detectChanges();

expect(component.formDisabled).toBeFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Cost Center Edit Page Component', () => {
expect(element.querySelector('ish-cost-center-form')).toBeTruthy();
});

it('should not submit a form when the user does not fill all required fields ', () => {
it('should not submit a form when the user does not fill all required fields', () => {
component.form = fb.group({
costCenterId: ['', [Validators.required]],
});
Expand All @@ -83,7 +83,7 @@ describe('Cost Center Edit Page Component', () => {
expect(component.formDisabled).toBeTrue();
});

it('should submit a form when the user fills all required fields ', () => {
it('should submit a form when the user fills all required fields', () => {
fixture.detectChanges();

expect(component.formDisabled).toBeFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('User Detail Page Component', () => {
expect(() => fixture.detectChanges()).not.toThrow();
});

it('should display user data after creation ', () => {
it('should display user data after creation', () => {
fixture.detectChanges();

expect(element.querySelector('[data-testing-id="name-field"]').textContent).toMatchInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Users Page Component', () => {
expect(element.querySelector('ish-loading')).toBeTruthy();
});

it('should display user list after creation ', () => {
it('should display user list after creation', () => {
when(organizationManagementFacade.users$).thenReturn(of(users));
fixture.detectChanges();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class CostCentersService {

/**
* Get all cost centers of a customer. The current user is expected to have permission APP_B2B_VIEW_COSTCENTER.
*
* @returns All cost centers of the customer.
*/
getCostCenters(): Observable<CostCenter[]> {
Expand All @@ -34,6 +35,7 @@ export class CostCentersService {

/**
* Get a cost center of a customer. The current user is expected to have permission APP_B2B_VIEW_COSTCENTER.
*
* @param costCenterId The costCenterId of the cost center.
* @returns The requested cost center of the customer.
*/
Expand All @@ -53,6 +55,7 @@ export class CostCentersService {

/**
* Creates a cost center of a customer. The current user is expected to have permission APP_B2B_MANAGE_COSTCENTER.
*
* @param costCenter The costCenter for the cost center creation.
* @returns The new cost center.
*/
Expand All @@ -72,6 +75,7 @@ export class CostCentersService {

/**
* Updates a cost center of a customer. The current user is expected to have permission APP_B2B_MANAGE_COSTCENTER.
*
* @param costCenter The costCenter for the cost center update.
* @returns The updated cost center.
*/
Expand All @@ -91,6 +95,7 @@ export class CostCentersService {

/**
* Deletes a cost center of a customer. The current user is expected to have permission APP_B2B_MANAGE_COSTCENTER.
*
* @param id The id of the costcenter that is to be deleted.
*/
deleteCostCenter(id: string) {
Expand All @@ -105,6 +110,7 @@ export class CostCentersService {

/**
* Adds buyers with their budgets to the cost center. The current user is expected to have permission APP_B2B_MANAGE_COSTCENTER.
*
* @param costCenterId The id of the costcenter.
* @param buyers An array of buyers and budgets.
* @returns The changed cost center.
Expand All @@ -130,6 +136,7 @@ export class CostCentersService {

/**
* Updates a cost center buyer budget. The current user is expected to have permission APP_B2B_MANAGE_COSTCENTER.
*
* @param costCenterId The id of the costcenter.
* @param buyer The changed buyer budget of the costcenter.
* @returns The updated cost center.
Expand All @@ -153,6 +160,7 @@ export class CostCentersService {

/**
* Un-assigns a buyer from a cost center. The current user is expected to have permission APP_B2B_MANAGE_COSTCENTER.
*
* @param costCenterId The id of the costcenter.
* @param login The login of the buyer.
* @returns The changed cost center.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class UsersService {

/**
* Get all users of a customer. The current user is expected to have user management permission.
*
* @returns All users of the customer.
*/
getUsers(): Observable<B2bUser[]> {
Expand All @@ -43,6 +44,7 @@ export class UsersService {

/**
* Get the data of a b2b user. The current user is expected to have user management permission.
*
* @param login The login of the user.
* @returns The user.
*/
Expand All @@ -58,6 +60,7 @@ export class UsersService {

/**
* Create a b2b user. The current user is expected to have user management permission.
*
* @param body The user data (customer, user, credentials, address) to create a new user.
* @returns The created user.
*/
Expand Down Expand Up @@ -104,6 +107,7 @@ export class UsersService {

/**
* Update a b2b user. The current user is expected to have user management permission.
*
* @param body The user data (customer, user, credentials, address) to update the user.
* @returns The updated user.
*/
Expand Down Expand Up @@ -132,6 +136,7 @@ export class UsersService {

/**
* Deletes the data of a b2b user. The current user is expected to have user management permission.
*
* @param login The login of the user.
* @returns The user.
*/
Expand Down Expand Up @@ -178,13 +183,14 @@ export class UsersService {

/**
* Set the budget for a given b2b user.
*
* @param login The login of the user.
* @param budget The user's budget.
* @returns The new budget
*/
setUserBudget(login: string, budget: UserBudget): Observable<UserBudget> {
if (!budget) {
// tslint:disable-next-line: ish-no-object-literal-type-assertion
// eslint-disable-next-line ish-custom-rules/no-object-literal-type-assertion
return of({} as UserBudget);
}
return this.currentCustomer$.pipe(
Expand Down
1 change: 0 additions & 1 deletion projects/organization-management/src/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
// tslint:disable-next-line: component-creation-test
export class LoginComponent {}
1 change: 0 additions & 1 deletion projects/requisition-management/src/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { User } from 'ish-core/models/user/user.model';
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
// tslint:disable-next-line: component-creation-test
export class AppComponent implements OnInit {
user$: Observable<User>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
loadRequisitions,
} from '../store/requisitions';

// tslint:disable:member-ordering
/* eslint-disable @typescript-eslint/member-ordering */
@Injectable({ providedIn: 'root' })
export class RequisitionManagementFacade {
constructor(private store: Store, private router: Router) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { routes } from '../../pages/requisition-management-routing.module';

import { RequisitionManagementBreadcrumbService } from './requisition-management-breadcrumb.service';

// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function adaptRoutes(rts: Route[], cmp: Type<any>): Route[] {
return rts.map(r => ({
...r,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class RequisitionsService {

/**
* Get all customer requisitions of a certain status and view. The current user is expected to have the approver permission.
*
* @param view Defines whether the 'buyer' or 'approver' view is returned. Default: 'buyer'
* @param status Approval status filter. Default: All requisitions are returned
* @returns Requisitions of the customer with their main attributes. To get all properties the getRequisition call is needed.
Expand All @@ -71,6 +72,7 @@ export class RequisitionsService {

/**
* Get a customer requisition of a certain id. The current user is expected to have the approver permission.
*
* @param id Requisition id.
* @returns Requisition with all attributes. If the requisition is approved and the order is placed, also order data are returned as part of the requisition.
*/
Expand All @@ -97,6 +99,7 @@ export class RequisitionsService {

/**
* Updates the requisition status. The current user is expected to have the approver permission.
*
* @param id Requisition id.
* @param statusCode The requisition approval status
* @param comment The approval comment
Expand Down Expand Up @@ -132,6 +135,7 @@ export class RequisitionsService {

/**
* Gets the order data, if needed and maps the requisition/order data.
*
* @param payload The requisition row data returned by the REST interface.
* @returns The requisition.
*/
Expand All @@ -156,6 +160,7 @@ export class RequisitionsService {

/**
* Gets the cost center data, if cost center approval is needed (the current user needs cost center admin permission) and appends it at the requisition cost center approval data.
*
* @param requisition The requisition (without cost center).
* @returns The requisition with cost center if appropriate().
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// tslint:disable no-barrel-files
// API to access ngrx requisitions state
export * from './requisitions.actions';
export * from './requisitions.selectors';
1 change: 0 additions & 1 deletion projects/requisition-management/src/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
// tslint:disable-next-line: component-creation-test
export class LoginComponent {}
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ShellModule } from './shell/shell.module';

@NgModule({
declarations: [AppComponent],
/* eslint-disable @angular-eslint/sort-ngmodule-metadata-arrays */
imports: [
BrowserModule.withServerTransition({ appId: 'intershop-pwa' }),
BrowserAnimationsModule,
Expand All @@ -32,6 +33,7 @@ import { ShellModule } from './shell/shell.module';
TactonRoutingModule,
AppLastRoutingModule,
],
/* eslint-disable @angular-eslint/sort-ngmodule-metadata-arrays */
bootstrap: [AppComponent],
providers: [{ provide: UrlSerializer, useClass: CustomUrlSerializer }],
})
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/configurations/ngrx-state-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function ngrxStateTransferMeta(reducer: ActionReducer<CoreState>): Action
};
}

// tslint:disable-next-line: no-any - generic store can only be used as any
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic store can only be used as any
export function filterState(store: any, maxLevel: number): object {
if (maxLevel > 0 && store && typeof store === 'object' && !(store instanceof Array)) {
return Object.keys(store)
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/directives/authorization-toggle.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class AuthorizationToggleDirective implements OnDestroy {
@Input() set ishIsAuthorizedTo(permission: string | string[]) {
// end previous subscription and subscribe to new permission
if (this.subscription) {
// tslint:disable-next-line: ban
// eslint-disable-next-line ban/ban
this.subscription.unsubscribe();
}
this.subscription = this.authorizationToggle
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/directives/feature-toggle.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class FeatureToggleDirective implements OnDestroy {
@Input() set ishFeature(feature: string) {
// end previous subscription and newly subscribe
if (this.subscription) {
// tslint:disable-next-line: ban
// eslint-disable-next-line ban/ban
this.subscription.unsubscribe();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/core/directives/intersection-observer.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const fromIntersectionObserver = (element: HTMLElement, config: IntersectionObse
return {
unsubscribe() {
intersectionObserver.disconnect();
// tslint:disable-next-line rxjs-no-subject-unsubscribe ban
// eslint-disable-next-line ban/ban, rxjs/no-subject-unsubscribe
subject$.unsubscribe();
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/directives/not-feature-toggle.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class NotFeatureToggleDirective implements OnDestroy {
@Input() set ishNotFeature(val: string) {
// end previous subscription and newly subscribe
if (this.subscription) {
// tslint:disable-next-line: ban
// eslint-disable-next-line ban/ban
this.subscription.unsubscribe();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/core/directives/not-role-toggle.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class NotRoleToggleDirective implements OnDestroy {
@Input() set ishHasNotRole(roleId: string | string[]) {
// end previous subscription and newly subscribe
if (this.subscription) {
// tslint:disable-next-line: ban
// eslint-disable-next-line ban/ban
this.subscription.unsubscribe();
}
this.subscription = this.roleToggleService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ProductContextAccessDirective implements OnDestroy {
if (!this.view && ctx?.product) {
this.view = viewContainer.createEmbeddedView(template, { ...ctx, context });
} else if (this.view && ctx?.product) {
// tslint:disable-next-line: ban
// eslint-disable-next-line ban/ban
Object.assign(this.view.context, ctx);
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/core/facades/account.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import {
} from 'ish-core/store/general/contact';
import { whenTruthy } from 'ish-core/utils/operators';

// tslint:disable:member-ordering
/* eslint-disable @typescript-eslint/member-ordering */
@Injectable({ providedIn: 'root' })
export class AccountFacade {
/**
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/facades/app.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export class AppFacade {

/**
* extracts a specific server setting from the store.
* @param path The path to the server setting, starting from the serverConfig/_config store.
*
* @param path the path to the server setting, starting from the serverConfig/_config store.
*/
serverSetting$<T>(path: string) {
return this.store.pipe(select(getServerConfigParameter<T>(path)));
Expand All @@ -115,6 +116,7 @@ export class AppFacade {
/**
* returns the currency symbol for the currency parameter in the current locale.
* If no parameter is given, the the default currency is taken instead of it.
*
* @param currency The currency
*/
currencySymbol$(currency?: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/facades/checkout.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { getOrdersError, getSelectedOrder } from 'ish-core/store/customer/orders
import { getLoggedInUser, getUserCostCenters, loadUserCostCenters } from 'ish-core/store/customer/user';
import { whenFalsy, whenTruthy } from 'ish-core/utils/operators';

// tslint:disable:member-ordering
/* eslint-disable @typescript-eslint/member-ordering */
@Injectable({ providedIn: 'root' })
export class CheckoutFacade {
private basketChangeInternal$ = new Subject<void>();
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/facades/product-context.facade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ describe('Product Context Facade', () => {
});

it('should go to error if quantity is null', () => {
// tslint:disable-next-line: no-null-keyword
// eslint-disable-next-line unicorn/no-null
context.set('quantity', () => null);
expect(pickQuantityFields(context)).toMatchInlineSnapshot(`
Object {
Expand Down
Loading

0 comments on commit 23578b9

Please sign in to comment.