tldraw/scripts/lint.ts
David Sheldrick 47a85896e0
[dx] Allow vscode to search inside md files by default (#3105)
Before this PR all .md files were targeted by the `.ignore` file, which
has bitten me on a number of occasions since .md files often contain
valuable information (e.g. the vscode extensions docs). This PR
unignores .md files while still ignoring _generated_ .md files like our
changelogs, the api-report files, and the generated docs sections.

Additionally, the `yarn format` and `yarn lint` commands were configured
slightly differently, which was confusing, so I've unified those and
simplified the lint.ts script at the same time.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [x] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
2024-03-11 14:08:04 +00:00

29 lines
622 B
TypeScript
Executable file

import * as path from 'path'
import { exec } from './lib/exec'
import { REPO_ROOT } from './lib/file'
async function main() {
const shouldFix = process.argv.includes('--fix')
const relativeCwd = path.relative(REPO_ROOT, process.cwd())
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 }
)
} catch (error) {
process.exit(1)
}
}
main()