Skip to content

Commit 571012c

Browse files
committed
refactor(linter): preserve-caught-errors: rename config and add docs
1 parent 3e50ecb commit 571012c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ fn missing_catch_parameter_diagnostic(span: Span) -> OxcDiagnostic {
2929

3030
#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema)]
3131
#[schemars(rename_all = "camelCase")]
32-
#[serde(rename_all = "camelCase")]
33-
struct ConfigElement0 {
32+
#[serde(rename_all = "camelCase", default)]
33+
struct PreserveCaughtErrorOptions {
34+
/// When set to `true`, requires that catch clauses always have a parameter.
3435
require_catch_parameter: bool,
3536
}
3637

3738
#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema)]
38-
pub struct PreserveCaughtError(ConfigElement0);
39+
pub struct PreserveCaughtError(PreserveCaughtErrorOptions);
3940

4041
struct ThrowFinder<'a, 'ctx> {
4142
catch_param: &'a BindingPattern<'a>,
@@ -162,7 +163,7 @@ declare_oxc_lint!(
162163
eslint,
163164
suspicious,
164165
pending,
165-
config = ConfigElement0,
166+
config = PreserveCaughtErrorOptions,
166167
);
167168
impl PreserveCaughtError {
168169
fn check_try_statement<'a>(&self, try_stmt: &'a TryStatement<'a>, ctx: &LintContext<'a>) {

0 commit comments

Comments
 (0)