diff --git a/crates/biome_js_analyze/src/lint/style/use_for_of.rs b/crates/biome_js_analyze/src/lint/style/use_for_of.rs index afcfffa38d91..465731885de5 100644 --- a/crates/biome_js_analyze/src/lint/style/use_for_of.rs +++ b/crates/biome_js_analyze/src/lint/style/use_for_of.rs @@ -29,6 +29,12 @@ declare_rule! { /// ### Valid /// /// ```js + /// for (let item of array) { + /// console.log(item); + /// } + /// ``` + /// + /// ```js /// for (let i = 0; i < array.length; i++) { /// console.log(i, array[i]); /// } diff --git a/website/src/content/docs/linter/rules/use-for-of.md b/website/src/content/docs/linter/rules/use-for-of.md index a26e1359aedc..b891b56a3eb3 100644 --- a/website/src/content/docs/linter/rules/use-for-of.md +++ b/website/src/content/docs/linter/rules/use-for-of.md @@ -23,18 +23,24 @@ for (let i = 0; i < array.length; i++) {
style/useForOf.js:1:1 lint/style/useForOf ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Use for-of loop instead of a for loop.
-  
+
   > 1 │ for (let i = 0; i < array.length; i++) {
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   > 2 │   console.log(array[i]);
   > 3 │ }
    ^
     4 │ 
-  
+
 
### Valid +```jsx +for (let item of array) { + console.log(item); + } +``` + ```jsx for (let i = 0; i < array.length; i++) { console.log(i, array[i]);