Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8c4f845
Config: Remove .herb.yaml rejection
krystof-k Apr 23, 2026
b5e04f9
Config: Introduce configPaths array and defaultConfigPath
krystof-k Apr 23, 2026
55e6991
Config: Add isConfigPath helper and accept explicit .herb.yaml paths
krystof-k Apr 23, 2026
a912e05
Config: Discover existing .herb.yaml in configPathFromProjectPath
krystof-k Apr 23, 2026
aab3828
Config: Discover .herb.yaml in findConfigFile and findProjectRootSync
krystof-k Apr 23, 2026
9114748
Ruby: Accept .herb.yaml in config discovery
krystof-k Apr 23, 2026
bdb6f32
Rust: Accept .herb.yaml in config discovery
krystof-k Apr 23, 2026
a778bb4
Language Server: Accept .herb.yaml in file watchers and detection
krystof-k Apr 23, 2026
aadcc34
Language Server: Use configPathFromProjectPath for config file resolu…
krystof-k Apr 23, 2026
63b6302
VS Code: Accept .herb.yaml in file watchers and detection
krystof-k Apr 23, 2026
ae99aef
VS Code: Use configPathFromProjectPath for config file resolution
krystof-k Apr 23, 2026
a34c083
Config: Default to .herb.yaml
krystof-k Apr 23, 2026
71c8d36
Update user-facing references from .herb.yml to .herb.yaml
krystof-k Apr 23, 2026
45c613b
Config: Add precedence test for .herb.yaml over .herb.yml
krystof-k Apr 23, 2026
6720f84
Config: Add load test with .herb.yaml
krystof-k Apr 23, 2026
d40fd52
Rust: Add find_project_root test with .herb.yaml
krystof-k Apr 23, 2026
1d21678
Rust: Add load_from_path test with .herb.yaml
krystof-k Apr 23, 2026
0d80607
Rust: Add config filenames to PROJECT_INDICATORS
krystof-k Apr 23, 2026
5d1caa9
Docs: Update references from .herb.yml to .herb.yaml
krystof-k Apr 23, 2026
89cbcb7
Config: Preserve explicit config path in Config constructor
krystof-k Apr 23, 2026
be46e73
Merge branch 'main' into support-yaml-config-extension
krystof-k Apr 24, 2026
88ec53c
Merge branch 'main' into support-yaml-config-extension
krystof-k Jul 3, 2026
6a31cde
Config: Use imported existsSync instead of require('fs') in configPat…
krystof-k Jul 3, 2026
21bd245
VS Code / Language Server: Derive UI labels from the resolved config …
krystof-k Jul 3, 2026
7b3bb6d
CLI: Reference the resolved config filename in linter and formatter m…
krystof-k Jul 3, 2026
6d71dd6
Config: Warn when both .herb.yaml and .herb.yml exist
krystof-k Jul 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Configuration <Badge type="tip" text="^0.8.0" />

Herb uses a `.herb.yml` configuration file to customize how the tools behave in your project. This configuration is shared across all Herb tools including the linter, formatter, and language server.
Herb uses a `.herb.yaml` configuration file to customize how the tools behave in your project. This configuration is shared across all Herb tools including the linter, formatter, and language server.

## Configuration File Location

The configuration file should be placed in your project root as `.herb.yml`:
The configuration file should be placed in your project root as `.herb.yaml`:

```
your-project/
├── .herb.yml # Herb configuration
├── .herb.yaml # Herb configuration
├── Gemfile
├── app/
└── ...
Expand All @@ -18,28 +18,28 @@ your-project/

Configuration settings are applied in the following order (highest to lowest priority):

1. **Project configuration** (`.herb.yml` file)
1. **Project configuration** (`.herb.yaml` file)
2. **Editor settings** (VS Code workspace/user settings)
3. **Default settings**

## Basic Configuration

### Default Behavior (No Config File)

If no `.herb.yml` file exists in your project:
If no `.herb.yaml` file exists in your project:

- **Language Server**: Uses built-in defaults and works out-of-the-box
- **Linter**: Enabled with all rules (automatic exclusion of `parser-no-errors` in language server only)
- **Formatter**: Disabled by default (experimental feature)
- **Editor settings**: VS Code user/workspace settings are respected

::: tip Recommended for Projects
If you're using Herb in a project with multiple developers, it's highly recommended to create a `.herb.yml` configuration file and commit it to your repository. This ensures all team members use consistent linting rules and formatting settings, preventing configuration drift and maintaining code quality standards across the project.
If you're using Herb in a project with multiple developers, it's highly recommended to create a `.herb.yaml` configuration file and commit it to your repository. This ensures all team members use consistent linting rules and formatting settings, preventing configuration drift and maintaining code quality standards across the project.
:::

### Creating a Configuration File

To create a `.herb.yml` configuration file in your project, run either CLI tool with the `--init` flag:
To create a `.herb.yaml` configuration file in your project, run either CLI tool with the `--init` flag:

```bash
# Create config using the linter
Expand All @@ -59,13 +59,13 @@ This will generate a configuration file with sensible defaults:
The CLIs support a `--force` flag to override project configuration:

```bash
# Force linting even if disabled in .herb.yml
# Force linting even if disabled in .herb.yaml
herb-lint --force app/views/

# Force linting on a file excluded by configuration
herb-lint --force app/views/excluded-file.html.erb

# Force formatting even if disabled in .herb.yml
# Force formatting even if disabled in .herb.yaml
herb-format --force --check app/views/
```

Expand All @@ -75,7 +75,7 @@ When using `--force` on an explicitly specified file that is excluded by configu

Configure the linter behavior and rules:

```yaml [.herb.yml]
```yaml [.herb.yaml]
linter:
enabled: true # Enable/disable linter globally

Expand Down Expand Up @@ -182,7 +182,7 @@ linter:

Example:

```yaml [.herb.yml]
```yaml [.herb.yaml]
linter:
rules:
# This rule only runs on component files, excluding legacy ones
Expand All @@ -206,7 +206,7 @@ linter:

Configure the template engine behavior:

```yaml [.herb.yml]
```yaml [.herb.yaml]
engine:
validators:
security: true # Enable/disable security validation (default: true)
Expand All @@ -226,7 +226,7 @@ When a validator is disabled (`false`), the engine skips it entirely during comp

### Validation Mode

The `validation_mode` controls how the engine handles validation results. This is set programmatically when creating an `Herb::Engine` instance, not in `.herb.yml`:
The `validation_mode` controls how the engine handles validation results. This is set programmatically when creating an `Herb::Engine` instance, not in `.herb.yaml`:

- **`:raise`** (default): Raises an exception when validation errors are found
- **`:overlay`**: Renders validation errors as an in-browser overlay (used by [ReActionView](https://github.com/marcoroth/reactionview) in development)
Expand All @@ -249,7 +249,7 @@ Herb::Engine.new(source, validation_mode: :none)

### Overriding Validators Programmatically

Validator settings from `.herb.yml` can be overridden when creating an engine instance:
Validator settings from `.herb.yaml` can be overridden when creating an engine instance:

**Disable security validator for this template only**
```ruby
Expand All @@ -269,7 +269,7 @@ Herb::Engine.new(source, validators: {

Configure the formatter behavior:

```yaml [.herb.yml]
```yaml [.herb.yaml]
formatter:
enabled: false # Disabled by default (experimental)
indentWidth: 2 # Number of spaces for indentation
Expand All @@ -294,14 +294,14 @@ formatter:
- **`exclude`**: Array of glob patterns - Additional patterns to exclude from formatting (additive to defaults)

::: warning Experimental Feature
The formatter is currently experimental. Enable it in `.herb.yml` and test thoroughly before using in production.
The formatter is currently experimental. Enable it in `.herb.yaml` and test thoroughly before using in production.
:::

## Top-Level File Configuration

Global file configuration that applies to both linter and formatter:

```yaml [.herb.yml]
```yaml [.herb.yaml]
files:
# Additional glob patterns to include (additive to defaults, applies to all tools)
include:
Expand All @@ -326,7 +326,7 @@ File patterns are merged in the following order:

Example:

```yaml [.herb.yml]
```yaml [.herb.yaml]
files:
include:
- '**/*.xml.erb' # Applies to all tools
Expand Down Expand Up @@ -379,7 +379,7 @@ bundle exec herb config ../other-project/
Running `bundle exec herb config .` displays:

- **Project root**: The detected project root directory
- **Config file**: Path to the `.herb.yml` file (or "(using defaults)" if none)
- **Config file**: Path to the `.herb.yaml` file (or "(using defaults)" if none)
- **Include patterns**: All patterns used to find files
- **Exclude patterns**: All patterns used to exclude files
- **Files**: List of included and excluded files with their status
Expand All @@ -390,7 +390,7 @@ Example output:
Herb Configuration

Project root: /path/to/project
Config file: /path/to/project/.herb.yml
Config file: /path/to/project/.herb.yaml

Include patterns:
+ **/*.herb
Expand Down Expand Up @@ -434,7 +434,7 @@ Example output:
Herb Configuration for Linter

Project root: /path/to/project
Config file: /path/to/project/.herb.yml
Config file: /path/to/project/.herb.yaml

Include patterns (files + linter):
+ **/*.html.erb
Expand All @@ -456,7 +456,7 @@ Files for linter (40 included, 7 excluded):

::: tip Debugging Configuration
The `bundle exec herb config` command is useful for:
- Verifying your `.herb.yml` is being read correctly
- Verifying your `.herb.yaml` is being read correctly
- Understanding why certain files are included or excluded
- Debugging tool-specific patterns
- Confirming the project root detection
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/projects/dev-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The dev server consists of two parts:

Herb: 0.10.1
Project: /path/to/project
Config: .herb.yml
Config: .herb.yaml
Files: 453 templates indexed
WebSocket: ws://localhost:8592

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/projects/engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ In addition to Erubi options, `Herb::Engine` supports:

## Validators

The engine runs validators on parsed templates to catch errors before compilation. Each validator can be enabled or disabled via [`.herb.yml` configuration](/configuration#engine-configuration) or per-instance overrides.
The engine runs validators on parsed templates to catch errors before compilation. Each validator can be enabled or disabled via [`.herb.yaml` configuration](/configuration#engine-configuration) or per-instance overrides.

| Validator | Description |
|---|---|
Expand All @@ -63,7 +63,7 @@ Disable security validator for this template:
Herb::Engine.new(source, validators: { security: false })
```

See [Engine Configuration](/configuration#engine-configuration) for `.herb.yml` configuration.
See [Engine Configuration](/configuration#engine-configuration) for `.herb.yaml` configuration.

## Validation Mode

Expand All @@ -77,4 +77,4 @@ Controls how the engine presents validation results:

[ReActionView](https://github.com/marcoroth/reactionview) registers `Herb::Engine` as the template handler for `.html.erb` and `.html.herb` files in Rails. It uses `validation_mode: :overlay` so validation errors appear as in-browser overlays during development instead of raising exceptions.

Validator settings from `.herb.yml` are respected automatically — no ReActionView-specific configuration needed.
Validator settings from `.herb.yaml` are respected automatically — no ReActionView-specific configuration needed.
10 changes: 5 additions & 5 deletions javascript/packages/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ bun add @herb-tools/config

## Usage

### `.herb.yml`
### `.herb.yaml`

The configuration is stored in a `.herb.yml` file in the project root:
The configuration is stored in a `.herb.yaml` file in the project root:

```yaml [.herb.yml]
```yaml [.herb.yaml]
version: 0.10.1

linter:
Expand All @@ -51,8 +51,8 @@ formatter:

The Herb tools follow this configuration priority:

1. **Project configuration** (`.herb.yml` file) - Highest priority
1. **Project configuration** (`.herb.yaml` file) - Highest priority
2. **Editor settings** (VS Code workspace/user settings)
3. **Default settings** - Fallback when no other configuration exists

This allows teams to share consistent settings via `.herb.yml` while still allowing individual developer preferences when no project configuration exists.
This allows teams to share consistent settings via `.herb.yaml` while still allowing individual developer preferences when no project configuration exists.
Loading