Skip to content

Commit bae0c09

Browse files
authored
docs(linter): Add configuration option docs for jsdoc/require-yields rule. (#15024)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### exemptedBy type: `string[]` default: `["inheritdoc"]` Functions with these tags will be exempted from the lint rule. ### forceRequireYields type: `boolean` default: `false` When `true`, all generator functions must have a `@yields` tag, even if they don't yield a value or have an empty body. ### withGeneratorTag type: `boolean` default: `false` When `true`, require `@yields` when a `@generator` tag is present. ```
1 parent 06c77b6 commit bae0c09

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

crates/oxc_linter/src/rules/jsdoc/require_yields.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use oxc_diagnostics::OxcDiagnostic;
55
use oxc_macros::declare_oxc_lint;
66
use oxc_semantic::{JSDoc, JSDocTag};
77
use oxc_span::Span;
8+
use schemars::JsonSchema;
89
use serde::Deserialize;
910

1011
use crate::{
@@ -77,18 +78,22 @@ declare_oxc_lint!(
7778
/// ```
7879
RequireYields,
7980
jsdoc,
80-
correctness
81+
correctness,
82+
config = RequireYieldsConfig,
8183
);
8284

83-
#[derive(Debug, Clone, Deserialize)]
85+
#[derive(Debug, Clone, Deserialize, JsonSchema)]
86+
#[serde(rename_all = "camelCase", default)]
8487
pub struct RequireYieldsConfig {
85-
#[serde(default = "default_exempted_by", rename = "exemptedBy")]
88+
/// Functions with these tags will be exempted from the lint rule.
89+
#[serde(default = "default_exempted_by")]
8690
exempted_by: Vec<String>,
87-
#[serde(default, rename = "forceRequireYields")]
91+
/// When `true`, all generator functions must have a `@yields` tag, even if they don't yield a value or have an empty body.
8892
force_require_yields: bool,
89-
#[serde(default, rename = "withGeneratorTag")]
93+
/// When `true`, require `@yields` when a `@generator` tag is present.
9094
with_generator_tag: bool,
9195
}
96+
9297
impl Default for RequireYieldsConfig {
9398
fn default() -> Self {
9499
Self {

0 commit comments

Comments
 (0)