Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint error on prefer-default with export * in index.js #897

Closed
safaiyeh opened this issue Jul 19, 2017 · 2 comments
Closed

ESLint error on prefer-default with export * in index.js #897

safaiyeh opened this issue Jul 19, 2017 · 2 comments

Comments

@safaiyeh
Copy link

Tell us about your environment

  • ESLint Version: ^3.19.0
  • Node Version: v4.2.6
  • npm Version: 5.1.0
    What parser (default, Babel-ESLint, etc.) are you using? babel-eslint"@^7.2.3

Please show your full configuration:

Configuration

What did you do? Please include the actual source code causing the issue.

{
    "extends": "airbnb",
    "parser": "babel-eslint",
    "globals": {
        "__DEV__": true
    },
    "plugins": [
        "react",
        "react-native",
        "jsx-a11y",
        "import"
    ],
    "rules": {
      ...
    }
}

What did you expect to happen?
I am using export * to export all components in a directory.

import React, { Component } from 'react';

class MyComponent extends Component {
   ...
}
export { MyComponent };

index.js

export * from './MyComponent';

export { MyComponent } results in an error in prefer-default-export

@ljharb
Copy link
Member

ljharb commented Jul 19, 2017

That's the intended result. MyComponent.js should have export default MyComponent, and your index file should do export { default as MyComponent } from './MyComponent';

@safaiyeh
Copy link
Author

That solved it thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants