Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.19 KB

no-trivially-nested-assertion.md

File metadata and controls

49 lines (32 loc) · 1.19 KB
pageClass sidebarDepth title description since
rule-details
0
regexp/no-trivially-nested-assertion
disallow trivially nested assertions
v0.9.0

regexp/no-trivially-nested-assertion

💼 This rule is enabled in the ✅ plugin:regexp/recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

disallow trivially nested assertions

📖 Rule Details

Lookaround assertions that only contain another assertion can be simplified.

/* eslint regexp/no-trivially-nested-assertion: "error" */

/* ✓ GOOD */
var foo = /a(?=b)/;
var foo = /a(?!$)/;

/* ✗ BAD */
var foo = /a(?=$)/;
var foo = /a(?=(?!a))/;

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-regexp v0.9.0

🔍 Implementation