Skip to content

Commit a02567f

Browse files
docs(linter): Update no-invalid-regexp rule to expose documentation for config options (#14838)
Results in the following generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowConstructorFlags type: `string[]` default: `[]` Case-sensitive array of flags that will be allowed. ``` Part of #14743. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent ebca4a6 commit a02567f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use oxc_macros::declare_oxc_lint;
55
use oxc_regular_expression::{ConstructorParser, Options};
66
use oxc_span::Span;
77
use rustc_hash::FxHashSet;
8+
use schemars::JsonSchema;
89
use serde::Deserialize;
910

1011
use crate::{AstNode, context::LintContext, rule::Rule};
@@ -54,12 +55,13 @@ declare_oxc_lint!(
5455
NoInvalidRegexp,
5556
eslint,
5657
correctness,
58+
config = NoInvalidRegexpConfig,
5759
);
5860

59-
#[derive(Debug, Clone, Deserialize, Default)]
61+
#[derive(Debug, Clone, Deserialize, Default, JsonSchema)]
62+
#[serde(rename_all = "camelCase", default)]
6063
struct NoInvalidRegexpConfig {
61-
#[serde(default, rename = "allowConstructorFlags")]
62-
/// Case-sensitive array of flags.
64+
/// Case-sensitive array of flags that will be allowed.
6365
allow_constructor_flags: Vec<char>,
6466
}
6567

0 commit comments

Comments
 (0)