Summary
The config loader in src/config.ts currently only reads flaglint.config.json. Many teams prefer YAML for config files because it supports comments and is less noisy for arrays and nested objects. Supporting .flaglintrc.yml / .flaglintrc.yaml as an alternative to flaglint.config.json lowers the friction for adopting FlagLint in projects that already use YAML-based tooling.
Proposed lookup order
When no --config path is passed explicitly, the loader tries in order:
flaglint.config.json (existing behaviour — unchanged)
.flaglintrc.json
.flaglintrc.yml
.flaglintrc.yaml
The first file found wins. If none is found, defaults apply (also existing behaviour).
Acceptance criteria
.flaglintrc.yml and .flaglintrc.yaml are parsed and validated through the same Zod schema as JSON config
- An explicit
--config path/to/custom.yml also works for YAML files
- A YAML config example is added to the docs config reference page
- Tests cover: JSON config (existing), YAML config (new), explicit
--config with YAML path
- Error messages for invalid YAML config are clear (include the file path and the parse error)
Implementation notes
- Use the
js-yaml package (already extremely common; tiny footprint) or Node's --experimental-strip-types to avoid a new runtime dependency — confirm which fits the project's dep philosophy
- Alternatively, a minimal YAML parser subset (just the types FlagLint uses: strings, numbers, booleans, arrays, objects) can be hand-rolled in ~50 lines to keep the dependency count at zero
- The Zod validation layer does not change — YAML is parsed to a plain object first, then validated identically to JSON
Files likely touched
src/config.ts — extend loader to probe YAML filenames and parse YAML
src/config/tests/config.test.ts — add YAML config test cases
docs-src/ — update config reference page
package.json — add js-yaml if that route is chosen (needs ADR comment if a new runtime dep)
Summary
The config loader in
src/config.tscurrently only readsflaglint.config.json. Many teams prefer YAML for config files because it supports comments and is less noisy for arrays and nested objects. Supporting.flaglintrc.yml/.flaglintrc.yamlas an alternative toflaglint.config.jsonlowers the friction for adopting FlagLint in projects that already use YAML-based tooling.Proposed lookup order
When no
--configpath is passed explicitly, the loader tries in order:flaglint.config.json(existing behaviour — unchanged).flaglintrc.json.flaglintrc.yml.flaglintrc.yamlThe first file found wins. If none is found, defaults apply (also existing behaviour).
Acceptance criteria
.flaglintrc.ymland.flaglintrc.yamlare parsed and validated through the same Zod schema as JSON config--config path/to/custom.ymlalso works for YAML files--configwith YAML pathImplementation notes
js-yamlpackage (already extremely common; tiny footprint) or Node's--experimental-strip-typesto avoid a new runtime dependency — confirm which fits the project's dep philosophyFiles likely touched
src/config.ts— extend loader to probe YAML filenames and parse YAMLsrc/config/tests/config.test.ts— add YAML config test casesdocs-src/— update config reference pagepackage.json— addjs-yamlif that route is chosen (needs ADR comment if a new runtime dep)