-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
refactor: adhere mostly to StandardJS guidelines #1657
Conversation
This commit changes the whole codebase to adhere to all StandardJS guidelines rules except semicolons, since the removal of semicolons affect pretty much all lines, and the final diff is very hard to follow (and to assess other more involved changes). In a nutshell: - When using `function`, we now require a space before the opening parenthesis - If a line with operators is broken into multiple lines, the operator should now go after the line break - Unnecessary padding lines are now forbidden There were also some minor things that the `standard` CLI caught that I updated here. See: https://standardjs.com Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
What do you think about using standard/eslint-config-standard and extend that, to shrink down our custom defined rule set? |
Yep, we definitely should. I'll handle it it another PR. |
- Extend the `standard` ESLint configuration - Remove ESLint rules that are defined in the `standard` configuration - Get rid of semi-colons See: #1657 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
- Extend the `standard` ESLint configuration - Remove ESLint rules that are defined in the `standard` configuration - Get rid of semi-colons See: #1657 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Out of curiosity, have any / many other resin.io repos switched to this new style? |
I think we're the pioneers :P |
}); | ||
|
||
app.controller('StateController', function($rootScope, $scope) { | ||
app.controller('StateController', function ($rootScope, $scope) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity (this may well be another one of my stupid questions) how come this is still using the function
keyword rather than fat-arrow notation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Angular relies on being able to set custom contexts with .call()
and .apply()
, which fat arrow functions don't support. Basically, Angular.js 2 is not ES6 ready.
super(props); | ||
|
||
this.state = { | ||
shouldShow: true | ||
}; | ||
|
||
const url = new URL(props.src); | ||
const url = new window.URL(props.src); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shou is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! URL lives on window
, and this makes it explicit, so a good change.
|
@jhermsmeier Yup, saw that ;-) |
This commit changes the whole codebase to adhere to all StandardJS
guidelines rules except semicolons, since the removal of semicolons
affect pretty much all lines, and the final diff is very hard to follow
(and to assess other more involved changes).
In a nutshell:
function
, we now require a space before the openingparenthesis
should now go after the line break
There were also some minor things that the
standard
CLI caught that Iupdated here.
See: https://standardjs.com
Signed-off-by: Juan Cruz Viotti jv@jviotti.com