diff --git a/.eslintrc.json b/.eslintrc.json index 3fb5522..77d55a8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,13 +8,35 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "off", "@typescript-eslint/semi": "warn", "curly": "warn", "eqeqeq": "warn", "no-throw-literal": "warn", - "semi": "off" + "semi": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_" + } + ], + "no-unused-vars": "off", + "no-useless-escape": "off", + "no-inner-declarations": "off", + "no-case-declarations": "off", + "@typescript-eslint/prefer-regexp-exec": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/unbound-method": "off", + "@typescript-eslint/no-unnecessary-type-assertion": "off", + "@typescript-eslint/restrict-template-expressions": "off", + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-explicit-any": "off" }, "ignorePatterns": [ "**/*.d.ts" diff --git a/src/appwrite/Database.ts b/src/appwrite/Database.ts index 908fe87..7d5be16 100644 --- a/src/appwrite/Database.ts +++ b/src/appwrite/Database.ts @@ -1,14 +1,12 @@ -import { Client, Collection, CreatedCollection, CreatedRule, DatabaseClient, Rule, SDK } from "../appwrite"; -import { CreateRuleWizardContext } from "../ui/createRuleWizard"; +import { Client, Collection, CreatedCollection, CreatedRule, DatabaseClient, Rule } from "../appwrite"; +import { AppwriteSDK } from '../constants'; import AppwriteCall from "../utils/AppwriteCall"; -const sdk: SDK = require("node-appwrite"); - export class Database { private readonly database: DatabaseClient; constructor(client: Client) { - this.database = new sdk.Database(client); + this.database = new AppwriteSDK.Database(client); } public async getCollection(collectionId: string): Promise { diff --git a/src/appwrite/Health.ts b/src/appwrite/Health.ts index 9792868..27cbc9b 100644 --- a/src/appwrite/Health.ts +++ b/src/appwrite/Health.ts @@ -1,12 +1,11 @@ import { MarkdownString } from 'vscode'; -import { AppwriteHealth, Client, HealthClient, SDK } from "../appwrite"; -const sdk: SDK = require("node-appwrite"); - +import { AppwriteHealth, Client, HealthClient } from "../appwrite"; +import { AppwriteSDK } from '../constants'; export class Health { private readonly health: HealthClient; constructor(client: Client) { - this.health = new sdk.Health(client); + this.health = new AppwriteSDK.Health(client); } /** diff --git a/src/appwrite/Storage.ts b/src/appwrite/Storage.ts index d987958..4ecb95d 100644 --- a/src/appwrite/Storage.ts +++ b/src/appwrite/Storage.ts @@ -1,14 +1,12 @@ -import { Client, Collection, CreatedCollection, CreatedRule, DatabaseClient, File, FilesList, Rule, SDK, StorageClient } from "../appwrite"; -import { CreateRuleWizardContext } from "../ui/createRuleWizard"; +import { Client, FilesList, StorageClient } from "../appwrite"; +import { AppwriteSDK } from '../constants'; import AppwriteCall from "../utils/AppwriteCall"; -const sdk: SDK = require("node-appwrite"); - export class Storage { private readonly storage: StorageClient; constructor(client: Client) { - this.storage = new sdk.Storage(client); + this.storage = new AppwriteSDK.Storage(client); } public async listFiles(): Promise { diff --git a/src/appwrite/Users.ts b/src/appwrite/Users.ts index 368c356..d178fc4 100644 --- a/src/appwrite/Users.ts +++ b/src/appwrite/Users.ts @@ -1,14 +1,13 @@ import { window } from "vscode"; -import { Client, Log, SDK, User, UsersClient } from "../appwrite"; -import { ext } from "../extensionVariables"; +import { Client, Log, User, UsersClient } from "../appwrite"; +import { AppwriteSDK } from "../constants"; import AppwriteCall from "../utils/AppwriteCall"; -const sdk: SDK = require("node-appwrite"); export class Users { private readonly users: UsersClient; constructor(client: Client) { - this.users = new sdk.Users(client); + this.users = new AppwriteSDK.Users(client); } public async createNewUser(context: CreateUserContext): Promise { await AppwriteCall(this.users.create(context.email, context.password, context.name), (user) => { @@ -23,7 +22,7 @@ export class Users { } public async getLogs(userId: string): Promise { - return await AppwriteCall(this.users.getLogs(userId)) ?? []; + return (await AppwriteCall(this.users.getLogs(userId))) ?? []; } } diff --git a/src/client.ts b/src/client.ts index ed9a65b..3313fcb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,12 +1,11 @@ -import { Client, SDK } from "./appwrite"; +import { Client } from "./appwrite"; import { Database } from "./appwrite/Database"; import { Health } from "./appwrite/Health"; import { Storage } from "./appwrite/Storage"; import { Users } from "./appwrite/Users"; +import { AppwriteSDK } from "./constants"; import { AppwriteProjectConfiguration } from "./settings"; -const sdk: SDK = require("node-appwrite"); - export let client: Client; export let clientConfig: { endpoint: string; projectId: string; secret: string }; export let usersClient: Users | undefined; @@ -15,7 +14,7 @@ export let databaseClient: Database | undefined; export let storageClient: Storage | undefined; function initAppwriteClient({ endpoint, projectId, secret }: AppwriteProjectConfiguration) { - client = new sdk.Client(); + client = new AppwriteSDK.Client(); clientConfig = { endpoint, projectId, secret }; client.setEndpoint(endpoint).setProject(projectId).setKey(secret); @@ -27,7 +26,7 @@ function initAppwriteClient({ endpoint, projectId, secret }: AppwriteProjectConf return client; } -export function createAppwriteClient(config?: AppwriteProjectConfiguration) { +export function createAppwriteClient(config?: AppwriteProjectConfiguration): void { if (config) { initAppwriteClient(config); return; diff --git a/src/commands/connectAppwrite.ts b/src/commands/connectAppwrite.ts index adb2e29..ee5b2df 100644 --- a/src/commands/connectAppwrite.ts +++ b/src/commands/connectAppwrite.ts @@ -3,7 +3,7 @@ import { addProjectConfiguration } from '../settings'; import { addProjectWizard } from "../ui/AddProjectWizard"; import { refreshTree } from '../utils/refreshTree'; -export async function connectAppwrite() { +export async function connectAppwrite(): Promise { const projectConfiguration = await addProjectWizard(); if (projectConfiguration) { addProjectConfiguration(projectConfiguration); diff --git a/src/commands/database/deleteDocument.ts b/src/commands/database/deleteDocument.ts index 221e948..996f72f 100644 --- a/src/commands/database/deleteDocument.ts +++ b/src/commands/database/deleteDocument.ts @@ -13,7 +13,7 @@ export async function deleteDocument(documentTreeItem: DocumentTreeItem): Promis const shouldDelete = await confirmDialog(`Delete document "${document["$id"]}" from ${collection.name}?`); if (shouldDelete) { await databaseClient.deleteDocument(collection.$id, document["$id"]); - documentTreeItem.parent.window.showInformationMessage(`Deleted document "${document["$id"]}" from ${collection.name}.`); + window.showInformationMessage(`Deleted document "${document["$id"]}" from ${collection.name}.`); } } catch (e) { window.showErrorMessage(e); diff --git a/src/commands/database/permissions/createPermission.ts b/src/commands/database/permissions/createPermission.ts index 18f0226..bd0929b 100644 --- a/src/commands/database/permissions/createPermission.ts +++ b/src/commands/database/permissions/createPermission.ts @@ -1,8 +1,6 @@ import { window } from "vscode"; import { databaseClient } from "../../../client"; -import { CollapsableTreeItem } from "../../../tree/CollapsableTreeItem"; import { PermissionsTreeItem } from "../../../tree/database/settings/PermissionsTreeItem"; -import { PermissionTreeItem } from "../../../tree/database/settings/PermissionTreeItem"; export type CreatePermissionWizardContext = { kind: "read" | "write"; diff --git a/src/commands/database/refreshCollection.ts b/src/commands/database/refreshCollection.ts index cc9aa34..6bf831f 100644 --- a/src/commands/database/refreshCollection.ts +++ b/src/commands/database/refreshCollection.ts @@ -1,5 +1,5 @@ import { CollectionTreeItem } from "../../tree/database/CollectionTreeItem"; -export async function refreshCollection(collectionTreeItem: CollectionTreeItem) { +export async function refreshCollection(collectionTreeItem: CollectionTreeItem): Promise { await collectionTreeItem.refresh(); } diff --git a/src/commands/project/addProject.ts b/src/commands/project/addProject.ts index 8a6e0a9..e024b97 100644 --- a/src/commands/project/addProject.ts +++ b/src/commands/project/addProject.ts @@ -2,7 +2,7 @@ import { window } from "vscode"; import { createAppwriteClient } from '../../client'; import { addProjectWizard } from "../../ui/AddProjectWizard"; -export async function addProject() { +export async function addProject(): Promise { const projectConfiguration = await addProjectWizard(); if (projectConfiguration) { diff --git a/src/commands/project/removeProject.ts b/src/commands/project/removeProject.ts index 6affe16..026cdd2 100644 --- a/src/commands/project/removeProject.ts +++ b/src/commands/project/removeProject.ts @@ -1,7 +1,7 @@ import { removeProjectConfig } from "../../settings"; import { ProjectTreeItem } from "../../tree/projects/ProjectTreeItem"; -export async function removeProject(project: ProjectTreeItem | string) { +export async function removeProject(project: ProjectTreeItem | string): Promise { if (typeof project === "string") { await removeProjectConfig(project); return; diff --git a/src/commands/project/setActiveProject.ts b/src/commands/project/setActiveProject.ts index ede1c01..e485efe 100644 --- a/src/commands/project/setActiveProject.ts +++ b/src/commands/project/setActiveProject.ts @@ -1,7 +1,7 @@ import { setActiveProjectId } from '../../settings'; import { ProjectTreeItem } from "../../tree/projects/ProjectTreeItem"; -export async function setActiveProject(treeItem: ProjectTreeItem) { +export async function setActiveProject(treeItem: ProjectTreeItem): Promise { if (treeItem === undefined) { return; } diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index c417423..624c50f 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -1,5 +1,5 @@ import { commands, ExtensionContext } from "vscode"; -import { AppwriteTree, ext } from "../extensionVariables"; +import { AppwriteTree } from "../extensionVariables"; import { refreshAllViews, refreshTree } from "../utils/refreshTree"; import { connectAppwrite } from "./connectAppwrite"; import { createCollection } from "./database/createCollection"; @@ -86,11 +86,11 @@ export function registerCommands(context: ExtensionContext): void { registerCommand("editPermission", editPermission, "database"); /** Health **/ - registerCommand("refreshHealth", () => {}, "health"); + registerCommand("refreshHealth", undefined, "health"); registerCommand("openHealthDocumentation", () => openDocumentation("health")); /** Storage **/ - registerCommand("refreshStorage", () => {}, "storage"); + registerCommand("refreshStorage", undefined, "storage"); registerCommand("openStorageDocumentation", () => openDocumentation("storage")); /** Projects **/ diff --git a/src/commands/users/openUserInConsole.ts b/src/commands/users/openUserInConsole.ts index b081e0f..7f2df30 100644 --- a/src/commands/users/openUserInConsole.ts +++ b/src/commands/users/openUserInConsole.ts @@ -12,7 +12,7 @@ function getUserUrl(userId: string, endpoint: string, projectId: string): string return `${getConsoleUrlFromEndpoint(endpoint)}/users/user?id=${userId}&project=${projectId}`; } -export async function openUserInConsole(item: UserTreeItem) { +export async function openUserInConsole(item: UserTreeItem): Promise { const url = getUserUrl(item.user.$id, clientConfig.endpoint, clientConfig.projectId); await commands.executeCommand("vscode.open", Uri.parse(url)); diff --git a/src/commands/users/refreshUsersList.ts b/src/commands/users/refreshUsersList.ts index 2352698..41b2822 100644 --- a/src/commands/users/refreshUsersList.ts +++ b/src/commands/users/refreshUsersList.ts @@ -1,5 +1,5 @@ import { ext } from "../../extensionVariables"; -export async function refreshUsersList() { +export async function refreshUsersList(): Promise { ext.tree?.users?.refresh(); } diff --git a/src/commands/users/viewUserPrefs.ts b/src/commands/users/viewUserPrefs.ts index b666c53..9bee815 100644 --- a/src/commands/users/viewUserPrefs.ts +++ b/src/commands/users/viewUserPrefs.ts @@ -2,7 +2,7 @@ import { UserPrefsTreeItem } from "../../tree/users/properties/UserPrefsTreeItem import { UserTreeItem } from '../../tree/users/UserTreeItem'; import { openReadOnlyJson } from "../../ui/openReadonlyContent"; -export async function viewUserPrefs(item: UserPrefsTreeItem | UserTreeItem) { +export async function viewUserPrefs(item: UserPrefsTreeItem | UserTreeItem): Promise { const userItem = item instanceof UserPrefsTreeItem ? item.parent : item; const prefs = userItem.user.prefs; diff --git a/src/constants.ts b/src/constants.ts index a057c27..34e9127 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,4 @@ import type { SDK } from './appwrite'; +// eslint-disable-next-line @typescript-eslint/no-var-requires export const AppwriteSDK: SDK = require('node-appwrite') as SDK; diff --git a/src/extension.ts b/src/extension.ts index c0273fb..50a0a39 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from "vscode"; import { createAppwriteClient } from "./client"; import { registerCommands } from "./commands/registerCommands"; import { ext } from "./extensionVariables"; -import { getActiveProjectConfiguration, getActiveProjectId, getDefaultProject } from "./settings"; +import { getActiveProjectConfiguration } from "./settings"; import { DatabaseTreeItemProvider } from "./tree/database/DatabaseTreeItemProvider"; import { HealthTreeItemProvider } from "./tree/health/HealthTreeItemProvider"; import { ProjectsTreeItemProvider } from "./tree/projects/ProjectsTreeItemProvider"; @@ -39,5 +39,3 @@ export async function activate(context: vscode.ExtensionContext): Promise registerCommands(context); } - -export function deactivate() {} diff --git a/src/extensionVariables.ts b/src/extensionVariables.ts index f647c09..b212359 100644 --- a/src/extensionVariables.ts +++ b/src/extensionVariables.ts @@ -1,4 +1,4 @@ -import { ExtensionContext, OutputChannel } from "vscode"; +import { ExtensionContext } from "vscode"; import { DatabaseTreeItemProvider } from './tree/database/DatabaseTreeItemProvider'; import { HealthTreeItemProvider } from './tree/health/HealthTreeItemProvider'; import { ProjectsTreeItemProvider } from './tree/projects/ProjectsTreeItemProvider'; diff --git a/src/tree/CollapsableTreeItem.ts b/src/tree/CollapsableTreeItem.ts index d2e7bd5..6eeeb7b 100644 --- a/src/tree/CollapsableTreeItem.ts +++ b/src/tree/CollapsableTreeItem.ts @@ -1,6 +1,5 @@ -import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; +import { TreeItem, TreeItemCollapsibleState } from "vscode"; import { AppwriteTreeItemBase } from "../ui/AppwriteTreeItemBase"; -import { ChildTreeItem } from "./ChildTreeItem"; export class CollapsableTreeItem extends AppwriteTreeItemBase { constructor(parent: Parent, item: Partial & { label: string }, private readonly children: TreeItem[], public readonly brand?: string) { diff --git a/src/tree/database/DatabaseTreeItemProvider.ts b/src/tree/database/DatabaseTreeItemProvider.ts index 46bbb0c..35dacff 100644 --- a/src/tree/database/DatabaseTreeItemProvider.ts +++ b/src/tree/database/DatabaseTreeItemProvider.ts @@ -1,7 +1,7 @@ import * as vscode from "vscode"; import { client } from "../../client"; import AppwriteCall from "../../utils/AppwriteCall"; -import { Collection, CollectionsList, DocumentsList } from "../../appwrite"; +import { Collection, CollectionsList } from "../../appwrite"; import { CollectionTreeItem } from "./CollectionTreeItem"; import { AppwriteSDK } from "../../constants"; import { AppwriteTreeItemBase } from "../../ui/AppwriteTreeItemBase"; @@ -14,8 +14,6 @@ export class DatabaseTreeItemProvider implements vscode.TreeDataProvider = this._onDidChangeTreeData.event; - constructor() {} - refresh(): void { ext.outputChannel?.appendLine('refresh database'); this._onDidChangeTreeData.fire(); @@ -39,7 +37,7 @@ export class DatabaseTreeItemProvider implements vscode.TreeDataProvider(databaseSdk.listCollections()); if (collectionsList) { diff --git a/src/tree/database/DocumentTreeItem.ts b/src/tree/database/DocumentTreeItem.ts index 3382ce6..fe420ee 100644 --- a/src/tree/database/DocumentTreeItem.ts +++ b/src/tree/database/DocumentTreeItem.ts @@ -3,6 +3,7 @@ import { ChildTreeItem } from '../ChildTreeItem'; import { DocumentsTreeItem } from './DocumentsTreeItem'; export class DocumentTreeItem extends ChildTreeItem { + // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(parent: DocumentsTreeItem, public readonly document: Record) { super(parent, { label: document['$id'], diff --git a/src/tree/database/DocumentsTreeItem.ts b/src/tree/database/DocumentsTreeItem.ts index 5fcfbd8..314c58c 100644 --- a/src/tree/database/DocumentsTreeItem.ts +++ b/src/tree/database/DocumentsTreeItem.ts @@ -9,13 +9,12 @@ import { CollectionTreeItem } from "./CollectionTreeItem"; import { DocumentTreeItem } from "./DocumentTreeItem"; export class DocumentsTreeItem extends AppwriteTreeItemBase { - window: any; constructor(parent: CollectionTreeItem) { super(parent, "Documents"); } public async getChildren(): Promise { - let databaseSdk = new AppwriteSDK.Database(client); + const databaseSdk = new AppwriteSDK.Database(client); const documentList = await AppwriteCall(databaseSdk.listDocuments(this.parent.collection.$id)); if (documentList === undefined) { return []; diff --git a/src/tree/database/settings/PermissionTreeItem.ts b/src/tree/database/settings/PermissionTreeItem.ts index 35ebfe1..d4c76a5 100644 --- a/src/tree/database/settings/PermissionTreeItem.ts +++ b/src/tree/database/settings/PermissionTreeItem.ts @@ -1,4 +1,3 @@ -import { AppwriteTreeItemBase } from "../../../ui/AppwriteTreeItemBase"; import { ChildTreeItem } from "../../ChildTreeItem"; import { PermissionsTreeItem } from "./PermissionsTreeItem"; diff --git a/src/tree/database/settings/RuleTreeItem.ts b/src/tree/database/settings/RuleTreeItem.ts index de58d36..7d635ac 100644 --- a/src/tree/database/settings/RuleTreeItem.ts +++ b/src/tree/database/settings/RuleTreeItem.ts @@ -1,4 +1,3 @@ -import { TreeItem } from "vscode"; import { Rule } from "../../../appwrite"; import { ChildTreeItem } from "../../ChildTreeItem"; import { RulesTreeItem } from "./RulesTreeItem"; diff --git a/src/tree/health/HealthTreeItem.ts b/src/tree/health/HealthTreeItem.ts index fb42c96..db9a53a 100644 --- a/src/tree/health/HealthTreeItem.ts +++ b/src/tree/health/HealthTreeItem.ts @@ -2,7 +2,7 @@ import * as vscode from "vscode"; import { MarkdownString } from 'vscode'; export class HealthTreeItem extends vscode.TreeItem { - constructor(public readonly label: string, status: any, tooltip?: string | MarkdownString | undefined) { + constructor(public readonly label: string, status: "check" | "error" | any, tooltip?: string | MarkdownString | undefined) { super(label); console.log(status); this.label = label; diff --git a/src/tree/health/HealthTreeItemProvider.ts b/src/tree/health/HealthTreeItemProvider.ts index 7752ce3..95970b3 100644 --- a/src/tree/health/HealthTreeItemProvider.ts +++ b/src/tree/health/HealthTreeItemProvider.ts @@ -3,15 +3,12 @@ import { healthClient } from "../../client"; import { ext } from "../../extensionVariables"; import { HealthTreeItem } from "./HealthTreeItem"; import * as dayjs from "dayjs"; -import * as relativeTime from "dayjs/plugin/relativeTime"; import * as localizedFormat from "dayjs/plugin/localizedFormat"; import { healthTooltips } from "../../appwrite/Health"; import { AppwriteHealth } from "../../appwrite"; // dayjs.extend(relativeTime); dayjs.extend(localizedFormat); -type PartialRecord = { [P in K]?: T }; - export class HealthTreeItemProvider implements vscode.TreeDataProvider { private _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter< HealthTreeItem | undefined | void @@ -21,8 +18,6 @@ export class HealthTreeItemProvider implements vscode.TreeDataProvider = this._onDidChangeTreeData.event; - constructor() {} - refresh(): void { this._onDidChangeTreeData.fire(); } diff --git a/src/tree/projects/ProjectsTreeItemProvider.ts b/src/tree/projects/ProjectsTreeItemProvider.ts index b6a27ca..b6922d7 100644 --- a/src/tree/projects/ProjectsTreeItemProvider.ts +++ b/src/tree/projects/ProjectsTreeItemProvider.ts @@ -1,6 +1,5 @@ import * as vscode from "vscode"; import { getActiveProjectId, getAppwriteProjects } from "../../settings"; -import { refreshTree } from "../../utils/refreshTree"; import { ProjectTreeItem } from "./ProjectTreeItem"; export class ProjectsTreeItemProvider implements vscode.TreeDataProvider { @@ -26,7 +25,7 @@ export class ProjectsTreeItemProvider implements vscode.TreeDataProvider { + async getChildren(_element?: vscode.TreeItem): Promise { const configs = await getAppwriteProjects(); if (configs === undefined || configs.length === 0) { return []; diff --git a/src/tree/storage/StorageTreeItemProvider.ts b/src/tree/storage/StorageTreeItemProvider.ts index 14a6dbf..42877c0 100644 --- a/src/tree/storage/StorageTreeItemProvider.ts +++ b/src/tree/storage/StorageTreeItemProvider.ts @@ -9,8 +9,6 @@ export class StorageTreeItemProvider implements vscode.TreeDataProvider = this._onDidChangeTreeData.event; - constructor() {} - refresh(): void { this._onDidChangeTreeData.fire(); } @@ -19,7 +17,7 @@ export class StorageTreeItemProvider implements vscode.TreeDataProvider { + async getChildren(_element?: vscode.TreeItem): Promise { if (storageClient === undefined) { return []; } diff --git a/src/tree/users/UserTreeItemProvider.ts b/src/tree/users/UserTreeItemProvider.ts index 799db46..f2d73ff 100644 --- a/src/tree/users/UserTreeItemProvider.ts +++ b/src/tree/users/UserTreeItemProvider.ts @@ -6,6 +6,7 @@ import { ThemeIcon } from "vscode"; import { UserPrefsTreeItem } from "./properties/UserPrefsTreeItem"; import { ChildTreeItem } from "../ChildTreeItem"; import { UserTreeItem } from "./UserTreeItem"; +// eslint-disable-next-line @typescript-eslint/no-var-requires const sdk = require("node-appwrite"); export class UserTreeItemProvider implements vscode.TreeDataProvider { @@ -15,8 +16,6 @@ export class UserTreeItemProvider implements vscode.TreeDataProvider = this._onDidChangeTreeData.event; - constructor() {} - refresh(): void { this._onDidChangeTreeData.fire(); } @@ -63,10 +62,10 @@ export class UserTreeItemProvider implements vscode.TreeDataProvider(usersSdk.list()); if (usersList) { - const userTreeItems = usersList.users.map((user: any) => new UserTreeItem(user)) ?? []; + const userTreeItems = usersList.users.map((user: User) => new UserTreeItem(user)) ?? []; const headerItem: vscode.TreeItem = { label: `Total users: ${usersList.sum}`, }; diff --git a/src/ui/AppwriteOutputChannel.ts b/src/ui/AppwriteOutputChannel.ts index 7d84cae..7437925 100644 --- a/src/ui/AppwriteOutputChannel.ts +++ b/src/ui/AppwriteOutputChannel.ts @@ -6,7 +6,7 @@ import { OutputChannel, ViewColumn, window, workspace, WorkspaceConfiguration } from "vscode"; // tslint:disable-next-line: export-name -export function createAppwriteOutputChannel(name: string, extensionPrefix: string) { +export function createAppwriteOutputChannel(name: string, extensionPrefix: string): AppwriteOutputChannel { return new AppwriteOutputChannel(name, extensionPrefix); } @@ -50,8 +50,8 @@ export class AppwriteOutputChannel { public show(preserveFocus?: boolean | undefined): void; public show(column?: ViewColumn | undefined, preserveFocus?: boolean | undefined): void; - // tslint:disable-next-line: no-any - public show(_column?: any, preserveFocus?: boolean | undefined): void { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + public show(_column?: unknown, preserveFocus?: boolean | undefined): void { this._outputChannel.show(preserveFocus); } diff --git a/src/ui/AppwriteTreeItemBase.ts b/src/ui/AppwriteTreeItemBase.ts index b78e118..00fd410 100644 --- a/src/ui/AppwriteTreeItemBase.ts +++ b/src/ui/AppwriteTreeItemBase.ts @@ -1,4 +1,4 @@ -import { TreeDataProvider, TreeItem } from "vscode"; +import { TreeItem } from "vscode"; export abstract class AppwriteTreeItemBase extends TreeItem { constructor(public readonly parent: Parent, label: string) { diff --git a/src/ui/BaseEditor.ts b/src/ui/BaseEditor.ts index 70dee73..ee60000 100644 --- a/src/ui/BaseEditor.ts +++ b/src/ui/BaseEditor.ts @@ -93,7 +93,7 @@ export abstract class BaseEditor implements vscode.Disposable { } private async updateEditor(data: string, textEditor?: vscode.TextEditor): Promise { - if (!!textEditor) { + if (textEditor) { await BaseEditor.writeToEditor(textEditor, data); this.ignoreSave = true; try { diff --git a/src/ui/createRuleWizard.ts b/src/ui/createRuleWizard.ts index bb3638d..3df637a 100644 --- a/src/ui/createRuleWizard.ts +++ b/src/ui/createRuleWizard.ts @@ -1,5 +1,4 @@ import { QuickPickItem, window } from "vscode"; -import { AppwriteProjectConfiguration } from "../settings"; export type CreateRuleWizardContext = { label: string;