rokucommunity / bslint

A linter for BrightScript and BrighterScript.
MIT License
28 stars 15 forks source link

feat: add json schema for bslint.json #105

Open bartvandenende-wm opened 5 months ago

bartvandenende-wm commented 5 months ago

Summary

feat: add json schema for bslint.json and generate types from it

Details

solves https://github.com/rokucommunity/bslint/issues/104

How it was tested

bartvandenende-wm commented 4 months ago

I know it's slightly more work to keep the typescript interface and the schema in sync, but I'm not crazy about removing the interface from typescript and having it be generated, as that adds extra complexity when understanding how the project works (and we have so few contributors as it is).

that's OK, note there is probably still opportunity to unify the TS types of BsLintConfig['rules'] and BsLintRules but that is outside the scope of this PR.

Let's eliminate the src/generated concept and just maintain the schema and typescript interfaces separately. If you wanted, you could add a validation step that fails the build if the schema and interface are out of sync (which prevents us from releasing when they're out of sync).

I added a test to validate both the BsLintConfig and json-schema against a fixture, to be able to load it from the test file from TS though I had to move the schema in the src folder.