首页 > 其他分享 >vue3开启eslint报错:ESLint error: Parsing error: ‘>‘ expected,vue文件tsx语法报错解决,eslint报错tsx语法解决

vue3开启eslint报错:ESLint error: Parsing error: ‘>‘ expected,vue文件tsx语法报错解决,eslint报错tsx语法解决

时间:2024-10-24 20:32:43浏览次数:1  
标签:vue 语法 报错 eslint tsx error

出错代码部分

<script lang="tsx">
import { defineComponent } from 'vue';
import MyComponent from './components/childAbc';

const App = defineComponent({
  name: 'App',
  setup() {
    return () => (
      <div>
        <MyComponent title="欢迎" v-slots={{
          header: () => <h2>这是自定义头部内容</h2>,
          footer: () => <p>这是自定义底部内容</p>,
        }} />
      </div>
    );
  },
});

export default App;
</script>

这里eslint报错tsx语法

解决方式

eslint.config.js加入如下配置,我的eslint版本是9.7比较新的版本

{
        files: ['**/*.vue'],
        languageOptions: {
            parserOptions: {
                parser: '@typescript-eslint/parser', // 内部使用 TypeScript 解析器
                ecmaVersion: 'latest',
                sourceType: 'module',
                ecmaFeatures: {
                    jsx: true
                }
            }
        }
    },

image

标签:vue,语法,报错,eslint,tsx,error
From: https://www.cnblogs.com/jocongmin/p/18500430

相关文章

  • [Flink SQL] FlinkCdcSqlJob启动时因MYSQL serverTimeZone而报错:`The MySQL server ha
    1问题描述FlinkCdcSqlJob启动时报错...Causedby:org.apache.flink.table.api.ValidationException:TheMySQLserverhasatimezoneoffset(0secondsaheadofUTC)whichdoesnotmatchtheconfiguredtimezoneAsia/Shanghai.Specifytherightserver-time-z......
  • 【Azure Function】Python Function部署到Azure后报错No module named '_cffi_backend
    问题描述本地使用Python编写的FunctionApp,发布到AzureFunction后,出现 _cffi_backendmodule无法找到的报错。ERROR:Error:Nomodulenamed'_cffi_backend',Cannotfindmodule.Pleasechecktherequirements.txtfileforthemissingmodule.Formoreinfo,plea......
  • TruneNAS导入池时出错[ libzfs.ZFSException: ('IO error',) ]
    简述:某天TrueNAS无故宕机,经检查服务器内存检测失败(32G只识别了16G),除灰,重插内存,系统启动成功,登录后池error,手动导入报错。问题借图,本地报错与该图一致,导入池错误代码参考代码块错误:concurrent.futures.process._RemoteTraceback:"""Traceback(mostrecentcalllast)......
  • 基于vben框架的vue前端代码编译时报错
    在Node18.16和16.20版本下使用vben框架时,遇到pnpminstall报错关于eslint-config缺失的问题,解决方案是通过添加pnpm-workspace.yaml文件并指定内部依赖,确保`@vben/eslint-config`版本配置正确。问题描述node18.16/node16.20中编译vben框架的vue前端代码,pnpminstall报错:"@v......
  • 阿里旺旺gdiplus.dll报错?阿里旺旺gdiplus.dll常见错误及解决方案大放送
    针对阿里旺旺gdiplus.dll报错的问题,以下是一些常见的错误类型及其解决方案的大放送:一、gdiplus.dll文件缺失或损坏现象:阿里旺旺无法正常启动。在运行过程中出现图形界面错误、程序崩溃等问题。解决方案:重启计算机:有时,系统中的临时问题可能导致gdiplus.dll文件未正常......
  • 报error:0308010C:digital envelope routines::unsupported错--nodejs版本过高(nvm安
    最近小编入职实习,运行(npmrundev)前端项目时报error:0308010C:digitalenveloperoutines::unsupported的错,一查发现原来是nodejs版本过高,与项目不匹配。接下来介绍更换nodejs版本的方法。第一种:官网下载通过nodejs官网下载安装,但有个缺陷,不同版本的nodejs无法顺利的切换......
  • 【Ambari编译报错】phantomjs从github上下载失败导致无法编译的问题
    PhantomJS下载失败问题1.错误分析下面是完整的报错日志:[ERROR]npmverbunsafe-perminlifecycletrue[ERROR]npmverbunlockdoneusing/root/.npm/_locks/phantomjs-ca2567298810d09d.lockfor/opt/modules/ambari/ambari-admin/src/main/resources/ui/admin-......
  • YOLOv5-6.0训练出错及解决方法(RuntimeError)
    知识经验分享——YOLOv5-6.0训练出错及解决方法(RuntimeError)一、问题bug不知道小伙伴们在训练YOLOv5-6.0或者其他版本有没有遇到以下问题:RuntimeError:resulttypeFloatcan'tbecasttothedesiredoutputtypelongint二、解决方法步骤1:打开utils/loss.py文......
  • 【Azure Developer】使用JavaScript通过SDK进行monitor-query的client认证报错问题
    问题描述使用JavaScript通过SDK进行monitor-query的client初始化时候,需要进行认证时报错AADSTS90002。代码如下:constcredential=newDefaultAzureCredential();constlogsQueryClient=newLogsQueryClient(credential,{endpoint:"https://api.loganalytics.azur......
  • 安装dedecms进入后台出现DedeCMS Error:等
    根据您提供的信息,DedeCMS在PHP5.3及以上版本中出现了 DedeCMSError:(PHP5.3andabove)Pleaseset'request_order'inivaluetoincludeC,GandP(recommended:'CGP') 的错误提示。这是因为DedeCMS需要 request_order 配置项包含 C, G 和 P,以确保正确处理......