8000 Bug: [no-base-to-string] hit URL object but should not · Issue #4999 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Bug: [no-base-to-string] hit URL object but should not #4999
Closed
@HolgerJeromin

Description

@HolgerJeromin

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=4.7.1-rc&sourceType=module&code=BQOwpg7gBAogTnA9nYByARkg1mEqCU+AdAC6IDKJcAliAObD5A&rules=N4IgAgLgngDgpgZwMYCcCWMIFpEBs0B2EA9AQPZYBGAhgnFhBQhOgQOYgBcIcKKZKEAF8gA&tsConfig=N4XyA

Repro Code

(new Error('broken')).toString()

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-base-to-string": ["error"],
  },
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

The code should be fine as the runtime output is:
'Error: broken'

Actual Result

eslint reports:
'new Error('broken') will evaluate to '[object Object]' when stringified.ESLint (@typescript-eslint/no-base-to-string)

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 5.24.0
@typescript-eslint/parser 5.24.0
TypeScript 4.6.2
ESLint 8.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0