diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-24 03:41:47 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-24 22:28:25 +0700 |
| commit | 85c3fc0431e7e75a41894d4669f6a46bbda5440b (patch) | |
| tree | 15b73a82e9eaaa9ac9f2558578c8d7610ad392cd /vfs/example.ts | |
| parent | 891a860299ac76739d59f46280cbed63ff07743e (diff) | |
| download | pakakeh.ts-85c3fc0431e7e75a41894d4669f6a46bbda5440b.tar.xz | |
all: fix all linter warnings from tsc and eslint
In this changes we introduce eslint as our linter for TypeScript and
update our tsconfig to be more strict.
The ".eslintrc.yaml" and "tsconfig.json" is taken from golang/website
repository [1].
[1]: https://cs.opensource.google/go/x/website
Diffstat (limited to 'vfs/example.ts')
| -rw-r--r-- | vfs/example.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/vfs/example.ts b/vfs/example.ts index f2bc91d..6c963d0 100644 --- a/vfs/example.ts +++ b/vfs/example.ts @@ -1,14 +1,14 @@ // SPDX-FileCopyrightText: 2021 M. Shulhan <ms@kilabit.info> // SPDX-License-Identifier: GPL-3.0-or-later -import { WuiVfs, WuiVfsNodeInterface } from "./vfs.js"; +import { WuiVfs, WuiVfsNodeInterface, WuiVfsOptions } from "./vfs.js"; import { WuiResponseInterface } from "../response.js"; interface PathNodeInterface { [key: string]: WuiVfsNodeInterface; } -let dummyfs: PathNodeInterface = { +const dummyfs: PathNodeInterface = { "/": { name: "/", path: "/", @@ -100,27 +100,27 @@ let dummyfs: PathNodeInterface = { }; async function main() { - let opts = { + const opts: WuiVfsOptions = { id: "vfs", - Open: Open, - OpenNode: OpenNode, + open: open, + openNode: openNode, }; - let wui_vfs = new WuiVfs(opts); - wui_vfs.OpenDir("/"); + const wuiVFS = new WuiVfs(opts); + wuiVFS.openDir("/"); } -async function Open( +async function open( path: string, - is_dir: boolean, + isDir: boolean, ): Promise<WuiResponseInterface> { - console.log("Open:", path, is_dir); - let res: WuiResponseInterface = { + console.log("Open:", path, isDir); + const res: WuiResponseInterface = { code: 200, message: "", }; - if (is_dir) { + if (isDir) { res.data = dummyfs[path]; return res; } @@ -158,10 +158,10 @@ async function Open( return res; } -async function OpenNode( +async function openNode( node: WuiVfsNodeInterface, ): Promise<WuiResponseInterface> { - return await Open(node.path, node.is_dir); + return await open(node.path, node.is_dir); } main(); |
