New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lint): --rules print all rules #20256
Conversation
cli/tools/lint.rs
Outdated
print!(" - {}", rule.code()); | ||
if rule.tags().is_empty() { | ||
println!(); | ||
} else { | ||
println!(" [{}]", rule.tags().join(", ")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some flair here? Maybe put the rule name in colors::cyan
and all the remaining info (tag, help and link) in colors::gray
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let lint_rules = if maybe_rules_tags.is_none() { | ||
rules::get_all_rules() | ||
} else { | ||
rules::get_filtered_rules(maybe_rules_tags, None, None) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to handle filtering on rules that have no tags nicely here. Any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the easiest way would be to add something like --untagged-only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an implementation example of untagged-only ba76af6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of adding a specialized flag. Maybe we could support empty valuer in --rules-tags
that would filter rules with no tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--rules-tags=""
feels unintuitive to me
Maybe Its better if we leave it as is for now
If you still think it's a good idea I can implement it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about it. We can leave it for a follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @sigmaSd!
The motivation is If I'm using deno lint --rules, I want to see all the rules especially the one that have no tags, since the recommend ones are already active
This pr also prints the tags associated with the rule inline
Side question: we can filter with --rules-tags, but what If I want to see only the rules with no tags (not possible currently)