Skip to main content

fallow_config/config/
mod.rs

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