Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c50f70b

Browse files
authored
chore(eslint-plugin): remove lodash from dependencies (typescript-eslint#3478)
1 parent e2e76a7 commit c50f70b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

packages/eslint-plugin/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@typescript-eslint/scope-manager": "4.27.0",
4949
"debug": "^4.3.1",
5050
"functional-red-black-tree": "^1.0.1",
51-
"lodash": "^4.17.21",
5251
"regexpp": "^3.1.0",
5352
"semver": "^7.3.5",
5453
"tsutils": "^3.21.0"

packages/eslint-plugin/src/util/astUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
2-
import escapeRegExp from 'lodash/escapeRegExp';
2+
import { escapeRegExp } from './escapeRegExp';
33

44
// deeply re-export, for convenience
55
export * from '@typescript-eslint/experimental-utils/dist/ast-utils';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Lodash <https://lodash.com/>
3+
* Released under MIT license <https://lodash.com/license>
4+
*/
5+
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
6+
const reHasRegExpChar = RegExp(reRegExpChar.source);
7+
8+
export function escapeRegExp(string = ''): string {
9+
return string && reHasRegExpChar.test(string)
10+
? string.replace(reRegExpChar, '\\$&')
11+
: string;
12+
}

0 commit comments

Comments
 (0)