fix eslint warnigs for core project (#7506)

This commit is contained in:
Denys Vuika
2022-02-17 14:35:33 +00:00
committed by GitHub
parent 5b7f255eec
commit bca5a783ab
246 changed files with 5127 additions and 5065 deletions

View File

@@ -34,12 +34,12 @@ describe('Notification History Component', () => {
let overlayContainerElement: HTMLElement;
let storage: StorageService;
function openNotification() {
const openNotification = () => {
fixture.detectChanges();
const button: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#adf-notification-history-open-button');
const button = element.querySelector<HTMLButtonElement>('#adf-notification-history-open-button');
button.click();
fixture.detectChanges();
}
};
setupTestBed({
imports: [
@@ -86,7 +86,7 @@ describe('Notification History Component', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(component.notifications.length).toBe(1);
const markAllAsRead = <HTMLButtonElement> overlayContainerElement.querySelector('#adf-notification-history-mark-as-read');
const markAllAsRead = overlayContainerElement.querySelector<HTMLButtonElement>('#adf-notification-history-mark-as-read');
markAllAsRead.click();
fixture.detectChanges();
expect(storage.getItem(NotificationHistoryComponent.NOTIFICATION_STORAGE)).toBeNull();
@@ -124,7 +124,7 @@ describe('Notification History Component', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
const notification = <HTMLButtonElement> overlayContainerElement.querySelector('.adf-notification-history-menu-item');
const notification = overlayContainerElement.querySelector<HTMLButtonElement>('.adf-notification-history-menu-item');
notification.click();
expect(callBackSpy).toHaveBeenCalled();
done();
@@ -142,7 +142,7 @@ describe('Notification History Component', () => {
openNotification();
fixture.whenStable().then(() => {
fixture.detectChanges();
const loadMoreButton = <HTMLButtonElement> overlayContainerElement.querySelector('.adf-notification-history-load-more');
const loadMoreButton = overlayContainerElement.querySelector<HTMLButtonElement>('.adf-notification-history-load-more');
expect(component.paginatedNotifications.length).toBe(5);
expect(loadMoreButton).toBeDefined();
done();
@@ -160,7 +160,7 @@ describe('Notification History Component', () => {
openNotification();
fixture.whenStable().then(() => {
fixture.detectChanges();
const notification = <HTMLButtonElement> overlayContainerElement.querySelector('.adf-notification-history-menu-item');
const notification = overlayContainerElement.querySelector<HTMLButtonElement>('.adf-notification-history-menu-item');
expect(notification).toBeDefined();
done();
});

View File

@@ -26,29 +26,23 @@ export const rootInitiator: NotificationInitiator = {
displayName: 'SYSTEM'
};
export function info(messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel {
return {
type: NOTIFICATION_TYPE.INFO,
datetime: new Date(),
initiator,
messages: [].concat(messages)
};
}
export const info = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
type: NOTIFICATION_TYPE.INFO,
datetime: new Date(),
initiator,
messages: [].concat(messages)
});
export function warning(messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel {
return {
type: NOTIFICATION_TYPE.WARN,
datetime: new Date(),
initiator,
messages: [].concat(messages)
};
}
export const warning = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
type: NOTIFICATION_TYPE.WARN,
datetime: new Date(),
initiator,
messages: [].concat(messages)
});
export function error(messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel {
return {
type: NOTIFICATION_TYPE.ERROR,
datetime: new Date(),
initiator,
messages: [].concat(messages)
};
}
export const error = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
type: NOTIFICATION_TYPE.ERROR,
datetime: new Date(),
initiator,
messages: [].concat(messages)
});

View File

@@ -15,6 +15,7 @@
* limitations under the License.
*/
// eslint-disable-next-line no-shadow
export enum NOTIFICATION_TYPE {
INFO = 'info',
WARN = 'warning',

View File

@@ -44,6 +44,7 @@ export class NotificationService {
/**
* Opens a SnackBar notification to show a message.
*
* @param message The message (or resource key) to show.
* @param config Time before notification disappears after being shown or MatSnackBarConfig object
* @param interpolateArgs The interpolation parameters to add for the translation
@@ -55,6 +56,7 @@ export class NotificationService {
/**
* Opens a SnackBar notification with a message and a response button.
*
* @param message The message (or resource key) to show.
* @param action Caption for the response button
* @param config Time before notification disappears after being shown or MatSnackBarConfig object
@@ -67,6 +69,7 @@ export class NotificationService {
/**
* Rase error message
*
* @param message Text message or translation key for the message.
* @param action Action name
* @param interpolateArgs The interpolation parameters to add for the translation
@@ -77,6 +80,7 @@ export class NotificationService {
/**
* Rase info message
*
* @param message Text message or translation key for the message.
* @param action Action name
* @param interpolateArgs The interpolation parameters to add for the translation
@@ -87,6 +91,7 @@ export class NotificationService {
/**
* Rase warning message
*
* @param message Text message or translation key for the message.
* @param action Action name
* @param interpolateArgs The interpolation parameters to add for the translation
@@ -104,6 +109,7 @@ export class NotificationService {
/**
* Push new notification to Notification History
*
* @param notification - Notification model to be pushed.
*/
pushToNotificationHistory(notification: NotificationModel) {