nginx_lint_common/lib.rs
1//! Core types shared between the nginx-lint CLI and WASM plugins.
2//!
3//! This crate provides the foundational types used throughout the nginx-lint
4//! ecosystem: lint rule definitions, error reporting, configuration management,
5//! and ignore comment support.
6//!
7//! # Modules
8//!
9//! - [`linter`] — Core lint types: [`LintRule`] trait, [`LintError`], [`Severity`], [`Fix`]
10//! - [`config`] — Configuration loaded from `.nginx-lint.toml` ([`LintConfig`], [`ValidationError`])
11//! - [`ignore`] — `# nginx-lint-ignore` comment parsing and error filtering
12//! - [`docs`] — Rule documentation extraction ([`RuleDoc`])
13//!
14//! # Quick reference
15//!
16//! | Type | Purpose |
17//! |------|---------|
18//! | [`LintRule`] | Trait that every lint rule (native or WASM) implements |
19//! | [`LintError`] | A single lint diagnostic with location, severity, and optional fixes |
20//! | [`Severity`] | `Error` or `Warning` |
21//! | [`Fix`] | An auto-fix action (replace, delete, insert) |
22//! | [`LintConfig`] | Settings loaded from `.nginx-lint.toml` |
23//! | [`Linter`] | Container that holds rules and runs them against a parsed config |
24//!
25//! # Re-exports
26//!
27//! The [`parser`] module re-exports the entire [`nginx_lint_parser`] crate,
28//! giving access to [`parse_config`], [`parse_string`], and the AST types.
29
30pub mod config;
31pub mod docs;
32pub mod ignore;
33pub mod linter;
34
35// Re-export parser crate
36pub use nginx_lint_parser as parser;
37
38// Re-export commonly used types
39pub use config::{
40 Color, ColorConfig, ColorMode, IncludeConfig, LintConfig, PathMapping, ValidationError,
41};
42pub use docs::{RuleDoc, RuleDocOwned};
43pub use ignore::{
44 FilterResult, IgnoreTracker, IgnoreWarning, filter_errors, parse_context_comment,
45};
46pub use linter::{
47 Fix, LintError, LintRule, Linter, RULE_CATEGORIES, Severity, apply_fixes_to_content,
48 compute_line_starts, normalize_line_fix,
49};
50pub use nginx_lint_parser::{parse_config, parse_string, parse_string_with_errors};