From 511ca48964915eab19c7b7fc7e1b21491bd48e94 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Mon, 12 Aug 2024 10:07:42 +0200 Subject: [PATCH] refactor: biome is now always installed, no need to check node_modules --- cfg/lint-staged.config.js | 4 ++-- src/bin/dev-lib.ts | 4 ++-- src/lint.util.ts | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cfg/lint-staged.config.js b/cfg/lint-staged.config.js index 5ed513c..df2908b 100644 --- a/cfg/lint-staged.config.js +++ b/cfg/lint-staged.config.js @@ -34,8 +34,8 @@ const stylelintExists = fs.existsSync('node_modules/stylelint-config-standard-scss') const stylelintCmd = stylelintExists ? `stylelint --fix --config ${stylelintConfigPath}` : undefined -const biomeInstalled = fs.existsSync('node_modules/@biomejs/biome') -const biomeConfigPath = biomeInstalled && ['biome.jsonc'].find(p => fs.existsSync(p)) +// const biomeInstalled = fs.existsSync('node_modules/@biomejs/biome') +const biomeConfigPath = ['biome.jsonc'].find(p => fs.existsSync(p)) const biomeCmd = biomeConfigPath && `biome lint --write --unsafe --` if (!eslintConfigPathRoot) { diff --git a/src/bin/dev-lib.ts b/src/bin/dev-lib.ts index ac53645..ce72fa9 100755 --- a/src/bin/dev-lib.ts +++ b/src/bin/dev-lib.ts @@ -84,12 +84,12 @@ const commands: (Command | Separator)[] = [ }, { name: 'biome', - fn: () => runBiome(true), + fn: () => runBiome(), desc: 'Run biome linter on all files.', }, { name: 'biome --no-fix', - fn: () => runBiome(true, false), + fn: () => runBiome(false), desc: 'Run biome linter on all files with "auto-fix" disabled. Useful for debugging.', interactiveOnly: true, }, diff --git a/src/lint.util.ts b/src/lint.util.ts index ca98947..bab9863 100644 --- a/src/lint.util.ts +++ b/src/lint.util.ts @@ -307,17 +307,17 @@ function runActionLint(): void { } } -export function runBiome(verbose = false, fix = true): void { - if (!fs.existsSync(`node_modules/@biomejs/biome`)) { - if (verbose) { - console.log(`biome is not installed (checked in node_modules/@biomejs/biome), skipping`) - } - return - } +export function runBiome(fix = true): void { + // if (!fs.existsSync(`node_modules/@biomejs/biome`)) { + // if (verbose) { + // console.log(`biome is not installed (checked in node_modules/@biomejs/biome), skipping`) + // } + // return + // } const configPath = `biome.jsonc` if (!fs.existsSync(configPath)) { - if (verbose) console.log(`biome is installed, but biome.jsonc config file is missing`) + console.log(`biome is skipped, because ./biome.jsonc is not present`) return }