[naming-convention] Allow "selector" to specify an array of selectors #2266
Labels
enhancement: plugin rule option
New rule option for an existing eslint-plugin rule
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Repro
Suppose I want to define an option block that applies to several selectors, which do not match up with one of the predefined "group selectors". Currently the option block needs to be duplicated, like this:
Expected Result
It should be possible to avoid duplication by specifying an array of selectors, like this:
Additional Info
This arose in a real world situation with this option block and a number of other cases in that same file.
I solved it by creating a macro expandNamingConventionSelectors() that expands the
selectors
array into multiple blocks with differentselector
fields.This worked, however it is clumsy. Also, one of our repos creates a test snapshot with the expanded eslintrc object, and the macro output is difficult to read after it is expanded.
It would be better if
naming-convention
had built-in support for array of selectors, without need for a macro to generate the blocks. I can't think of any design problems with allowing that.Versions
@typescript-eslint/eslint-plugin
3.3.0
@typescript-eslint/parser
3.3.0
TypeScript
3.5.3
ESLint
7.2.0
node
12.17.0
npm
6.14.4
The text was updated successfully, but these errors were encountered: