Skip to content

Invalid error message when validating plugin options #9877

@blikblum

Description

@blikblum

Bug Report

Current Behavior
When a plugin has an invalid option, it throws a misleading error, making harder to discover the issue.

This occurs in validatePluginObject which calls the validator with the option key (string) and value. But the validator (e.g. assertFunction) expects a NestingPath | GeneralPath instead of a string. When the validator fails it calls msg with the string param instead of a loc giving a "Assertion failure: Unknown type undefined" error instead of the proper error; "inherits must be a function, or undefined"

Probably introduced by #8493

Input Code

Expected behavior/code
Should throw a meaningful message when plugin option is invalid like "inherits must be a function, or undefined"

Babel Configuration (.babelrc, package.json, cli command)

Using babel standalone:
https://unpkg.com/@babel/standalone/babel.min.js

Environment

  • Babel version(s): [7.4]
  • Node/npm version: [browser]
  • OS: [Windows 10]
  • Monorepo: [no]
  • How you are using Babel: [standalone]

Possible Solution

Additional context/Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: errorsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions