Skip to content

prefer-default-export doesn't understand destructoring #342

Closed
@scottnonnenberg

Description

The prefer-default-export rule fires when I do this:

// typography.js
export const { rhythm, TypographyStyle } = typography;

But I get import-named complaining that 'rhythm' cannot be found when I change it back to:

// typography.js
export default typography;

And continue to reference it like this:

// component.js
import { rhythm } from 'utils/typography';

I guess I prefer the first option, but that would require that prefer-default-export understand destructuring.

On the other hand, do we really want to be that restrictive on the import destructuring check? Isn't it reasonable to destructure a default export?

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions