eslint-plugin-lookbehind-assertions

1.0.3 • Public • Published

eslint-plugin-lookbehind-assertions

An ESLint plugin that disallows the use of regular expression lookbehind assertions.

npm version License: MIT Twitter

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

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i eslint-plugin-lookbehind-assertions

    Weekly Downloads

    1,026

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    12.1 kB

    Total Files

    15

    Last publish

    Collaborators

    • takuya.nakayasu