8000 linter fixes · danimihalca/vscode-leetcode@3a1616f · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a1616f

Browse files
committed
linter fixes
1 parent 3585fb2 commit 3a1616f

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

src/commands/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function listProblems(): Promise<IProblem[]> {
3535
passRate: match[7].trim(),
3636
companies: companies[id] || ["Unknown"],
3737
tags: tags[id] || ["Unknown"],
38-
studyPlans: []
38+
studyPlans: [],
3939
});
4040
}
4141
}
@@ -46,7 +46,7 @@ export async function listProblems(): Promise<IProblem[]> {
4646
}
4747
}
4848

49-
export async function listStudyPlanProblems(studyPlan: string):Promise<any> {
49+
export async function listStudyPlanProblems(studyPlan: string): Promise<any> {
5050
if (leetCodeManager.getStatus() === UserStatus.SignedOut) {
5151
return [];
5252
}

src/explorer/LeetCodeNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT license.
33

44
import { Command, Uri } from "vscode";
5-
import { IProblem, ProblemState, StudyPlan } from "../shared";
5+
import { IProblem, IStudyPlan, ProblemState } from "../shared";
66

77
export class LeetCodeNode {
88

@@ -47,7 +47,7 @@ export class LeetCodeNode {
4747
return this.isProblemNode;
4848
}
4949

50-
public get studyPlans(): StudyPlan[] {
50+
public get studyPlans(): IStudyPlan[] {
5151
return this.data.studyPlans;
5252
}
5353

src/explorer/explorerNodeManager.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import * as _ from "lodash";
55
import { Disposable } from "vscode";
66
import * as list from "../commands/list";
77
import { getSortingStrategy } from "../commands/plugin";
8-
import { Category, defaultProblem, ProblemState, SortingStrategy } from "../shared";
8+
import { Category, defaultProblem, IStudyPlan, ProblemState, SortingStrategy } from "../shared";
99
import { shouldHideSolvedProblem } from "../utils/settingUtils";
1010
import { LeetCodeNode } from "./LeetCodeNode";
1111

1212
const studyPlansToSearch: string[] = [
13-
'top-interview-150',
14-
'binary-search',
15-
'top-sql-50',
16-
'leetcode-75'
13+
"top-interview-150",
14+
"binary-search",
15+
"top-sql-50",
16+
"leetcode-75",
1717
];
1818
// currently no GraphQL API exists to fetch them all, temporary alternative
1919

@@ -40,17 +40,16 @@ class ExplorerNodeManager implements Disposable {
4040
}
4141

4242
for (const plan of studyPlansToSearch) {
43-
let studyPlanResult = await list.listStudyPlanProblems(plan);
44-
const groupName = studyPlanResult.name;
43+
const studyPlanResult: any = await list.listStudyPlanProblems(plan);
44+
const groupName: string = studyPlanResult.name;
4545
this.studyPlans[groupName] = new Set<string>();
46-
console.log(this.explorerNodeMap.size);
4746
for (const subGroup of studyPlanResult.planSubGroups) {
48-
const subGroupName = subGroup.name;
47+
const subGroupName: string = subGroup.name;
4948
this.studyPlans[groupName].add(subGroupName);
5049

51-
for (let question of subGroup.questions) {
50+
for (const question of subGroup.questions) {
5251
const questionId: string = question.id;
53-
this.explorerNodeMap.get(questionId)?.studyPlans.push({group:groupName, subgroup:subGroupName});
52+
this.explorerNodeMap.get(questionId)?.studyPlans.push({group: groupName, subgroup: subGroupName});
5453
}
5554
}
5655
}
@@ -117,7 +116,7 @@ class ExplorerNodeManager implements Disposable {
117116
res.push(new LeetCodeNode(Object.assign({}, defaultProblem, {
118117
id: `${Category.StudyPlans}.${studyPlan}`,
119118
name: studyPlan,
120-
}), false))
119+
}), false));
121120
}
122121

123122
return res;
@@ -173,7 +172,7 @@ class ExplorerNodeManager implements Disposable {
173172
res.push(new LeetCodeNode(Object.assign({}, defaultProblem, {
174173
id: `${Category.StudyPlanSubgroup}.${metaInfo[1]}.${subgroup}`,
175174
name: subgroup,
176-
}), false))
175+
}), false));
177176
}
178177
}
179178
break;
@@ -201,10 +200,10 @@ class ExplorerNodeManager implements Disposable {
201200
break;
202201

203202
case Category.StudyPlanSubgroup:
204-
const group = metaInfo[1];
205-
const subgroup = metaInfo[2];
203+
const group: string = metaInfo[1];
204+
const subgroup: string = metaInfo[2];
206205

207-
if (node.studyPlans.find(e => e.group === group && e.subgroup === subgroup)) {
206+
if (node.studyPlans.find((e: IStudyPlan) => e.group === group && e.subgroup === subgroup)) {
208207
res.push(node);
209208
}
210209
break;

src/leetCodeExecutor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class LeetCodeExecutor implements Disposable {
2222
constructor() {
2323
this.leetCodeRootPath = path.join(__dirname, "..", "..", "node_modules", "@danimihalca", "vsc-leetcode-cli");
2424
this.nodeExecutable = this.getNodePath();
25-
console.log(this.nodeExecutable);
2625
this.configurationChangeListener = workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {
2726
if (event.affectsConfiguration("leetcode.nodePath")) {
2827
this.nodeExecutable = this.getNodePath();

src/shared.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export enum Endpoint {
7070
LeetCodeCN = "leetcode-cn",
7171
}
7272

73-
export interface StudyPlan {
74-
group: string,
75-
subgroup: string
73+
export interface IStudyPlan {
74+
group: string;
75+
subgroup: string;
7676
}
7777

7878
export interface IProblem {
@@ -85,7 +85,7 @@ export interface IProblem {
8585
passRate: string;
8686
companies: string[];
8787
tags: string[];
88-
studyPlans: StudyPlan[];
88+
studyPlans: IStudyPlan[];
8989
}
9090

9191
export const defaultProblem: IProblem = {
@@ -98,7 +98,7 @@ export const defaultProblem: IProblem = {
9898
passRate: "",
9999
companies: [] as string[],
100100
tags: [] as string[],
101-
studyPlans: [] as StudyPlan[]
101+
studyPlans: [] as IStudyPlan[],
102102
};
103103

104104
export enum Category {
@@ -108,7 +108,7 @@ export enum Category {
108108
Company = "Company",
109109
Favorite = "Favorite",
110110
StudyPlans = "Study Plans",
111-
StudyPlanSubgroup = "Study Plan Subgroup"
111+
StudyPlanSubgroup = "Study Plan Subgroup",
112112
}
113113

114114
export const supportedPlugins: string[] = [

0 commit comments

Comments
 (0)
0