Skip to content

Commit 54b2cb4

Browse files
authored
docs(linter): Add configuration option docs for eslint/max-classes-per-file rule. (#15022)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### ignoreExpressions type: `boolean` default: `false` Whether to ignore class expressions when counting classes. ### max type: `integer` default: `1` The maximum number of classes allowed per file. ```
1 parent b5acda7 commit 54b2cb4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use oxc_diagnostics::OxcDiagnostic;
33
use oxc_macros::declare_oxc_lint;
44
use oxc_span::Span;
55
use oxc_syntax::class::ClassId;
6+
use schemars::JsonSchema;
67
use serde_json::Value;
78

89
use crate::{context::LintContext, rule::Rule};
@@ -16,9 +17,12 @@ fn max_classes_per_file_diagnostic(total: usize, max: usize, span: Span) -> OxcD
1617
#[derive(Debug, Default, Clone)]
1718
pub struct MaxClassesPerFile(Box<MaxClassesPerFileConfig>);
1819

19-
#[derive(Debug, Clone)]
20+
#[derive(Debug, Clone, JsonSchema)]
21+
#[serde(rename_all = "camelCase", default)]
2022
pub struct MaxClassesPerFileConfig {
23+
/// The maximum number of classes allowed per file.
2124
pub max: usize,
25+
/// Whether to ignore class expressions when counting classes.
2226
pub ignore_expressions: bool,
2327
}
2428

@@ -65,6 +69,7 @@ declare_oxc_lint!(
6569
MaxClassesPerFile,
6670
eslint,
6771
pedantic,
72+
config = MaxClassesPerFileConfig,
6873
);
6974

7075
impl Rule for MaxClassesPerFile {

0 commit comments

Comments
 (0)