Skip to content

Commit

Permalink
chore:nicer demo example
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Dec 2, 2021
1 parent 336a8ef commit b98233c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

eslint-plugin-no-lookahead-lookbehind-regexp
==============================
<img src="https://github.com/JonasBa/eslint-plugin-no-lookahead-lookbehind-regexp/blob/d42144e58aa0e428b0ad0d3bd43b070b835e07b0/example.gif?raw=true" width="70%"/>
<img src="https://github.com/JonasBa/eslint-plugin-no-lookahead-lookbehind-regexp/blob/main/example.gif?raw=true" width="70%"/>

Lint the use of lookahead and lookbehind regexp expression. The expression is problematic, as compiling it in an unsupported browser will throw an error. The plugin handles both [literal and constructor notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp#literal_notation_and_constructor).
Lint the use of lookahead and lookbehind regexp expression. The expression is problematic, as compiling it in an unsupported browser will throw an error and possibly crash your browser. The plugin handles both [literal and constructor notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp#literal_notation_and_constructor).

### 1. Install

Expand Down
Binary file modified example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"eslint": "^8.3.0"
},
"scripts": {
"benchmark": "ts-node test/benchmark.ts",
"build": "rm -rf ./lib && yarn tsc",
"test": "jest",
"tsc": "tsc",
"test:watch": "jest --watch",
"benchmark": "ts-node test/benchmark.ts"
"test": "jest",
"test:watch": "jest --watch"
},
"devDependencies": {
"@types/benchmark": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/analyzeRegExpForLookaheadAndLookbehind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type UnsupportedExpression = {

function analyzeRegExpForLookaheadAndLookbehind(input: string): UnsupportedExpression[] {
// Lookahead and lookbehind require min 5 characters to be useful, however
// an expression like /(?=)/ which uses only 4, can still crash an application
// an expression like /(?=)/ which uses only 4, although not useful, can still crash an application
if (input.length < 4) return [];

let current = 0;
Expand Down

0 comments on commit b98233c

Please sign in to comment.