gpt4 book ai didi

javascript - Sonar 扫描仪 - 错误 : Failed to parse file with espree parser in module mode

转载 作者:搜寻专家 更新时间:2023-11-01 00:35:43 28 4
gpt4 key购买 nike

在 Node 项目上运行 sonar-scanner 时,出现无法解析文件错误,如下所示

ERROR: Failed to parse file [file:///home/node-app/somedir/index.js] at line 1: Unexpected token './AddCat' (with espree parser in module mode)

我的 index.js 文件如下所示:

export default from './AddCat';

我的 AddCat.js 文件如下所示:

import React from 'react';
import { Image } from '@cat-ui/core';

import { translate } from 'client/helpers/language';
import Page from 'client/components/Page';

import { StyledText, StyledButton, StyledImagePlaceholder } from './AddCat.styled';
import AdditionalApplicant from './images/additional_applicant.png';

const AddCat = () => (
<Page>
<StyledImagePlaceholder>
<Image width="67px" height="60px" src={AdditionalApplicant} />
</StyledImagePlaceholder>
<StyledText color="grey">{translate('AddCatText')}</StyledText>
<StyledButton
tag="a"
color="secondary"
href="/morecats/morecats.html?route=V1&sharedCat=true"
label={translate('AddCatButton')}
/>
</Page>
);

export default AddCat;

问题仅出在 index.js 而不是运行 sonar-scanner 时的 AddCat.js。我认为这是某种格式问题,非常感谢您提供解决问题的帮助。

问候,阿舒托什

最佳答案

语法 export default fromstage 1 proposal . SonarQube 仅支持开箱即用的 ES 2018 语法。实际上,这意味着不会在此文件中检测到任何问题。

关于javascript - Sonar 扫描仪 - 错误 : Failed to parse file with espree parser in module mode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52876717/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com