Skip to content

[restrict-template-expressions] add option to allow regular expressions #3671

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/restrict-template-expressions": ["error"]
  }
}
function log(value: RegExp) {
  console.log(`${value}`);
}

Expected Result

Since RegExp defines .toString(), I would expect that there would be options to allow printing them similar to allowBoolean.

Actual Result

No way to make this allowed without disabling the rule.

Additional Info

Context: hoping to enable this internally for #3278.

Versions

package version
@typescript-eslint/eslint-plugin 4.28.5
@typescript-eslint/parser 4.28.5
TypeScript 4.3.5
ESLint 7.27.0
node 16.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions