-
-
Notifications
You must be signed in to change notification settings - Fork 360
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: default-export-function-style
#1089
Comments
I think that that code won’t pass an existing rule already: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md Also #154 |
I'm aware, but we cannot assume other rules. We need to decide how to handle that case. |
Then I think it should be covered by the “function” style |
I don’t think it should be called "function/variable" however, they're all functions: function foo() {}
const foo = () => {}
let foo = function () {} Maybe these are export default function () {}
export default function foo () {}
export default () => {} And this should be export default foo; // However the `foo` function is defined is irrelevant Discussing this rule further: Do you want to apply the same rule to classes? Maybe the logic should be: if it can be inlined and named at the same time, then it should be part of this rule. As far as I know only functions and classes can be that (in the example above, |
Sounds good. How about |
I think it makes sense for classes, but not objects or variables. Maybe we should just do an options-object? {
functions: 'statement',
classes: 'statement',
objects: 'inline',
values: 'inline'
} |
If we agree with |
Alright. Let's try that first. |
Personally I don't use |
I use inline exports all the time. For defaults, I still prefer inline exports if they can be named inline (functions, classes) |
I used to prefer non-inline so I could use arrow functions, but lately I'm preferring inline |
Whether to prefer a default export as a named function or a const variable with an arrow function.
It should default to
function
style.It should be auto-fixable.
Fail
Pass
Open question. What should happen to:
Should we have a separate style for that or just disallow it for both
function
andvariable
style?The text was updated successfully, but these errors were encountered: