Skip to content

Commit 3b98dad

Browse files
committed
Initial commit
0 parents  commit 3b98dad

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}

scope.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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

0 commit comments

Comments
 (0)