Galooshi / import-js

A tool to simplify importing JS modules
MIT License
524 stars 70 forks source link

Better schema validation errors #615

Open mikabytes opened 6 months ago

mikabytes commented 6 months ago

As of #612 we introduce configuration validation with minimal error messages.

It would be nice if we extended it to provide better error messages.

Example:

{
  aliases: 123
}
// "messages":["Invalid configuration: `aliases`"]

While this communicates that there is an issue, it doesn't explain what the required type is. A better error message would be

Invalid configuration: `aliases` was of type number, but expected object

Discussion started here with some suggestions for how to achieve it.