Skip to content

Commit

Permalink
Address eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan committed Jun 22, 2024
1 parent d958ab2 commit 1d69244
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions modules/unit-test-configs/__mocks__/file.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -17,7 +17,7 @@
*/

/**
* @fileoverview Stubs files such as .jpg, .png, etc.
* Stubs files such as .jpg, .png, etc.
*
* @see {@link jest.config.ts} for more file types that uses this stub.
*/
Expand Down
8 changes: 4 additions & 4 deletions modules/unit-test-configs/__mocks__/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -19,7 +19,7 @@
import * as crypto from "crypto";

/**
* @fileoverview Mocks of NPM Modules.
* Mocks of NPM Modules.
*
* @remarks If you had to mock a certain npm module,
* document the reason and any references clearly in this file.
Expand All @@ -30,7 +30,7 @@ import * as crypto from "crypto";
* This can cause issues when t is used as a hook dependency.
*/
const t = (key: string, object: any) => {
const placeholders = object ? Object.values(object).map(val => val).join(".") : "";
const placeholders: string = object ? Object.values(object).map((val: any) => val).join(".") : "";

return key + placeholders;
};
Expand All @@ -41,7 +41,7 @@ const t = (key: string, object: any) => {
*/
jest.mock("react-i18next", () => ({
// this mock makes sure any components using the translate hook can use it without a warning being shown
Trans: ({ children }) => children,
Trans: ({ children }: { children: any }) => children,
useTranslation: () => ({
t
})
Expand Down
2 changes: 1 addition & 1 deletion modules/unit-test-configs/__mocks__/redux/redux-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import thunk from "redux-thunk";

/**
* Middleware for the Redux store.
* @see {@link src/features/core/store/index.ts} for middleware used in the actual store.
* @see {@link @wso2is/features/admin.core.v1/store/index.ts#configureStore} for middleware used in the actual store.
*/
const middleware: Middleware[] = [
thunk
Expand Down
2 changes: 1 addition & 1 deletion modules/unit-test-configs/__mocks__/server/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down
2 changes: 1 addition & 1 deletion modules/unit-test-configs/__mocks__/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down
6 changes: 3 additions & 3 deletions modules/unit-test-configs/__mocks__/server/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -17,10 +17,10 @@
*/

import { rest } from "msw";
import { setupServer } from "msw/node";
import { SetupServerApi, setupServer } from "msw/node";
import { handlers } from "./handlers";

// This configures a request mocking server with the given request handlers.
const server = setupServer(...handlers);
const server: SetupServerApi = setupServer(...handlers);

export { server, rest };
4 changes: 2 additions & 2 deletions modules/unit-test-configs/__mocks__/style-file.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -17,7 +17,7 @@
*/

/**
* @fileoverview Mocks style files such as .css, .less, etc.
* Mocks style files such as .css, .less, etc.
*/

module.exports = {};
6 changes: 3 additions & 3 deletions modules/unit-test-configs/__mocks__/svgr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -17,8 +17,8 @@
*/

/**
* @fileoverview Mocks SVGs loaded with `SVGR` plugin.
* Mocks SVGs loaded with `SVGR` plugin.
*/

export default "SvgrURL";
export const ReactComponent = "div";
export const ReactComponent: string = "div";
6 changes: 3 additions & 3 deletions modules/unit-test-configs/__mocks__/window/document.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -17,7 +17,7 @@
*/

/**
* @fileoverview window.document Mocks.
* window.document Mocks.
*
* @remarks If you had to mock a certain document object,
* document the reason and any references clearly in this file.
Expand All @@ -28,7 +28,7 @@
* @see {@link https://github.com/jsdom/jsdom/issues/3002}
*/
document.createRange = () => {
const range = new Range();
const range: Range = new Range();

range.getBoundingClientRect = jest.fn();

Expand Down
2 changes: 1 addition & 1 deletion modules/unit-test-configs/__mocks__/window/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down
8 changes: 4 additions & 4 deletions modules/unit-test-configs/__mocks__/window/worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -17,7 +17,7 @@
*/

/**
* @fileoverview Worker API Mocks.
* Worker API Mocks.
*
* @remarks If you had to mock a certain Worker API,
* document the reason and any references clearly in this file.
Expand All @@ -31,14 +31,14 @@
* Mock Reference @see {@link https://github.com/facebook/jest/issues/3449#issuecomment-347337666}
*/
class WorkerMock {
constructor(stringUrl) {
constructor(stringUrl: string) {
// @ts-ignore
this.url = stringUrl;
// @ts-ignore
this.onmessage = () => { };
}

postMessage(msg) {
postMessage(msg: any) {
// @ts-ignore
this.onmessage(msg);
}
Expand Down

0 comments on commit 1d69244

Please sign in to comment.