Tldraw/scripts/lint.ts

30 wiersze
622 B
TypeScript
Czysty Zwykły widok Historia

import * as path from 'path'
2023-04-25 11:01:25 +00:00
import { exec } from './lib/exec'
import { REPO_ROOT } from './lib/file'
2023-04-25 11:01:25 +00:00
async function main() {
const shouldFix = process.argv.includes('--fix')
const relativeCwd = path.relative(REPO_ROOT, process.cwd())
2023-04-25 11:01:25 +00:00
try {
await exec('yarn', ['prettier', shouldFix ? '--write' : '--check', '--cache', relativeCwd], {
pwd: REPO_ROOT,
})
await exec(
'yarn',
[
'eslint',
'--report-unused-disable-directives',
'--no-error-on-unmatched-pattern',
shouldFix ? '--fix' : null,
relativeCwd,
],
{ pwd: REPO_ROOT }
)
2023-04-25 11:01:25 +00:00
} catch (error) {
process.exit(1)
}
}
main()