Skip to main content

fallow_config/config/
mod.rs

1mod duplicates_config;
2mod format;
3mod health;
4mod parsing;
5mod resolution;
6mod rules;
7
8pub use duplicates_config::{
9    DetectionMode, DuplicatesConfig, NormalizationConfig, ResolvedNormalization,
10};
11pub use format::OutputFormat;
12pub use health::HealthConfig;
13pub use resolution::{ConfigOverride, IgnoreExportRule, ResolvedConfig, ResolvedOverride};
14pub use rules::{PartialRulesConfig, RulesConfig, Severity};
15
16use schemars::JsonSchema;
17use serde::{Deserialize, Serialize};
18
19use crate::external_plugin::ExternalPluginDef;
20use crate::workspace::WorkspaceConfig;
21
22/// User-facing configuration loaded from `.fallowrc.json` or `fallow.toml`.
23#[derive(Debug, Deserialize, Serialize, JsonSchema)]
24#[serde(deny_unknown_fields, rename_all = "camelCase")]
25pub struct FallowConfig {
26    /// JSON Schema reference (ignored during deserialization).
27    #[serde(rename = "$schema", default, skip_serializing)]
28    #[schemars(skip)]
29    pub schema: Option<String>,
30
31    /// Paths to base config files to extend from.
32    /// Paths are resolved relative to the config file containing the `extends`.
33    /// Base configs are loaded first, then this config's values override them.
34    /// Later entries in the array override earlier ones.
35    #[serde(default, skip_serializing)]
36    pub extends: Vec<String>,
37
38    /// Additional entry point glob patterns.
39    #[serde(default)]
40    pub entry: Vec<String>,
41
42    /// Glob patterns to ignore from analysis.
43    #[serde(default)]
44    pub ignore_patterns: Vec<String>,
45
46    /// Custom framework definitions (inline plugin definitions).
47    #[serde(default)]
48    pub framework: Vec<ExternalPluginDef>,
49
50    /// Workspace overrides.
51    #[serde(default)]
52    pub workspaces: Option<WorkspaceConfig>,
53
54    /// Dependencies to ignore (always considered used).
55    #[serde(default)]
56    pub ignore_dependencies: Vec<String>,
57
58    /// Export ignore rules.
59    #[serde(default)]
60    pub ignore_exports: Vec<IgnoreExportRule>,
61
62    /// Duplication detection settings.
63    #[serde(default)]
64    pub duplicates: DuplicatesConfig,
65
66    /// Complexity health metrics settings.
67    #[serde(default)]
68    pub health: HealthConfig,
69
70    /// Per-issue-type severity rules.
71    #[serde(default)]
72    pub rules: RulesConfig,
73
74    /// Production mode: exclude test/dev files, only start/build scripts.
75    #[serde(default)]
76    pub production: bool,
77
78    /// Paths to external plugin files or directories containing plugin files.
79    ///
80    /// Supports TOML, JSON, and JSONC formats.
81    ///
82    /// In addition to these explicit paths, fallow automatically discovers:
83    /// - `*.toml`, `*.json`, `*.jsonc` files in `.fallow/plugins/`
84    /// - `fallow-plugin-*.{toml,json,jsonc}` files in the project root
85    #[serde(default)]
86    pub plugins: Vec<String>,
87
88    /// Per-file rule overrides matching oxlint's overrides pattern.
89    #[serde(default)]
90    pub overrides: Vec<ConfigOverride>,
91}