Repository navigation
feat(linters): Add bloc linter - #945
eduardomcv wants to merge 4 commits into
Conversation
| local linter_name = "bloc" | ||
|
|
||
| -- See https://bloclibrary.dev/lint/ | ||
| local pattern = "(%w+)%[([%w_]+)%]:%s*(.-)\n%s*%-%->%s*.-:(%d+)\n%s*|\n%s*|.-\n%s*| (%s*)(%^+)" |
There was a problem hiding this comment.
Given the linter is already using a pattern, can't it use the from_pattern function to generate the parse function?
There was a problem hiding this comment.
It could, but I think the code would become more confusing.
AFAIK from_pattern reads line by line, but the bloc output is multi-line. The relevant info is scattered across those lines. What the pattern does is it matches the whole chunk of lines we need. Then the custom function parses that chunk into something nvim-lint can use.
If I were to use from_pattern, I would need to split the current pattern into smaller patterns that match each individual line. I would also need to write a custom function anyway. That function would need to know which line it is at, in order to apply the correct pattern, and have some external variable to hold all the pending values.
In any case, let me know if you want me to make the change.
de521b2 to
6da6c9d
Compare
Add support for the bloc linter.
Bloc is a Dart state management library which provides its own linting tool. To support this, I'm using the CLI tool and parsing the output to generate diagnostics. I also tested this configuration on my own Flutter projects.