Skip to content

regexUnusedQuantifiers

Reports quantifiers that match exactly once, making them unnecessary.

✅ This rule is included in the ts logical presets.

Reports quantifiers that match exactly once ({1} or {1,1}), which are unnecessary because the element already matches exactly once by default.

const pattern = /a{1}/;
const pattern = /a{1,1}/;
const pattern = /(ab){1}/;
const pattern = /[a-z]{1}/;

This rule is not configurable.

If you intentionally use {1} quantifiers for documentation or consistency purposes, you might want to disable this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.