From f6c2f3072fdce44e4c83cd98356581dd4c25b802 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Sun, 3 Jul 2022 22:51:55 -0400 Subject: [PATCH 1/5] fixes for schema.json --- .vscode/settings.json | 8 ++++++++ scripts/generate_options_schema.js | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index bb69beb90..56b83c0d8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,22 @@ { + "files.associations": { + "tsdoc.json": "jsonc", // TSDoc allows comments. + "typedoc.json": "jsonc" // TypeDoc uses the JSONC parser for its configuration files. + }, + "typescript.tsdk": "./node_modules/typescript/lib", + "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "prettier.enable": true, "prettier.configPath": ".config/.prettierrc.json", "prettier.ignorePath": ".config/.prettierignore", + "eslint.workingDirectories": [".", "./example"], "mochaExplorer.configFile": ".config/mocha.test-explorer.json", "cSpell.words": ["cname", "tsbuildinfo", "tsdoc"] diff --git a/scripts/generate_options_schema.js b/scripts/generate_options_schema.js index 6929bf8eb..83ac0f152 100644 --- a/scripts/generate_options_schema.js +++ b/scripts/generate_options_schema.js @@ -13,8 +13,13 @@ const schema = { title: "JSON Schema for typedoc.json", type: "object", properties: {}, + allowTrailingCommas: true, }; +function lowerCaseFirstLetter(string) { + return string.charAt(0).toLowerCase() + string.slice(1); +} + addTypeDocOptions({ /** @param {import("../dist").DeclarationOption} option */ addDeclaration(option) { @@ -72,8 +77,8 @@ addTypeDocOptions({ ).map; data.enum = map instanceof Map - ? [...map.keys()] - : Object.keys(map).filter((key) => isNaN(+key)); + ? [...map.keys()].map(lowerCaseFirstLetter) + : Object.keys(map).filter((key) => isNaN(+key)).map(lowerCaseFirstLetter); data.default = /** @type {import("../dist").MapDeclarationOption} */ ( option From cc763d96efd13fc82457971c9a8be7148ae599b5 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Sun, 3 Jul 2022 22:55:07 -0400 Subject: [PATCH 2/5] prettier --- scripts/generate_options_schema.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/generate_options_schema.js b/scripts/generate_options_schema.js index 83ac0f152..3d7bedc1e 100644 --- a/scripts/generate_options_schema.js +++ b/scripts/generate_options_schema.js @@ -78,7 +78,9 @@ addTypeDocOptions({ data.enum = map instanceof Map ? [...map.keys()].map(lowerCaseFirstLetter) - : Object.keys(map).filter((key) => isNaN(+key)).map(lowerCaseFirstLetter); + : Object.keys(map) + .filter((key) => isNaN(+key)) + .map(lowerCaseFirstLetter); data.default = /** @type {import("../dist").MapDeclarationOption} */ ( option From 6b47a88931f21f4e84b82810928b6b8d1c963c36 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Mon, 4 Jul 2022 10:54:15 -0400 Subject: [PATCH 3/5] adding auto format to settings.json --- .vscode/settings.json | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 56b83c0d8..dc74b5984 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,11 +6,31 @@ "typescript.tsdk": "./node_modules/typescript/lib", + // Automatically run the formatter when certain files are saved. + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.tabSize": 4 + }, "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.tabSize": 4 }, "[typescriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.tabSize": 4 + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.tabSize": 4 + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.tabSize": 4 }, "prettier.enable": true, From 0a8ea14850633110f134f41787dc25423c6710ef Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:16:47 -0400 Subject: [PATCH 4/5] Update scripts/generate_options_schema.js Co-authored-by: Gerrit Birkeland --- scripts/generate_options_schema.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/generate_options_schema.js b/scripts/generate_options_schema.js index 3d7bedc1e..22a7fcf92 100644 --- a/scripts/generate_options_schema.js +++ b/scripts/generate_options_schema.js @@ -77,10 +77,12 @@ addTypeDocOptions({ ).map; data.enum = map instanceof Map - ? [...map.keys()].map(lowerCaseFirstLetter) + ? [...map.values()] : Object.keys(map) .filter((key) => isNaN(+key)) - .map(lowerCaseFirstLetter); + .map((key) => + typeof map[key] === "number" ? key : map[key] + ); data.default = /** @type {import("../dist").MapDeclarationOption} */ ( option From 5277942a0bac689f79af553cd13bd60fe69f672b Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:19:33 -0400 Subject: [PATCH 5/5] cleanup unused function --- scripts/generate_options_schema.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/generate_options_schema.js b/scripts/generate_options_schema.js index 22a7fcf92..11c66b77f 100644 --- a/scripts/generate_options_schema.js +++ b/scripts/generate_options_schema.js @@ -16,10 +16,6 @@ const schema = { allowTrailingCommas: true, }; -function lowerCaseFirstLetter(string) { - return string.charAt(0).toLowerCase() + string.slice(1); -} - addTypeDocOptions({ /** @param {import("../dist").DeclarationOption} option */ addDeclaration(option) {