Reduce lint errors
This commit is contained in:
+3
-3
@@ -10,9 +10,9 @@ const pagePrefix = "💭 ";
|
||||
|
||||
export async function readFileCloud(
|
||||
name: string,
|
||||
encoding: FileEncoding,
|
||||
_encoding: FileEncoding,
|
||||
): Promise<{ data: FileData; meta: FileMeta } | undefined> {
|
||||
let originalUrl = name.substring(
|
||||
const originalUrl = name.substring(
|
||||
pagePrefix.length,
|
||||
name.length - ".md".length,
|
||||
);
|
||||
@@ -27,7 +27,7 @@ export async function readFileCloud(
|
||||
}
|
||||
let text = "";
|
||||
try {
|
||||
let r = await fetch(`${url}.md`);
|
||||
const r = await fetch(`${url}.md`);
|
||||
text = await r.text();
|
||||
if (r.status !== 200) {
|
||||
text = `ERROR: ${text}`;
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import {
|
||||
system,
|
||||
} from "$sb/silverbullet-syscall/mod.ts";
|
||||
|
||||
import { events, store } from "$sb/plugos-syscall/mod.ts";
|
||||
import { events } from "$sb/plugos-syscall/mod.ts";
|
||||
|
||||
import {
|
||||
addParentPointers,
|
||||
@@ -67,7 +67,7 @@ export async function pageQueryProvider({
|
||||
for (const { page, value } of await index.queryPrefix("meta:")) {
|
||||
const p = allPageMap.get(page);
|
||||
if (p) {
|
||||
for (let [k, v] of Object.entries(value)) {
|
||||
for (const [k, v] of Object.entries(value)) {
|
||||
p[k] = v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function queryProvider({
|
||||
for (const { page, value } of await index.queryPrefix("meta:")) {
|
||||
const p = allPageMap.get(page);
|
||||
if (p) {
|
||||
for (let [k, v] of Object.entries(value)) {
|
||||
for (const [k, v] of Object.entries(value)) {
|
||||
p[k] = v;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ export function extractMeta(
|
||||
if (t.type === "Hashtag") {
|
||||
// Check if if nested directly into a Paragraph
|
||||
if (t.parent && t.parent.type === "Paragraph") {
|
||||
let tagname = t.children![0].text;
|
||||
const tagname = t.children![0].text;
|
||||
if (!data.tags) {
|
||||
data.tags = [];
|
||||
}
|
||||
|
||||
+7
-7
@@ -2,11 +2,11 @@ const maxWidth = 70;
|
||||
// Nicely format an array of JSON objects as a Markdown table
|
||||
export function jsonToMDTable(
|
||||
jsonArray: any[],
|
||||
valueTransformer: (k: string, v: any) => string = (k, v) => "" + v,
|
||||
valueTransformer: (k: string, v: any) => string = (_k, v) => "" + v,
|
||||
): string {
|
||||
const fieldWidths = new Map<string, number>();
|
||||
for (let entry of jsonArray) {
|
||||
for (let k of Object.keys(entry)) {
|
||||
for (const entry of jsonArray) {
|
||||
for (const k of Object.keys(entry)) {
|
||||
let fieldWidth = fieldWidths.get(k);
|
||||
if (!fieldWidth) {
|
||||
fieldWidth = valueTransformer(k, entry[k]).length;
|
||||
@@ -18,7 +18,7 @@ export function jsonToMDTable(
|
||||
}
|
||||
|
||||
let fullWidth = 0;
|
||||
for (let v of fieldWidths.values()) {
|
||||
for (const v of fieldWidths.values()) {
|
||||
fullWidth += v + 1;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ export function jsonToMDTable(
|
||||
"|",
|
||||
);
|
||||
for (const val of jsonArray) {
|
||||
let el = [];
|
||||
for (let prop of headerList) {
|
||||
let s = valueTransformer(prop, val[prop]);
|
||||
const el = [];
|
||||
for (const prop of headerList) {
|
||||
const s = valueTransformer(prop, val[prop]);
|
||||
el.push(s + charPad(" ", fieldWidths.get(prop)! - s.length));
|
||||
}
|
||||
lines.push("|" + el.join("|") + "|");
|
||||
|
||||
+3
-4
@@ -11,7 +11,6 @@ import {
|
||||
space,
|
||||
} from "$sb/silverbullet-syscall/mod.ts";
|
||||
|
||||
import { events } from "$sb/plugos-syscall/mod.ts";
|
||||
import {
|
||||
addParentPointers,
|
||||
collectNodesMatching,
|
||||
@@ -178,7 +177,7 @@ export async function postponeCommand() {
|
||||
if (!option) {
|
||||
return;
|
||||
}
|
||||
let d = new Date(date);
|
||||
const d = new Date(date);
|
||||
switch (option.name) {
|
||||
case "a day":
|
||||
d.setDate(d.getDate() + 1);
|
||||
@@ -207,8 +206,8 @@ export async function queryProvider({
|
||||
query,
|
||||
}: QueryProviderEvent): Promise<Task[]> {
|
||||
const allTasks: Task[] = [];
|
||||
for (let { key, page, value } of await index.queryPrefix("task:")) {
|
||||
let [, pos] = key.split(":");
|
||||
for (const { key, page, value } of await index.queryPrefix("task:")) {
|
||||
const pos = key.split(":")[1];
|
||||
allTasks.push({
|
||||
...value,
|
||||
page: page,
|
||||
|
||||
Reference in New Issue
Block a user