Skip to content

Commit fd4b7ab

Browse files
authored
docs(linter): Add configuration option docs for unicorn/consistent-function-scoping rule. (#14969)
These already existed, but this allows us to autogenerate them. Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### checkArrowFunctions type: `boolean` default: `true` Whether to check scoping with arrow functions. ```
1 parent aa339b3 commit fd4b7ab

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

crates/oxc_linter/src/rules/unicorn/consistent_function_scoping.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use oxc_diagnostics::OxcDiagnostic;
66
use oxc_macros::declare_oxc_lint;
77
use oxc_semantic::{ReferenceId, ScopeFlags, ScopeId, SymbolId};
88
use oxc_span::{Atom, GetSpan, Span};
9+
use schemars::JsonSchema;
910

1011
use crate::{
1112
AstNode,
@@ -51,8 +52,10 @@ fn consistent_function_scoping(
5152
}
5253
}
5354

54-
#[derive(Debug, Clone)]
55+
#[derive(Debug, Clone, JsonSchema)]
56+
#[serde(rename_all = "camelCase", default)]
5557
pub struct ConsistentFunctionScoping {
58+
/// Whether to check scoping with arrow functions.
5659
check_arrow_functions: bool,
5760
}
5861

@@ -110,21 +113,6 @@ declare_oxc_lint!(
110113
/// return doBar;
111114
/// }
112115
/// ```
113-
/// ### Options
114-
///
115-
/// #### checkArrowFunctions
116-
///
117-
/// `{ type: boolean, default: true }`
118-
///
119-
/// Pass `"checkArrowFunctions": false` to disable linting of arrow functions.
120-
///
121-
/// Example:
122-
/// ```json
123-
/// "unicorn/consistent-function-scoping": [
124-
/// "error",
125-
/// { "checkArrowFunctions": false }
126-
/// ]
127-
/// ```
128116
///
129117
/// ### Limitations
130118
///
@@ -166,7 +154,8 @@ declare_oxc_lint!(
166154
ConsistentFunctionScoping,
167155
unicorn,
168156
suspicious,
169-
pending
157+
pending,
158+
config = ConsistentFunctionScoping,
170159
);
171160

172161
impl Rule for ConsistentFunctionScoping {

0 commit comments

Comments
 (0)