From de8459cc71c9820b741af847bec955467630704e Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Sat, 27 Apr 2024 13:40:31 -0400 Subject: [PATCH 1/3] add prettier config --- src/prettier.config.cjs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/prettier.config.cjs diff --git a/src/prettier.config.cjs b/src/prettier.config.cjs new file mode 100644 index 0000000..529c631 --- /dev/null +++ b/src/prettier.config.cjs @@ -0,0 +1,33 @@ +const overrides = [ + { + files: ['*.yml', '*.yaml'], + options: { + tabWidth: 2, + }, + }, + { + files: 'tsconfig.json', + options: { + parser: 'json', + }, + }, +]; + +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: true, + htmlWhitespaceSensitivity: 'css', + insertPragma: false, + jsxSingleQuote: false, + overrides, + printWidth: 160, + proseWrap: 'preserve', + quoteProps: 'as-needed', + requirePragma: false, + semi: true, + singleQuote: true, + tabWidth: 2, + trailingComma: 'all', + useTabs: false, +}; From 5b05e16a0810d3d0bc26abc46bc43467de4117f2 Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Sat, 27 Apr 2024 13:40:50 -0400 Subject: [PATCH 2/3] add "format" npm script --- src/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index 73cb060..4cb4f0d 100644 --- a/src/package.json +++ b/src/package.json @@ -7,7 +7,8 @@ "scripts": { "start": "node esbuild.mjs --watch", "build": "node esbuild.mjs", - "lint": "cd .. && npx eslint src" + "lint": "cd .. && npx eslint src", + "format": "cd .. && npx prettier --write src && npx eslint src --fix" }, "author": "Micah Henning ", "license": "GPL-3.0-or-later", From aae89de2fb08a5c2a72dc962cf81df97b2f86a26 Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Sat, 27 Apr 2024 13:41:37 -0400 Subject: [PATCH 3/3] change typescript target to esnext, and add "@" as a path reference so source files can use absolute imports instead of relative imports --- src/index.ts | 18 +++++++++--------- src/tsconfig.json | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index e8a7e5c..613961f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,12 +5,12 @@ * @license GPL-3.0-or-later */ -import './lib/featureCheck'; // warn user of missing feature support first -import './components/mainMenu'; -import './components/digest'; -import './components/prng'; -import './components/encryption'; -import './components/passwords'; -import './lib/form'; -import './lib/operationAreas'; -import './lib/tabs'; +import '@/lib/featureCheck'; // warn user of missing feature support first +import '@/components/mainMenu'; +import '@/components/digest'; +import '@/components/prng'; +import '@/components/encryption'; +import '@/components/passwords'; +import '@/lib/form'; +import '@/lib/operationAreas'; +import '@/lib/tabs'; diff --git a/src/tsconfig.json b/src/tsconfig.json index cf377d5..016fa38 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "commonjs", + "module": "ESNext", "strict": true, "noImplicitReturns": true, "removeComments": true, @@ -13,7 +13,8 @@ "rootDir": "./", "baseUrl": ".", "paths": { - "*": ["types/*"] + "*": ["types/*"], + "@/*": ["./*"] } }, "include": [