I propose a refactor of editor validation system.
Target state:
- All applicable rules exist as separate functions, each function in its own separate file, one per rule, in a shared directory such as
rules.d.
- Both editor's validation and stand-alone linter load the same set of validator functions, not recreate them and maintain two separate versions of the same.
- Rules can be marked as mandatory (errors) and suggested (hints). The type is determined by name pattern so the consuming function can elect to load only mandatory rules, for example.
- Validation functions, contract include:
- validation result (pass/fail)
- a meaningful error/suggestion message (localizable in the future)
- first offending character.
- Both linter and editor are free to interpret these results and express them in UX, e.g.:
- ignore suggestions (don't load them), prevent blocks with errors from being saved, highlight the part of the block that is not accepted with red (current editor behavior).
- show errors and return non-zero exit code; show suggestions and return exit code 0 if no errors were found.
I propose a refactor of editor validation system.
Target state:
rules.d.