This repository was archived by the owner on Aug 18, 2021. It is now read-only.
File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
- let patched = false ;
4
-
5
3
exports . parse = function ( code , options ) {
6
- patched = true ;
7
4
return require ( "./parse-with-patch" ) ( code , options ) ;
8
5
} ;
9
6
10
7
exports . parseForESLint = function ( code , options ) {
11
- if ( ! patched && options . eslintVisitorKeys && options . eslintScopeManager ) {
8
+ if ( options . eslintVisitorKeys && options . eslintScopeManager ) {
12
9
return require ( "./parse-with-scope" ) ( code , options ) ;
13
10
}
14
11
15
- patched = true ;
16
12
return { ast : require ( "./parse-with-patch" ) ( code , options ) } ;
17
13
} ;
18
14
Original file line number Diff line number Diff line change @@ -539,4 +539,16 @@ describe("Public API", () => {
539
539
babelEslint . parseNoPatch ( "foo" , { } )
540
540
) ;
541
541
} ) ;
542
+
543
+ it ( "still provides a custom scope with parseForESLint after calling parse()" , ( ) => {
544
+ assertImplementsAST (
545
+ espree . parse ( "foo" , { sourceType : "module" } ) ,
546
+ babelEslint . parse ( "foo" , { } )
547
+ ) ;
548
+ const parseForESLintResult = babelEslint . parseForESLint ( "foo" , {
549
+ eslintVisitorKeys : true ,
550
+ eslintScopeManager : true ,
551
+ } ) ;
552
+ assert ( parseForESLintResult . visitorKeys ) ;
553
+ } ) ;
542
554
} ) ;
You can’t perform that action at this time.
0 commit comments