2023-04-25 11:01:25 +00:00
|
|
|
import { join, relative } from 'path'
|
|
|
|
|
|
|
|
import { exec } from './lib/exec'
|
|
|
|
import { REPO_ROOT } from './lib/file'
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const shouldFix = process.argv.includes('--fix')
|
|
|
|
|
|
|
|
try {
|
|
|
|
await exec(
|
|
|
|
'yarn',
|
|
|
|
[
|
|
|
|
'run',
|
|
|
|
'-T',
|
|
|
|
'prettier',
|
|
|
|
shouldFix ? '--write' : '--check',
|
|
|
|
// we have to run prettier from root so it picks up the ignore file
|
2023-05-02 15:12:34 +00:00
|
|
|
join(relative(REPO_ROOT, process.cwd()), '**', '*.{ts,tsx,js,jsx,json}'),
|
2023-04-25 11:01:25 +00:00
|
|
|
],
|
|
|
|
{ pwd: REPO_ROOT }
|
|
|
|
)
|
|
|
|
await exec('yarn', [
|
|
|
|
'run',
|
|
|
|
'-T',
|
|
|
|
'eslint',
|
|
|
|
'--report-unused-disable-directives',
|
|
|
|
'--ignore-path',
|
|
|
|
join(REPO_ROOT, '.eslintignore'),
|
|
|
|
shouldFix ? '--fix' : null,
|
|
|
|
'.',
|
|
|
|
])
|
|
|
|
} catch (error) {
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|