I have a portable version working-ish in this repo: GitHub - jderochervlk/ast-grep-rescript
The ./linter
folder is setup as a local package, which once I get the bugs sorted out I can publish to npm.
The rescript-lint.mjs
file allows you to toggle rules on and off and set warning or error for each one. The way ast-grep works is that it reads the configs for each rules from a folder, so I just copy the rules you have set into that folder. I’ll need a way to clean these up, and it would be great to have the top level config be a rescript-lint.res
file with some types.
The .vscode/settings.json
file sets the ast grep config path to be in the linter folder, so vscode works as expected. The part that I am trying to sort out is how to get ast-grep to run from the bin commands in linter.
The setup script can probably also make sure you have the astGrep path set correctly in the vscode settings.
The workflow could be install this package, configure some rules, and run the init command, have the ast-grep plugin installed, and tada!
I wonder if it would be possible to create a fork of the ast-grep vscode plugin that has the config path set already?