Skip to content

[generic-type-naming] Support regex literal for config properties that accept regex string #143

Closed
@sindresorhus

Description

@sindresorhus

Would be nice to be able to use regex literals to not have to double-escape certain characters when using JS-based ESLint config.

Before

'@typescript-eslint/generic-type-naming': [
	'error',
	'^[A-Z][a-zA-Z\\d]+$'
],

After

'@typescript-eslint/generic-type-naming': [
	'error',
	/^[A-Z][a-zA-Z\d]+$/
],

It also means it becomes syntax highlighted and ESLint (through some built-in rules) can prevent some common mistakes when you lint the config itself.

This would require changes to the following rules:

  • @typescript-eslint/generic-type-naming
  • @typescript-eslint/member-naming
  • @typescript-eslint/no-unused-vars

Related ESLint issue: eslint/eslint#11318

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