See: http://eslint.org/docs/rules/func-style
My personal preference is to prefer declaration
style, as it allows hoisting (and just looks better to me). The only issue is when you want to reassign:
var func = function () {
}
if (someCondition) {
func = wrap(func);
}
ESLint's func-style
rule does not accommodate the above exception when preferring declarations, so it is impractical to enforce.
Note:
You can get around ELint's rule by doing this:
var func; // don't initialize variable here, do it on the next line
func = function () {
}
But that feels impractical.
Do we feel it's worth enforcing func-style
in XO? Should we use the builtin plugin to do so, or make our own that is a bit more permissive.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too