Closed jrhorn424 closed 8 years ago
@jrhorn424 Thoughts on this:
const fn = function () {
return 42;
};
let o = {
fn,
};
versus this:
let o = {
fn () {
return 42;
},
};
?
Does it depend? With closures? I don't know enough about ember to say how that influences the preferred syntax, but I think I prefer the former.
It's idiomatic in Ember to define methods inline while inheriting (extending) another object. The usual pattern looks like:
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
close () {
return this.sendAction('close');
}
}
});
So the linter change allows this sort of code. In general, as you do, I prefer defining methods separately from the export.
This also makes the linting for method shorthand consistent with linting for function definitions, which allows a space before parens.
So, do we require the space? From node-template
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
I actually prefer no space, but perhaps consistency should win.
There were inconsistencies between the linter in atom and the linter on the command line. I was under the impression that the AirBnB preset used spaces, so when I declared those settings explicitly, the inconsistency in tools was addressed.
Inelegant, but works.
Currently:
I prefer the space (as does Ember), but I don't mind if it is missing. Change to
.jscsrc
, please add alphabetically by key: