Skip to content

Commit d78419f

Browse files
authored
docs(linter): Add configuration option docs for import/no-cycle rule. (#15136)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowUnsafeDynamicCyclicDependency type: `boolean` default: `false` Allow cyclic dependency if there is at least one dynamic import in the chain ### ignoreExternal type: `boolean` default: `false` Ignore external modules ### ignoreTypes type: `boolean` default: `true` Ignore type-only imports ### maxDepth type: `integer` default: `4294967295` Maximum dependency depth to traverse ```
1 parent 297176c commit d78419f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/oxc_linter/src/rules/import/no_cycle.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use cow_utils::CowUtils;
55
use oxc_diagnostics::OxcDiagnostic;
66
use oxc_macros::declare_oxc_lint;
77
use oxc_span::{CompactStr, Span};
8+
use schemars::JsonSchema;
89

910
use crate::{
1011
ModuleRecord,
@@ -20,13 +21,14 @@ fn no_cycle_diagnostic(span: Span, paths: &str) -> OxcDiagnostic {
2021
}
2122

2223
/// <https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/docs/rules/no-cycle.md>
23-
#[derive(Debug, Clone)]
24+
#[derive(Debug, Clone, JsonSchema)]
25+
#[serde(rename_all = "camelCase", default)]
2426
pub struct NoCycle {
25-
/// maximum dependency depth to traverse
27+
/// Maximum dependency depth to traverse
2628
max_depth: u32,
27-
/// ignore type only imports
29+
/// Ignore type-only imports
2830
ignore_types: bool,
29-
/// ignore external modules
31+
/// Ignore external modules
3032
ignore_external: bool,
3133
/// Allow cyclic dependency if there is at least one dynamic import in the chain
3234
allow_unsafe_dynamic_cyclic_dependency: bool,
@@ -87,7 +89,8 @@ declare_oxc_lint!(
8789
/// In this corrected version, `dep-b.js` no longer imports `dep-a.js`, breaking the cycle.
8890
NoCycle,
8991
import,
90-
restriction
92+
restriction,
93+
config = NoCycle,
9194
);
9295

9396
impl Rule for NoCycle {

0 commit comments

Comments
 (0)