avo
avo copied to clipboard
Avo Linter
[!NOTE]
Work started in https://github.com/avo-hq/avo-linter
We need a way to figure out if the Avo configuration files have errors in them.
This linter should give us the violations that we can use in the LSP, GitHub Action, or in-app GUI.
### Must have's
- [ ] Linter ignore system (details below)
- [ ] ...
### Sample errors
- [ ] Recognize when fields are outside of `def fields` method
- [ ] recognize when `sidebar` declarations are outside `panel` or `main_panel` declarations
- [ ] same when panelless fields in tabs are not wrapped in a `panel`
- [ ] raise errors when blocks have arguments (or wrong arguments) `field :a, as: :text, help: ->(resource:) { "Some text" } # should raise "Block should not receive params" error`
- [ ] raise errors when invalid field names have been used `field :a, as: :b # should raise "There is no field ':b'"
- [ ] raise errors when invalid models have been used `self.model_class = "BadModel" # should raise "There is no 'BadModel' model"
- [ ] raise errors when the resource can't find a model for it
- [ ] raise errors when options have bad formatting (ex: `self.search`, `self.grid`, etc.)
- [ ] let's highlight deprecated settings in the Avo initializer
- [ ] no tabs in panels
avo.rb initializer
- [ ] have more intelligence around the initializer config options
Actions, Scopes, Filters, etc.
- [ ] have similar functionality as Resources for these classes
Linter ignore system
The developer should be able to add errors to an ignore list.
For example, if they don't want to see the act_on? warning on their list for a certain resource, they should be able to add it to a commitable list (.avorc file?).