Closed SethFalco closed 3 years ago
I'm not sure if breaking up the rules to multiple services would make it easier. I feel like this can get confusing. Also, what about using tldr-lint offline? There I don't have GitHub Actions or Prettier?
(Also, pinging some maintainers, since they don't watch this repo: @sbrl @navarroaxel @CleanMachine1)
Ahh, I didn't consider offline use. 🤔 I don't think the Prettier comment applies, as this project is in JavaScript, so it can just depend on Prettier.
As for GitHub actions, fair enough, that wouldn't work.
I'd have to agree with @marchersimon, I think having the offline capability as well as it being part of a centralised tool makes more sense.
Although, I still think that in future it would be nice to possibly rewrite the tldr-lint
tool to a different lexer, etc.
Given that this repo is very stable and doesn't change very often, I think replacing the built-in parse rules with a third party dependency would raise maintainer workload as we'd now have to keep track of yet another dependency and its new versions. The code that would be removed would also be the smallest, simplest rules that it wouldn't really give all that much less code to maintain.
Fair enough, I'll concede to that. I'll actually close this issue already. Looking back at my original issue and after hearing feedback, I agree it's not worthwhile.
Some rules are defined and implemented here that are generic and can be handled already by EditorConfig. We have an
.editorconfig
file defined in tldr-pages/tldr.I think we can reduce the code surface by using something that enforces EditorConfig instead. This means less code to maintain, while having access to more rules.
insert_final_newline
end_of_line
indent_style
Solutions
Prettier
I think the best way would be to delegate some rules to Prettier. It documents that we can read an
.editorconfig
file which can use it to override rules. (More Info)This would cover:
TLDR010
TLDR012
Prettier doesn't support the other properties that would help out yet, though:
insert_final_newline
forTLDR009
GitHub Actions
This one would be out of scope for this repository, but we could just scrap those rules and use a GitHub Action.
setup-editorconfig-checker
setup-editorconfig-checker might be good, and it uses editorconfig-checker which is still maintained.
EditorConfig-Action
EditorConfig-Action wins by star count, but this just uses jedmao/eclint under the hood, which is an archived and unmaintained project.
EditorConfig JavaScript Core
Alternatively, we could use EditorConfig JavaScript Core to parse the
.editorconfig
file, and apply the rule from there instead. That would defeat the point, as we'd still have to implement ourselves anyway, though. 🤔