fixed eslint of Trigger.ts GithubOAuthService.ts etc (#1126)

This commit is contained in:
Sunil Kumar Yadav 2021-10-11 20:25:21 +05:30 committed by GitHub
parent ed1ffb692f
commit ff498b51e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 27 deletions

View File

@ -115,15 +115,10 @@ src/Explorer/Tree/ObjectId.ts
src/Explorer/Tree/ResourceTokenCollection.ts src/Explorer/Tree/ResourceTokenCollection.ts
src/Explorer/Tree/StoredProcedure.ts src/Explorer/Tree/StoredProcedure.ts
src/Explorer/Tree/TreeComponents.ts src/Explorer/Tree/TreeComponents.ts
src/Explorer/Tree/Trigger.ts
src/Explorer/WaitsForTemplateViewModel.ts src/Explorer/WaitsForTemplateViewModel.ts
src/GitHub/GitHubClient.test.ts src/GitHub/GitHubClient.test.ts
src/GitHub/GitHubClient.ts src/GitHub/GitHubClient.ts
src/GitHub/GitHubConnector.ts
src/GitHub/GitHubOAuthService.ts
src/Index.ts src/Index.ts
src/Juno/JunoClient.test.ts
src/Juno/JunoClient.ts
src/Platform/Hosted/Authorization.ts src/Platform/Hosted/Authorization.ts
src/ReactDevTools.ts src/ReactDevTools.ts
src/Shared/Constants.ts src/Shared/Constants.ts

View File

@ -39,7 +39,6 @@ module.exports = {
"@typescript-eslint/switch-exhaustiveness-check": "error", "@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-extraneous-class": "error", "@typescript-eslint/no-extraneous-class": "error",
"no-null/no-null": "error",
"@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/no-explicit-any": "error",
"prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }], "prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }],
eqeqeq: "error", eqeqeq: "error",

View File

@ -22,6 +22,7 @@ export default class Trigger {
public triggerType: ko.Observable<string>; public triggerType: ko.Observable<string>;
public triggerOperation: ko.Observable<string>; public triggerOperation: ko.Observable<string>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(container: Explorer, collection: ViewModels.Collection, data: any) { constructor(container: Explorer, collection: ViewModels.Collection, data: any) {
this.nodeKind = "Trigger"; this.nodeKind = "Trigger";
this.container = container; this.container = container;
@ -34,7 +35,7 @@ export default class Trigger {
this.triggerType = ko.observable(data.triggerType); this.triggerType = ko.observable(data.triggerType);
} }
public select() { public select(): void {
useSelectedNode.getState().setSelectedNode(this); useSelectedNode.getState().setSelectedNode(this);
TelemetryProcessor.trace(Action.SelectItem, ActionModifiers.Mark, { TelemetryProcessor.trace(Action.SelectItem, ActionModifiers.Mark, {
description: "Trigger node", description: "Trigger node",
@ -43,7 +44,8 @@ export default class Trigger {
}); });
} }
public static create(source: ViewModels.Collection, event: MouseEvent) { // eslint-disable-next-line @typescript-eslint/no-unused-vars
public static create(source: ViewModels.Collection, _event: MouseEvent): void {
const id = useTabs.getState().getTabs(ViewModels.CollectionTabKind.Triggers).length + 1; const id = useTabs.getState().getTabs(ViewModels.CollectionTabKind.Triggers).length + 1;
const trigger = <StoredProcedureDefinition>{ const trigger = <StoredProcedureDefinition>{
id: "", id: "",
@ -99,7 +101,7 @@ export default class Trigger {
} }
}; };
public delete() { public delete(): void {
useDialog.getState().showOkCancelModalDialog( useDialog.getState().showOkCancelModalDialog(
"Confirm delete", "Confirm delete",
"Are you sure you want to delete the trigger?", "Are you sure you want to delete the trigger?",
@ -110,7 +112,8 @@ export default class Trigger {
useTabs.getState().closeTabsByComparator((tab) => tab.node && tab.node.rid === this.rid); useTabs.getState().closeTabsByComparator((tab) => tab.node && tab.node.rid === this.rid);
this.collection.children.remove(this); this.collection.children.remove(this);
}, },
(reason) => {} // eslint-disable-next-line @typescript-eslint/no-empty-function
() => {}
); );
}, },
"Cancel", "Cancel",

View File

@ -64,7 +64,7 @@ export class GitHubOAuthService {
return params.state; return params.state;
} }
public async finishOAuth(params: IGitHubConnectorParams) { public async finishOAuth(params: IGitHubConnectorParams): Promise<void> {
try { try {
this.validateState(params.state); this.validateState(params.state);
const response = await this.junoClient.getGitHubToken(params.code); const response = await this.junoClient.getGitHubToken(params.code);
@ -113,7 +113,7 @@ export class GitHubOAuthService {
return this.state; return this.state;
} }
public resetToken() { public resetToken(): void {
this.token(undefined); this.token(undefined);
} }

View File

@ -50,7 +50,8 @@ describe("Pinned repos", () => {
}); });
it("updatePinnedRepos invokes pinned repos subscribers", async () => { it("updatePinnedRepos invokes pinned repos subscribers", async () => {
const callback = jest.fn().mockImplementation((pinnedRepos: IPinnedRepo[]) => {}); // eslint-disable-next-line @typescript-eslint/no-empty-function
const callback = jest.fn().mockImplementation(() => {});
junoClient.subscribeToPinnedRepos(callback); junoClient.subscribeToPinnedRepos(callback);
const response = await junoClient.updatePinnedRepos(samplePinnedRepos); const response = await junoClient.updatePinnedRepos(samplePinnedRepos);
@ -60,7 +61,8 @@ describe("Pinned repos", () => {
}); });
it("getPinnedRepos invokes pinned repos subscribers", async () => { it("getPinnedRepos invokes pinned repos subscribers", async () => {
const callback = jest.fn().mockImplementation((pinnedRepos: IPinnedRepo[]) => {}); // eslint-disable-next-line @typescript-eslint/no-empty-function
const callback = jest.fn().mockImplementation(() => {});
junoClient.subscribeToPinnedRepos(callback); junoClient.subscribeToPinnedRepos(callback);
const response = await junoClient.getPinnedRepos("scope"); const response = await junoClient.getPinnedRepos("scope");
@ -153,7 +155,7 @@ describe("Gallery", () => {
it("getSampleNotebooks", async () => { it("getSampleNotebooks", async () => {
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.getSampleNotebooks(); const response = await junoClient.getSampleNotebooks();
@ -165,7 +167,7 @@ describe("Gallery", () => {
it("getPublicNotebooks", async () => { it("getPublicNotebooks", async () => {
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.getPublicNotebooks(); const response = await junoClient.getPublicNotebooks();
@ -178,7 +180,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.getNotebookInfo(id); const response = await junoClient.getNotebookInfo(id);
@ -191,7 +193,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
text: () => undefined as any, text: () => undefined as undefined,
}); });
const response = await junoClient.getNotebookContent(id); const response = await junoClient.getNotebookContent(id);
@ -204,7 +206,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.increaseNotebookViews(id); const response = await junoClient.increaseNotebookViews(id);
@ -218,7 +220,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.increaseNotebookDownloadCount(id); const response = await junoClient.increaseNotebookDownloadCount(id);
@ -243,7 +245,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.favoriteNotebook(id); const response = await junoClient.favoriteNotebook(id);
@ -268,7 +270,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.unfavoriteNotebook(id); const response = await junoClient.unfavoriteNotebook(id);
@ -292,7 +294,7 @@ describe("Gallery", () => {
it("getFavoriteNotebooks", async () => { it("getFavoriteNotebooks", async () => {
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.getFavoriteNotebooks(); const response = await junoClient.getFavoriteNotebooks();
@ -315,7 +317,7 @@ describe("Gallery", () => {
it("getPublishedNotebooks", async () => { it("getPublishedNotebooks", async () => {
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.getPublishedNotebooks(); const response = await junoClient.getPublishedNotebooks();
@ -339,7 +341,7 @@ describe("Gallery", () => {
const id = "id"; const id = "id";
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.deleteNotebook(id); const response = await junoClient.deleteNotebook(id);
@ -369,7 +371,7 @@ describe("Gallery", () => {
const addLinkToNotebookViewer = true; const addLinkToNotebookViewer = true;
window.fetch = jest.fn().mockReturnValue({ window.fetch = jest.fn().mockReturnValue({
status: HttpStatusCodes.OK, status: HttpStatusCodes.OK,
json: () => undefined as any, json: () => undefined as undefined,
}); });
const response = await junoClient.publishNotebook(name, description, tags, thumbnailUrl, content); const response = await junoClient.publishNotebook(name, description, tags, thumbnailUrl, content);

View File

@ -62,7 +62,7 @@ export interface IPublishNotebookRequest {
description: string; description: string;
tags: string[]; tags: string[];
thumbnailUrl: string; thumbnailUrl: string;
content: any; content: unknown;
addLinkToNotebookViewer: boolean; addLinkToNotebookViewer: boolean;
} }