File tree 2 files changed +52
-0
lines changed
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ </div >
4
+ </template >
5
+
6
+ <script setup lang="ts">
7
+ let test = ' hello-world'
8
+ </script >
9
+
10
+ <style lang="ts">
11
+ const testStyle = {
12
+ backgroundColor: ' red' ,
13
+ color: ' blue'
14
+ }
15
+ </style >
16
+
17
+ <custom lang="ts">
18
+ const testi18n = {
19
+ en: ' hello World' ,
20
+ de: ' Hallo Welt'
21
+ }
22
+ </custom >
Original file line number Diff line number Diff line change @@ -539,6 +539,36 @@ describe("Basic tests", () => {
539
539
} )
540
540
} )
541
541
542
+ describe ( "About fixtures/lang-ts" , ( ) => {
543
+ it . only ( 'Should parse lang="ts" blocks as script blocks' , ( ) => {
544
+ const ast = parse (
545
+ [
546
+ "<template><div></div></template>" ,
547
+ '<script lang="ts">const test = "test"</script>' ,
548
+ '<style lang="ts">const testStyle = {}</style>' ,
549
+ '<custom lang="ts">const testCustom = {}</custom>' ,
550
+ ] . join ( "\n" ) ,
551
+ )
552
+ const body = ast
553
+ } )
554
+ it . only ( 'Should treat lang="ts" blocks as script tags' , async ( ) => {
555
+ const cli = new ESLint ( {
556
+ cwd : FIXTURE_DIR ,
557
+ overrideConfig : {
558
+ env : { browser : true , node : true } ,
559
+ parser : PARSER_PATH ,
560
+ parserOptions : {
561
+ ...BABEL_PARSER_OPTIONS ,
562
+ sourceType : "module" ,
563
+ ecmaVersion : 2017 ,
564
+ } ,
565
+ } ,
566
+ useEslintrc : false ,
567
+ } )
568
+ const report = await cli . lintFiles ( [ "lang-ts.vue" ] )
569
+ } )
570
+ } )
571
+
542
572
describe ( "About unexpected-null-character errors" , ( ) => {
543
573
it ( "should keep NULL in DATA state." , ( ) => {
544
574
const ast = parse ( "<template>\u0000</template>" )
You can’t perform that action at this time.
0 commit comments