From dad74fee7d152c85ea287a8e3a0528192c55aeea Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 24 Sep 2024 07:36:33 -0400 Subject: [PATCH] chore(biome): update config and scripts (#138) --- biome.json | 12 +++++++----- package.json | 3 ++- src/entries/content/lib.ts | 3 ++- src/entries/popup/main.ts | 16 +++++++++++++--- src/entries/popup/styles.css | 13 ++----------- wxt.config.ts | 18 ++++++++++++------ 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/biome.json b/biome.json index aad824c..67a4252 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", "vcs": { "enabled": true, "clientKind": "git", @@ -11,11 +11,8 @@ "formatter": { "enabled": true, "formatWithErrors": false, - "indentStyle": "tab", - "indentWidth": 2, - "lineEnding": "lf", + "useEditorconfig": true, "lineWidth": 80, - "attributePosition": "auto", "ignore": ["pnpm-lock.yaml"] }, "organizeImports": { "enabled": true }, @@ -60,6 +57,11 @@ "attributePosition": "auto" } }, + "css": { + "formatter": { + "quoteStyle": "single" + } + }, "overrides": [ { "include": ["**/*.{yml,yaml,md}"], diff --git a/package.json b/package.json index 3736ed9..a02c613 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "wxt": "0.19.9" }, "scripts": { - "check": "biome check", + "lint": "biome check .", + "format": "biome format --write .", "dev": "wxt", "dev:firefox": "wxt --browser firefox", "build": "wxt build", diff --git a/src/entries/content/lib.ts b/src/entries/content/lib.ts index c450877..53d6173 100644 --- a/src/entries/content/lib.ts +++ b/src/entries/content/lib.ts @@ -184,7 +184,8 @@ async function findIconMatch( for (const ext of fileExtensions) { if (ext in associations.fileExtensions) return associations.fileExtensions[ext]; - if (ext in associations.languageIds) return associations.languageIds[ext]; + if (ext in associations.languageIds) + return associations.languageIds[ext]; } return '_file'; diff --git a/src/entries/popup/main.ts b/src/entries/popup/main.ts index c9c4239..408f256 100644 --- a/src/entries/popup/main.ts +++ b/src/entries/popup/main.ts @@ -55,7 +55,9 @@ async function init() { const associations = await customAssociations.getValue(); for (const [key, el] of Object.entries({ - fileExtensions: document.querySelector('ul#associations-file-extensions'), + fileExtensions: document.querySelector( + 'ul#associations-file-extensions', + ), fileNames: document.querySelector('ul#associations-file-names'), folderNames: document.querySelector('ul#associations-folder-names'), } as Record) as Array< @@ -136,7 +138,11 @@ async function init() { associations[key][inputA.value] = inputB.value as IconName; await customAssociations.setValue(associations); } - if (!addedEmpty && inputA.checkValidity() && inputB.checkValidity()) { + if ( + !addedEmpty && + inputA.checkValidity() && + inputB.checkValidity() + ) { addEmpty(); addedEmpty = true; } @@ -146,7 +152,11 @@ async function init() { associations[key][inputA.value] = inputB.value as IconName; await customAssociations.setValue(associations); } - if (!addedEmpty && inputA.checkValidity() && inputB.checkValidity()) { + if ( + !addedEmpty && + inputA.checkValidity() && + inputB.checkValidity() + ) { addEmpty(); addedEmpty = true; } diff --git a/src/entries/popup/styles.css b/src/entries/popup/styles.css index 282d8b2..b3c494c 100644 --- a/src/entries/popup/styles.css +++ b/src/entries/popup/styles.css @@ -1,15 +1,6 @@ body { - font-family: - system-ui, - -apple-system, - BlinkMacSystemFont, - 'Segoe UI', - Roboto, - Oxygen, - Ubuntu, - Cantarell, - 'Open Sans', - 'Helvetica Neue', + font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', + Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; width: 600px; diff --git a/wxt.config.ts b/wxt.config.ts index 8bf5d50..d484841 100644 --- a/wxt.config.ts +++ b/wxt.config.ts @@ -32,16 +32,22 @@ export default defineConfig({ }, hooks: { 'build:before': async () => { - const ICON_DIR = join(__dirname, './vscode-icons/icons/css-variables/'); + const ICON_DIR = join( + __dirname, + './vscode-icons/icons/css-variables/', + ); const icons = {}; for await (const entry of hfs.list(ICON_DIR)) { icons[entry.name.replace('.svg', '')] = await hfs .text(join(ICON_DIR, entry.name)) .then((text) => { - return optimize(text.replaceAll('--vscode-ctp', '--ctp'), { - js2svg: { useShortTags: false }, - }) + return optimize( + text.replaceAll('--vscode-ctp', '--ctp'), + { + js2svg: { useShortTags: false }, + }, + ) .data.replace( '', '', @@ -58,8 +64,8 @@ export default defineConfig({ await hfs.write( join(__dirname, './src/associations.json'), JSON.stringify( - jiti(__dirname)('./vscode-icons/src/defaults/index.ts').defaultConfig - .associations, + jiti(__dirname)('./vscode-icons/src/defaults/index.ts') + .defaultConfig.associations, ), ); },