Skip to content

Bug: better error handling for undefined extensions #10176

Closed
@mstykow

Description

@mstykow

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

typescript-eslint

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

As of #10094, an undefined extension, i.e., undefined as part of extends, will lead to a runtime error of the form

Cannot read properties of undefined (reading "name")

The above PR is the first time that we require that extensions passed to the extends array are actually valid. Note that the config is typed correctly, but that the typechecker cannot help in many cases because the default export, or at least the configs object, of many a plugin is any. Before this PR, undefined extensions were simply ignored silently.

I propose that we improve the error handling of the extends array and instead say something along the following lines whenever we detect an undefined extension:

Some of your extensions are undefined, likely due to a problem with their import path.

Additional Info

Upon upgrading typescript-eslint to 8.10.0, I discovered several undefined extensions but it took me a while to figure out what the problem was because of the initial, not-so-helpful error message. Here is the PR where I upgrade and fix the undefined extension issue in my repo: https://github.com/opossum-tool/OpossumUI/pull/2668/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2L59

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions