slackhq / tree-sitter-hack

Hack grammar for tree-sitter
MIT License
33 stars 15 forks source link

Remove bin/hh-errors from bin/test-corpus #32

Open aosq opened 3 years ago

aosq commented 3 years ago

This PR removes the call to bin/hh-errors inside bin/test-corpus. bin/test-corpus is useful on its own and a user can always run bin/hh-errors if they want to find those errors.

This PR also renames bin/hh-json to bin/hh-parse. This script runs hh_parse it just returns the output as JSON. Also using "parse" creates a nice symmetry with the VSCode task ts-parse (which maybe we should add script for in bin/ts-parse 🤔).

frankeld commented 3 years ago

With this change, I think the only difference between npm run test and npm run test-corpus is that test-corpus generates the parser beforehand. This doesn't feel very clear from the script names. For example, in the README, we write

## Testing
```
$ npx tree-sitter generate
$ bin/test-corpus
```

when technically just $ bin/test-corpus would do. What is the use case for this difference? Could we make a new script option that runs hh-errors on all the case files a la bin/hh-errors "$($fd '\.(hack|php)$' test/cases)"?