File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " vue-eslint-parser-script-setup-custom-parser-scope" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " echo \" Error: no test specified\" && exit 1"
8
+ },
9
+ "type" : " module" ,
10
+ "keywords" : [],
11
+ "author" : " Daniel Martens" ,
12
+ "license" : " MIT" ,
13
+ "devDependencies" : {
14
+ "@typescript-eslint/parser" : " 7.4.0" ,
15
+ "vue-eslint-parser" : " 9.4.2"
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ import { parseForESLint } from 'vue-eslint-parser' ;
2
+
3
+ const code = [
4
+ '<script setup lang="ts">' ,
5
+ 'function fn() {}' ,
6
+ '</script>' ,
7
+ ] . join ( '\n' ) ;
8
+
9
+ const { scopeManager } = parseForESLint ( code , { parser : { ts : '@typescript-eslint/parser' } } ) ;
10
+ const [ moduleScope ] = scopeManager . globalScope . childScopes ;
11
+ console . log ( moduleScope . childScopes . length ) ; // Is 0 should be one for the function declaration
You can’t perform that action at this time.
0 commit comments