At the moment, YAML files are loaded with require('js-yaml').load(), while JSON uses JSON.parse(). It might make sense to switch both of these to use require('yaml').parse() instead. This would have the following benefits:
yaml has better YAML spec compliance; see the YAML Test Matrix, which shows results for js-yaml as "js-yaml-json" and yaml as "js-event" and "js-json".
- Safer config data loading, as the
js-yaml load() supports JavaScript being encoded in YAML files. Obviously NYC also supports .js files for config, but it might still be surprising for a config loaded from a YAML file not to be guaranteed inert.
- Better error reporting, in particular for JSON files -- JSON is a subset of YAML, and can be loaded as such.
- Support for
# comments in JSON files.
As disclosure, I'm the developer of yaml, so my opinions may be a little biased here. I'm interested, as yaml itself ends up having @istanbuljs/load-nyc-config as a dev dependency. I would be quite willing to submit a PR for this change, but thought it'd be more polite to ask first.
At the moment, YAML files are loaded with
require('js-yaml').load(), while JSON usesJSON.parse(). It might make sense to switch both of these to userequire('yaml').parse()instead. This would have the following benefits:yamlhas better YAML spec compliance; see the YAML Test Matrix, which shows results forjs-yamlas "js-yaml-json" andyamlas "js-event" and "js-json".js-yamlload() supports JavaScript being encoded in YAML files. Obviously NYC also supports .js files for config, but it might still be surprising for a config loaded from a YAML file not to be guaranteed inert.# commentsin JSON files.As disclosure, I'm the developer of
yaml, so my opinions may be a little biased here. I'm interested, asyamlitself ends up having@istanbuljs/load-nyc-configas a dev dependency. I would be quite willing to submit a PR for this change, but thought it'd be more polite to ask first.