Skip to content

Commit

Permalink
refactor: biome is now always installed, no need to check node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Aug 12, 2024
1 parent 95f807b commit 511ca48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cfg/lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/bin/dev-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
16 changes: 8 additions & 8 deletions src/lint.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 511ca48

Please sign in to comment.