tools
tools copied to clipboard
📎 (rome_js_analyze): Supporting write advance markdown in `declare_rule` macro
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))
Could you share some example that you tried to use and that fired that error? Because in markdown we have lists.
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"
}
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
It seems that our declare_rule
macro has already supported a lot of advanced markdown syntax, closed.