Accepted answer

here is how i resolved the issue.

    • add the following content to your .babelrc file and make sure .babelrc is in the root folder
{ "presets": ["env","react"] }
    • make sure you exclude static assets like css, images, scss, pdf, fonts, etc. add the following to package.json as highlighted in the screenshot
"modulenamemapper": {
  "\\.(css|less)$": "<rootdir>/__mocks__/stylemock.js"




if anybody comes here to figure out what is happening, i think the accepted answer is not related to the issue here.

when the file extension is .js and if you try to write jsx in that file, linter will complain if you have a correct eslint configuration.

instead, try to change the file extension to .jsx or .tsx (if typescript involved).

Related Query

More Query from same tag