Skip to content

Commit 5ebea51

Browse files
authored
Merge pull request #185 from intersystems-community/linter
Just solved a few linting issues
2 parents 7c940e2 + 351e27a commit 5ebea51

File tree

10 files changed

+28
-14
lines changed

10 files changed

+28
-14
lines changed

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"kind": "build"
2222
},
2323
"isBackground": true,
24-
"problemMatcher": "$tsc-watch"
24+
"problemMatcher": "$eslint-stylish"
2525
}
2626
]
2727
}

src/debug/debugAdapterFactory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import net = require("net");
22
import vscode = require("vscode");
33
import { ObjectScriptDebugSession } from "./debugSession";
44

5-
export class ObjectScriptDebugAdapterDescriptorFactory implements vscode.DebugAdapterDescriptorFactory {
5+
export class ObjectScriptDebugAdapterDescriptorFactory
6+
implements vscode.DebugAdapterDescriptorFactory, vscode.Disposable {
67
private server?: net.Server;
78

89
public createDebugAdapterDescriptor(
@@ -26,7 +27,7 @@ export class ObjectScriptDebugAdapterDescriptorFactory implements vscode.DebugAd
2627
return new vscode.DebugAdapterServer(port);
2728
}
2829

29-
public dispose() {
30+
public dispose(): void {
3031
if (this.server) {
3132
this.server.close();
3233
}

src/explorer/models/nodeBase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class NodeBase {
4545
};
4646
}
4747

48-
public async getChildren(element): Promise<NodeBase[]> {
48+
public async getChildren(element: NodeBase): Promise<NodeBase[]> {
4949
return [];
5050
}
5151

src/explorer/models/packageNode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as vscode from "vscode";
22
import { RootNode } from "./rootNode";
3+
import { NodeOptions } from "./nodeBase";
34

45
export class PackageNode extends RootNode {
5-
public constructor(label: string, fullName: string, category: string, options) {
6+
public constructor(label: string, fullName: string, category: string, options: NodeOptions) {
67
super(label, fullName, "dataNode:packageNode", category, options);
78
}
89

src/explorer/models/rootNode.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PackageNode } from "./packageNode";
55
import { RoutineNode } from "./routineNode";
66
import { AtelierAPI } from "../../api";
77
import { ClassNode } from "./classesNode";
8+
import { StudioOpenDialog } from "../../queries";
89

910
export class RootNode extends NodeBase {
1011
public readonly contextValue: string;
@@ -37,12 +38,12 @@ export class RootNode extends NodeBase {
3738
};
3839
}
3940

40-
public async getChildren(element): Promise<NodeBase[]> {
41+
public async getChildren(element: NodeBase): Promise<NodeBase[]> {
4142
const path = this instanceof PackageNode || this.isCsp ? this.fullName + "/" : "";
4243
return this.getItems(path, this._category);
4344
}
4445

45-
public getList(path: string, category: string, flat: boolean) {
46+
public getList(path: string, category: string, flat: boolean): Promise<(StudioOpenDialog & { fullName: string })[]> {
4647
const sql = "CALL %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?)";
4748
// const sql = "CALL %Library.RoutineMgr_StudioOpenDialog(?,,,,,,?)";
4849
let spec = "";
@@ -86,7 +87,7 @@ export class RootNode extends NodeBase {
8687
return content;
8788
})
8889
.then((data) =>
89-
data.map((el) => {
90+
data.map((el: StudioOpenDialog) => {
9091
let fullName = el.Name;
9192
if (this instanceof PackageNode) {
9293
fullName = this.fullName + "." + el.Name;

src/explorer/models/workspaceNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class WorkspaceNode extends NodeBase {
2222
};
2323
}
2424

25-
public async getChildren(element): Promise<NodeBase[]> {
25+
public async getChildren(element: NodeBase): Promise<NodeBase[]> {
2626
const children = [];
2727
let node: RootNode;
2828

src/providers/FileSystemPovider/FileSystemProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as url from "url";
44
import { AtelierAPI } from "../../api";
55
import { Directory } from "./Directory";
66
import { File } from "./File";
7+
import { StudioOpenDialog } from "../../queries";
78

89
export type Entry = File | Directory;
910

@@ -55,7 +56,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
5556
.actionQuery(sql, [spec, dir, orderBy, system, flat, notStudio, generated])
5657
.then((data) => data.result.content || [])
5758
.then((data) =>
58-
data.map((item) => {
59+
data.map((item: StudioOpenDialog) => {
5960
const name = item.Name;
6061
const fullName = folder === "" ? name : folder + "/" + name;
6162
if (item.Type === "10" || item.Type === "9") {

src/providers/ObjectScriptCompletionItemProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
203203
});
204204
}
205205

206-
public listSystemVariables(search: string) {
206+
public listSystemVariables(search: string): vscode.CompletionItem[] {
207207
return systemVariables
208208
.filter((el) => el.label.startsWith(search) || el.alias.findIndex((el2) => el2.startsWith(search)) >= 0)
209209
.map((el) => {
@@ -217,7 +217,7 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
217217
});
218218
}
219219

220-
public listStructuredSystemVariables(search: string, open = false) {
220+
public listStructuredSystemVariables(search: string, open = false): vscode.CompletionItem[] {
221221
return structuredSystemVariables.map((el) => {
222222
return {
223223
...el,
@@ -436,7 +436,7 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
436436
position: vscode.Position,
437437
token: vscode.CancellationToken,
438438
context: vscode.CompletionContext
439-
) {
439+
): vscode.ProviderResult<vscode.CompletionItem[] | vscode.CompletionList> {
440440
const range = document.getWordRangeAtPosition(position, /\$system(\.\b\w+\b)?(\.\b\w+\b)?\./i);
441441
const text = range ? document.getText(range) : "";
442442
const [, className] = text.match(/\$system(\.\b\w+\b)?(\.\b\w+\b)?\./i);

src/providers/WorkspaceSymbolProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
33
import { ClassDefinition } from "../utils/classDefinition";
44
import { DocumentContentProvider } from "./DocumentContentProvider";
5+
import { StudioOpenDialog } from "../queries";
56

67
export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
78
public provideWorkspaceSymbols(
@@ -48,7 +49,7 @@ export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
4849
const generated = "0";
4950

5051
const data = await api.actionQuery(sql, [query, direction, orderBy, systemFiles, flat, notStudio, generated]);
51-
return data.result.content.map(({ Name }) => ({
52+
return data.result.content.map(({ Name }: StudioOpenDialog) => ({
5253
kind: vscode.SymbolKind.File,
5354
location: {
5455
uri: DocumentContentProvider.getUri(Name),

src/queries.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface StudioOpenDialog {
2+
Name: string;
3+
IsDirectory: string;
4+
Type: string;
5+
Size: string;
6+
Date: string;
7+
Description: string;
8+
IconType: string;
9+
}

0 commit comments

Comments
 (0)