Skip to content

[no-base-to-string] False positive for tagged tepmplates #1757

@susisu

Description

@susisu

Repro

{
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "parserOptions": {
    "ecmaVersion": 2019,
    "sourceType": "module",
    "project": "./tsconfig.json"
  },
  "rules": {
    "@typescript-eslint/no-base-to-string": "error"
  }
}
declare function tag(xs: TemplateStringsArray, ...ys: unknown[]): void;
tag`${{}}`;

Expected Result
No lint errors because the tag does not necessarily stringify the interpolated values.

Actual Result
Lint error is reported.
2:7 error '{} will evaluate to '[Object object]' when stringified @typescript-eslint/no-base-to-string

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.24.0 and 2.24.1-alpha.0
@typescript-eslint/parser 2.24.0 and 2.24.1-alpha.0
TypeScript 3.7.5
ESLint 6.8.0
node 12.14.1
npm 6.13.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin rulegood first issueGood for newcomershas prthere is a PR raised to close thispackage: 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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy