2023-06-02 10:45:51 +00:00
|
|
|
import * as path from 'path'
|
2023-04-25 11:01:25 +00:00
|
|
|
import { exec } from './lib/exec'
|
2024-03-11 14:08:04 +00:00
|
|
|
import { REPO_ROOT } from './lib/file'
|
2023-04-25 11:01:25 +00:00
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const shouldFix = process.argv.includes('--fix')
|
2023-06-02 10:45:51 +00:00
|
|
|
const relativeCwd = path.relative(REPO_ROOT, process.cwd())
|
|
|
|
|
2023-04-25 11:01:25 +00:00
|
|
|
try {
|
2024-03-11 14:08:04 +00:00
|
|
|
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()
|