eslint-plugin-lookbehind-assertions
An ESLint plugin that disallows the use of regular expression lookbehind assertions.
Installation
npm install --save-dev eslint-plugin-lookbehind-assertions
Or
yarn add --dev eslint-plugin-lookbehind-assertions
Usage
Modify your .eslintrc
// .eslintrc.json
module.exports = {
"plugins": [
...,
"lookbehind-assertions"
],
"rules": [
...,
"lookbehind-assertions/no-lookbehind-assertions-regexp": "error"
]
...,
}
Rules
Rule ID | Description |
---|---|
no-lookbehind-assertions-regexp | Disallows the use of regular expression lookbehind assertions |
Examples
Examples of incorrect code:
let re = /(?<=ripe )orange/;
re = new RegExp('(?<=ripe )orange');
Examples of correct code:
let re = /\d+(?=%)/;
re = new RegExp('d+(?=%)');
License
MIT