Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

Latest commit

 

History

History
31 lines (21 loc) · 890 Bytes

no-trivially-nested-lookaround.md

File metadata and controls

31 lines (21 loc) · 890 Bytes

no-trivially-nested-lookaround 🔧

Disallow lookarounds that only contain another assertion.

configuration in plugin:clean-regex/recommended: "warn"

Source file
Test file

Description

It's possible to nest lookarounds as deep as you want without changing the formal language of the regular expression. The nesting does not add meaning only making the pattern longer.

Examples

Examples of valid code for this rule:

/a(?!$)/

Examples of invalid code for this rule:

/(?=\b)/    // == \b
/(?=(?!a))/ //== (?!a)