From 5c7041bd2a2a82a53f03460faeec716ba5daeb09 Mon Sep 17 00:00:00 2001 From: Wang Wenzhe Date: Sat, 25 May 2024 18:34:11 +0800 Subject: [PATCH] docs(linter): add docs for consistent-indexed-object-style (#3409) I forgot to update the docs in #3126. --- .../consistent_indexed_object_style.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/oxc_linter/src/rules/typescript/consistent_indexed_object_style.rs b/crates/oxc_linter/src/rules/typescript/consistent_indexed_object_style.rs index a2a22126e526..ac275ef51f77 100644 --- a/crates/oxc_linter/src/rules/typescript/consistent_indexed_object_style.rs +++ b/crates/oxc_linter/src/rules/typescript/consistent_indexed_object_style.rs @@ -33,10 +33,26 @@ declare_oxc_lint!( /// Require or disallow the `Record` type. /// /// ### Why is this bad? - /// + /// Inconsistent style for indexed object types can harm readability in a project. /// /// ### Example + /// With "record": + /// + /// ```javascript + /// // bad + /// interface Foo { + /// [key: string]: unknown; + ///} + /// type Foo = { + /// [key: string]: unknown; + ///}; + /// ``` + /// + /// With "index-signature": + /// /// ```javascript + /// // bad + /// type Foo = Record; /// ``` ConsistentIndexedObjectStyle, style