File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
packages/eslint-plugin-tslint Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 38
38
"typecheck" : " tsc -p tsconfig.json --noEmit"
39
39
},
40
40
"dependencies" : {
41
- "@typescript-eslint/utils" : " 5.57.0" ,
42
- "lodash" : " ^4.17.21"
41
+ "@typescript-eslint/utils" : " 5.57.0"
43
42
},
44
43
"peerDependencies" : {
45
44
"eslint" : " ^6.0.0 || ^7.0.0 || ^8.0.0" ,
Original file line number Diff line number Diff line change 1
1
import { ESLintUtils } from '@typescript-eslint/utils' ;
2
- import memoize from 'lodash/memoize' ;
3
2
import type { RuleSeverity } from 'tslint' ;
4
3
import { Configuration } from 'tslint' ;
5
4
6
5
import { CustomLinter } from '../custom-linter' ;
7
6
7
+ function memoize < T extends ( ...args : never [ ] ) => unknown > (
8
+ func : T ,
9
+ resolver : ( ...args : Parameters < T > ) => string ,
10
+ ) : T {
11
+ const cache = new Map < string , ReturnType < T > > ( ) ;
12
+ const memoized = function ( ...args ) {
13
+ const key = resolver ( ...( args as Parameters < T > ) ) ;
14
+
15
+ if ( cache . has ( key ) ) {
16
+ return cache . get ( key ) ! ;
17
+ }
18
+ const result = func ( ...args ) ;
19
+ cache . set ( key , result as ReturnType < T > ) ;
20
+ return result ;
21
+ } as T ;
22
+ return memoized ;
23
+ }
24
+
8
25
// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
9
26
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10
27
const version : string = require ( '../../package.json' ) ;
You can’t perform that action at this time.
0 commit comments