Convert JSON file indents to tabs

Be consistent with the usage of tabs as indents in all JSON files in the
project.  This makes it easier to configure editors to emit the right
indents when manually editing these files.
This commit is contained in:
Hornwitser committed 2023-11-25 18:19:15 +01:00
1 parent 702c323610
commit 87e52b804e
37 files changed
+596 -596

No files matched your search

+2 -2
View File
@@ -78,7 +78,7 @@ export async function loadJsonAsMap(filePath: string): Promise<Map<string, unkno
*/
export async function saveMapAsJson(filePath: string, map: Map<string, unknown>) {
let obj = mapToObject(map);
await libFileOps.safeOutputFile(filePath, JSON.stringify(obj, null, 4));
await libFileOps.safeOutputFile(filePath, JSON.stringify(obj, null, "\t"));
}
/**
@@ -138,7 +138,7 @@ export async function loadJsonArrayAsMap(filePath: string): Promise<Map<unknown,
* @throws {Error} if an error occured writing to the file.
*/
export async function saveMapAsJsonArray(filePath: string, map: Map<unknown, { id: unknown }>) {
await libFileOps.safeOutputFile(filePath, JSON.stringify([...map.values()], null, 4));
await libFileOps.safeOutputFile(filePath, JSON.stringify([...map.values()], null, "\t"));
}
+1 -1
View File
@@ -159,7 +159,7 @@ export abstract class WebSocketBaseConnector extends BaseConnector {
}
if (!libData.Message.validate(json)) {
logger.error(`Received malformed message: ${text}`);
// logger.error(JSON.stringify(libData.Message.validate.errors, null, 4));
// logger.error(JSON.stringify(libData.Message.validate.errors, null, "\t"));
this.close(4000, "Malformed message");
return undefined;
}
+3 -3
View File
@@ -109,7 +109,7 @@ export class Link {
if (err instanceof libErrors.InvalidMessage) {
logger.error(err.message);
if (err.errors) {
logger.error(JSON.stringify(err.errors, null, 4));
logger.error(JSON.stringify(err.errors, null, "\t"));
}
} else {
@@ -364,7 +364,7 @@ export class Link {
response = handler(entry.requestFromJSON(message.data), message.src, message.dst);
} catch (err: any) {
if (err.errors) {
logger.error(JSON.stringify(err.errors, null, 4));
logger.error(JSON.stringify(err.errors, null, "\t"));
}
this.connector.sendResponseError(
new libData.ResponseError(err.message, err.code, err.stack), message.src
@@ -392,7 +392,7 @@ export class Link {
if (err instanceof libErrors.InvalidMessage) {
logger.error(err.message);
if (err.errors) {
logger.error(JSON.stringify(err.errors, null, 4));
logger.error(JSON.stringify(err.errors, null, "\t"));
}
} else if (!(err instanceof libErrors.RequestError)) {
logger.error(`Unexpected error responding to ${message.name}:\n${err.stack}`);
+1 -1
View File
@@ -306,7 +306,7 @@ export class LogIndex {
async save() {
await libFileOps.safeOutputFile(
path.join(this.logDirectory, "index.json"),
JSON.stringify(this.serialize(), null, 4)
JSON.stringify(this.serialize(), null, "\t")
);
}
+3 -3
View File
@@ -73,7 +73,7 @@ export async function handlePluginCommand(
}
pluginList.set(pluginInfo.name, pluginPath);
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, "\t"));
print(`Added ${pluginInfo.name}`);
} else if (command === "remove") {
@@ -83,7 +83,7 @@ export async function handlePluginCommand(
return;
}
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, "\t"));
print(`Removed ${args.name}`);
} else if (command === "list") {
@@ -162,7 +162,7 @@ export async function handleConfigCommand(
try {
instance.set(args.field as string, args.value);
await libFileOps.safeOutputFile(configPath, JSON.stringify(instance.serialize(), null, 4));
await libFileOps.safeOutputFile(configPath, JSON.stringify(instance.serialize(), null, "\t"));
} catch (err) {
if (err instanceof libConfig.InvalidField || err instanceof libConfig.InvalidValue) {
logger.error(err.message);