tools icon indicating copy to clipboard operation
tools copied to clipboard

📎 (rome_js_analyze): Supporting write advance markdown in `declare_rule` macro

Open IWANABETHATGUY opened this issue 2 years ago • 3 comments

Description

Like https://eslint.org/docs/rules/no-async-promise-executor, we want to use advance syntax like li, ul to orgnaize our lint document better. Currently, the cargo lintdoc would raise an error:

Error: failed to generate documentation pages for the following rules:
- noAsyncPromiseExecutor: unimplemented event Start(List(None))

IWANABETHATGUY avatar Jun 21 '22 12:06 IWANABETHATGUY

Could you share some example that you tried to use and that fired that error? Because in markdown we have lists.

ematipico avatar Jun 21 '22 16:06 ematipico

Could you share some example that you tried to use and that fired that error? Because in markdown we have lists.

declare_rule! {

    /// When expressing array types, this rule promotes the usage of `T[]` shorthand instead of `Array<T>`.
    /// - something
    /// - something else
    /// ## Examples
    ///
    /// ### Valid
    ///
    /// ```ts
    /// let valid: Array<Foo | Bar>;
    /// let valid: Array<keyof Bar>;
    /// let valid: Array<foo | bar>;
    /// ```
    ///
    /// ### Invalid
    /// ```ts,expect_diagnostic
    /// let valid: Array<foo>;
    /// ```
    ///
    /// ```ts,expect_diagnostic
    /// let invalid2: Promise<Array<string>>;
    /// ```
    ///
    /// ```ts,expect_diagnostic
    /// let invalid3: Array<Foo<Bar>>;
    /// ```
    pub(crate) UseShorthandArrayType = "useShorthandArrayType"
}

IWANABETHATGUY avatar Jun 21 '22 16:06 IWANABETHATGUY

This is an issue with the documentation generator, it doesn't implement code generation for all markdown elements yet so these currently fall into a catch-all branch that panics: https://github.com/rome/tools/blob/175cbb7ca6639f6b3d8af09dfa8a13afff392879/xtask/lintdoc/src/main.rs#L248-L251

leops avatar Jun 22 '22 07:06 leops

It seems that our declare_rule macro has already supported a lot of advanced markdown syntax, closed.

IWANABETHATGUY avatar Sep 10 '22 03:09 IWANABETHATGUY