Description
The rules [no-empty-group] and [no-empty-capturing-group] trigger when the group has been filled from a joined array that has been filled dynamically using push
.
const arr = [];
arr.push("a", "b"); // simplified; original code processes some other data
const rex = new RegExp("(" + arr.join("|") + ")");
This (simplified) example triggers because the rules seem to see only the initialization to an empty array. The rule could be improved by detecting inplace manipulations with push
, unshift
etc.