errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.52k stars 155 forks source link

Add support for the dart language #861

Open rafaeltab opened 4 months ago

rafaeltab commented 4 months ago

Hey, I wanted to have support for the dart language, so I added it. Please let me know if I missed something.

I added inBlock to the comments.go file because when using a /** comment people often add a * prefix as such:

/*
 * Hey
 * How
 * Are
 * You
 */

This is removed by the inBlock regex.

In the format.go file I did not add this, as it seems that each regex includes the comment in the selection here, so there is no need to remove anything, if I am mistaken please let me know.

[!IMPORTANT]
Dart actually uses markdown inside their comments, I was not sure how to make it recognize it as such. Comments are only interpreted as normal text.

jdkato commented 4 months ago

I've moved away from regex-based comment extraction in favor of using Tree-sitter. You can see examples in the internal/lint/code package.

Dart actually uses markdown inside their comments, I was not sure how to make it recognize it as such. Comments are only interpreted as normal text.

Vale can handle this for all supporting languages.

rafaeltab commented 4 months ago

Oh awesome! I actually looked at adding dart support before, and found a branch with treesitter, but then I couldn't find it this time. I'll get right on implementing this.