@@ -2,10 +2,12 @@ use std::{borrow::Cow, ops::Deref};
22
33use lazy_regex:: { Regex , RegexBuilder } ;
44use oxc_diagnostics:: OxcDiagnostic ;
5+ use schemars:: JsonSchema ;
56use serde_json:: Value ;
67
78/// See [ESLint - no-unused-vars config schema](https://github.com/eslint/eslint/blob/53b1ff047948e36682fade502c949f4e371e53cd/lib/rules/no-unused-vars.js#L61)
8- #[ derive( Debug , Clone ) ]
9+ #[ derive( Debug , Clone , JsonSchema ) ]
10+ #[ serde( rename_all = "camelCase" ) ]
911#[ must_use]
1012#[ non_exhaustive]
1113pub struct NoUnusedVarsOptions {
@@ -34,6 +36,7 @@ pub struct NoUnusedVarsOptions {
3436 /// var b = 10;
3537 /// console.log(b);
3638 /// ```
39+ #[ schemars( skip) ]
3740 pub vars_ignore_pattern : IgnorePattern < Regex > ,
3841
3942 /// Controls how unused arguments are checked.
@@ -65,6 +68,7 @@ pub struct NoUnusedVarsOptions {
6568 /// }
6669 /// foo(1, 2);
6770 /// ```
71+ #[ schemars( skip) ]
6872 pub args_ignore_pattern : IgnorePattern < Regex > ,
6973
7074 /// Using a Rest property it is possible to "omit" properties from an
@@ -108,6 +112,7 @@ pub struct NoUnusedVarsOptions {
108112 /// console.error("Error caught in catch block");
109113 /// }
110114 /// ```
115+ #[ schemars( skip) ]
111116 pub caught_errors_ignore_pattern : IgnorePattern < Regex > ,
112117
113118 /// This option specifies exceptions within destructuring patterns that will
@@ -132,6 +137,7 @@ pub struct NoUnusedVarsOptions {
132137 /// console.log(n);
133138 /// });
134139 /// ```
140+ #[ schemars( skip) ]
135141 pub destructured_array_ignore_pattern : IgnorePattern < Regex > ,
136142
137143 /// The `ignoreClassWithStaticInitBlock` option is a boolean (default:
@@ -368,7 +374,8 @@ impl Default for NoUnusedVarsOptions {
368374 }
369375}
370376
371- #[ derive( Debug , Default , Clone , PartialEq , Eq ) ]
377+ #[ derive( Debug , Default , Clone , PartialEq , Eq , JsonSchema ) ]
378+ #[ serde( rename_all = "camelCase" ) ]
372379pub enum VarsOption {
373380 /// All variables are checked for usage, including those in the global scope.
374381 #[ default]
@@ -383,7 +390,8 @@ impl VarsOption {
383390 }
384391}
385392
386- #[ derive( Debug , Default , Clone , PartialEq , Eq ) ]
393+ #[ derive( Debug , Default , Clone , PartialEq , Eq , JsonSchema ) ]
394+ #[ serde( rename_all = "camelCase" ) ]
387395pub enum ArgsOption {
388396 /// Unused positional arguments that occur before the last used argument
389397 /// will not be checked, but all named arguments and all positional
@@ -412,7 +420,8 @@ impl ArgsOption {
412420 }
413421}
414422
415- #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
423+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , JsonSchema ) ]
424+ #[ serde( rename_all = "camelCase" ) ]
416425#[ repr( transparent) ]
417426pub struct CaughtErrors ( bool ) ;
418427
0 commit comments