While running sonar-scanner on a node project, I get a Failed to parse file error, which looks like this
ERROR: Failed to parse file [file:///home/node-app/somedir/index.js] at line 1: Unexpected token './AddCat' (with espree parser in module mode)
And my index.js file looks like this:
export default from './AddCat';
And my AddCat.js file looks like this:
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;
The problem is only with index.js and not AddCat.js while running sonar-scanner. I think it's some kind of formatting issue and any help in figuring out the problem is highly appreciated.
Regards, Ashutosh