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

Rule proposal: no-named-export #1156

Closed
fsmaia opened this issue Aug 8, 2018 · 1 comment
Closed

Rule proposal: no-named-export #1156

fsmaia opened this issue Aug 8, 2018 · 1 comment

Comments

@fsmaia
Copy link
Contributor

fsmaia commented Aug 8, 2018

Although it has uncommon usages, it would be nice to have a no-named-export rule to enforce export default only.

This may be useful, for example, when defining that a component file may not expose its helpers, giving this file a single purpose, forcing helpers to be put in a proper file/layer with specific rules and behaviors; and organizing those module exports in an index file.

In a practical example:

// valid
import React from 'react';

const App = () => (<div className="App">App</div>);

export default App;
// valid
import React from 'react';

const title = 'App';

const App = () => (<div className="App">{title}</div>);

export default App;
// invalid
import React from 'react';

export const title = 'App';

const App = () => (<div className="App">{title}</div>);

export default App;
@ljharb
Copy link
Member

ljharb commented Aug 8, 2018

Since we have no-default, we should also have no-named.

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

No branches or pull requests

2 participants