Skip to content

Commit ec6721c

Browse files
authored
docs(linter): Improve documentation for no-unused-vars and no-useless-constructor. (#15244)
1 parent 10732e8 commit ec6721c

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

crates/oxc_linter/src/rules/eslint/no_unused_vars/options.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct NoUnusedVarsOptions {
2828
/// behavior deviates from both ESLint and TypeScript-ESLint, which never
2929
/// provide a default pattern.
3030
///
31-
/// ## Example
31+
/// #### Example
3232
///
3333
/// Examples of **correct** code for this option when the pattern is `^_`:
3434
/// ```javascript
@@ -58,7 +58,7 @@ pub struct NoUnusedVarsOptions {
5858
/// behavior deviates from both ESLint and TypeScript-ESLint, which never
5959
/// provide a default pattern.
6060
///
61-
/// ## Example
61+
/// #### Example
6262
///
6363
/// Examples of **correct** code for this option when the pattern is `^_`:
6464
///
@@ -77,7 +77,7 @@ pub struct NoUnusedVarsOptions {
7777
///
7878
/// By default this option is `false`.
7979
///
80-
/// ## Example
80+
/// #### Example
8181
/// Examples of **correct** code when this option is set to `true`:
8282
/// ```js
8383
/// // 'foo' and 'bar' were ignored because they have a rest property sibling.
@@ -101,7 +101,7 @@ pub struct NoUnusedVarsOptions {
101101
/// Variables declared within a `catch` block whose names match this pattern
102102
/// will be ignored.
103103
///
104-
/// ## Example
104+
/// #### Example
105105
///
106106
/// Examples of **correct** code when the pattern is `^ignore`:
107107
///
@@ -121,7 +121,7 @@ pub struct NoUnusedVarsOptions {
121121
///
122122
/// By default this pattern is [`None`].
123123
///
124-
/// ## Example
124+
/// #### Example
125125
///
126126
/// Examples of **correct** code for this option, when the pattern is `^_`:
127127
/// ```javascript
@@ -147,7 +147,7 @@ pub struct NoUnusedVarsOptions {
147147
/// instance of the class. When set to true, this option ignores classes
148148
/// containing static initialization blocks.
149149
///
150-
/// ## Example
150+
/// #### Example
151151
///
152152
/// Examples of **incorrect** code for the `{ "ignoreClassWithStaticInitBlock": true }` option
153153
///
@@ -191,7 +191,7 @@ pub struct NoUnusedVarsOptions {
191191
/// via the explicit resource management proposal, where the primary
192192
/// purpose is the disposal side effect rather than using the resource.
193193
///
194-
/// ## Example
194+
/// #### Example
195195
///
196196
/// Examples of **correct** code for the `{ "ignoreUsingDeclarations": true }` option:
197197
///
@@ -209,7 +209,7 @@ pub struct NoUnusedVarsOptions {
209209
/// `caughtErrorsIgnorePattern`, or `destructuredArrayIgnorePattern`) if
210210
/// they have been used.
211211
///
212-
/// ## Example
212+
/// #### Example
213213
///
214214
/// Examples of **incorrect** code for the `{ "reportUsedIgnorePattern": true }` option:
215215
///
@@ -236,7 +236,7 @@ pub struct NoUnusedVarsOptions {
236236
///
237237
/// If `true`, the rule will also report variables that are only used as types.
238238
///
239-
/// ## Examples
239+
/// #### Examples
240240
///
241241
/// Examples of **incorrect** code for the `{ "reportVarsOnlyUsedAsTypes": true }` option:
242242
///

crates/oxc_linter/src/rules/eslint/no_useless_constructor.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ declare_oxc_lint!(
5252
/// such, it is unnecessary to provide an empty constructor or one that
5353
/// simply delegates into its parent class.
5454
///
55-
/// # Caveat
56-
/// This lint rule will report on constructors whose sole purpose is to change visibility of a parent constructor.
55+
/// ::: warning
56+
/// Caveat: This lint rule will report on constructors whose sole purpose is to change visibility of a parent constructor.
5757
/// This is because the rule does not have type information to determine if the parent constructor is public, protected, or private.
58+
/// :::
5859
///
5960
/// ### Examples
6061
///

0 commit comments

Comments
 (0)