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
Add descriptions and examples to each lint rule #159
Comments
I think it's high time to start adding rules documentation so I'm pinning this issue. So to support basic documentation and website generation we need to change pub trait LintRule {
fn new() -> Box<Self>
where
Self: Sized;
fn lint_module(
&self,
context: Arc<Context>,
module: &swc_ecmascript::ast::Module,
);
fn code(&self) -> &'static str;
fn docs(&self) -> &'static str; // <--- new method
}
Documentation for each lint rule should contain a short synopsis on what the rule does, why is it used and examples of both valid and invalid code. Example for
|
I'm happy to look at implementing this on the rules I've implemented once the trait is updated. From a quick scan that covers:
🙂 |
@DomParfitt great, thank you! I've already merged #343 |
All lint rules should be updated to contains some kind of method that returns description as well as some examples of valid and invalid. This feature will be used to generate documentation.
The text was updated successfully, but these errors were encountered: