1

In a ReactJS app, I have an index.js file with the following imports:

export MainContainer from './Main/MainContainer';
export AboutContainer from './About/AboutContainer';

When I run ESLINT, I get the following error:

error  Parsing error: Unexpected token MainContainer

The error message is not referencing any of the eslint rules set up in .eslintrc.json. The app runs fine in Chrome with no console errors. Why is eslint throwing the error?

1 Answer 1

2

You have export instead of import while trying to import. Try:

import MainContainer from './Main/MainContainer';
import AboutContainer from './About/AboutContainer';

;)

If you're trying to re-export components, you'll need the braces:

export { MainContainer } from './Main/MainContainer';
export { AboutContainer } from './About/AboutContainer';

If it's re-exporting default exports:

export { default as MainContainer } from './Main/MainContainer';
export { default as AboutContainer } from './About/AboutContainer';
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I'll consider it a non-issue :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.