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

var => let/const #452

Merged
merged 7 commits into from
Apr 8, 2017
Merged

Conversation

elboletaire
Copy link
Collaborator

Closes #436

Note that #450 must be merged first (this branch has been created from that PR branch).

@elboletaire elboletaire changed the title var => let/const [WIP] var => let/const Apr 7, 2017
@elboletaire
Copy link
Collaborator Author

hhmmm.. it seems that in 87d3cde eslint also removed the double negations 😕

All the tests are passing, but I've added the WIP tag until:

  • You confirm me to undo that double negation changes.
  • You merge Replace jshint by eslint #450 first, as this PR depends on that one (which will reduce the amount of files in this PR diff).

@matteofigus
Copy link
Member

matteofigus commented Apr 7, 2017

Hi, If you are happy and all is green, feel free to remove the WIP tag and leave it to me. I am in favour of removing the unnecessary double negations and I believe eslint tried to do that: for some I see it removed them, for some I still see them - but I definitely will spend some time to check them one by one. In case it turns out to be too much of a work, I can still make a separate PR for that and then we can merge this later so that it has less moving parts 👍

@elboletaire elboletaire changed the title [WIP] var => let/const var => let/const Apr 7, 2017
@elboletaire
Copy link
Collaborator Author

Removed WIP tag then 😃

I'm creating another PR setting indent to be 2 spaces (it's off now, due to a lot of tabs found on the code, combined with spaces).

@nickbalestra
Copy link
Contributor

@elboletaire instead of having an eslintrc.json config why not just an eslintConfig in package.json ? I personally like that fact that nowadays you can almost put all the configs within package.json instead of spreading them over multiple dot files. What's your take on this ? cc @matteofigus

Copy link
Contributor

@nickbalestra nickbalestra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks @elboletaire

@@ -22,8 +22,8 @@ module.exports = function(config){
throw settings.missingComponentName;
}

var lang = options.headers['accept-language'],
forwardLang = config.forwardAcceptLanguageToClient === true;
const lang = options.headers['accept-language'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ so much better :)

registryUrl = clientRenderingEndpoint,
registrySegment = registryUrl.slice(-1) === '/' ? registryUrl : (registryUrl + '/'),
qs = !!component.parameters ? ('/?' + querystring.stringify(component.parameters)) : '';
const versionSegment = component.version ? ('/' + component.version) : '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally find those multiple assignments pretty annoying, can we have a pr in the future to remove them ? 😈 😅 😃

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol yes, indeed

each: function(obj, fn){
if(_.isArray(obj)){
for(var i = 0; i < obj.length; i++){
for(let i = 0; i < obj.length; i++){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@@ -1,7 +1,7 @@
'use strict';

function addProperties(source, destination) {
for (var key in source) {
for (const key in source) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, I would have imagined this to be a let...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah...not all loops are born equals..

@elboletaire
Copy link
Collaborator Author

elboletaire commented Apr 7, 2017

About the eslintrc.json, if you decide to move it to package.json you should mention it in the readme, as it's not a default behavior. More over, as I said in #450, the grunt-eslint package does not provide a way (or at least I didn't find it) to specify the ignored files, so you'll still need the .eslintignore file.

Now that we speak about the files in the root folder... why that .node-version file, if I may ask? 🙄

@nickbalestra
Copy link
Contributor

nickbalestra commented Apr 7, 2017

True. node-version is for avn & similar, but I guess there is a way to probably rely on engines for avn & co as well...

But yes, for now on we can keep it, and yes, now that you mention I would like if we get rid of grunt down the road, but definitely not a priority.

@elboletaire elboletaire mentioned this pull request Apr 8, 2017
@elboletaire
Copy link
Collaborator Author

elboletaire commented Apr 8, 2017

@nickbalestra casually today (well, for me it was yesterday, it's 2am here now) I've been at nodeconf (Barcelona) and I discovered this package: https://github.com/semantic-release/semantic-release which, if I'm not wrong, only relies on git and a npm registry.

Copy link
Member

@matteofigus matteofigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 2 little changes. Everything else looks good.

@@ -1,6 +1,6 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is client-side code that then gets uglified by jade import - when making this switch the uglification fails :(
Can we add a file ignore for this rule in this file please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It's strange because there were some client files that crashed setting const and let due to the use strict, but not these two files 😕

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I realised the UI wasn't covered by any tests so I managed to discover this manually. To facilitate testing, I created a separate PR to add a couple of test: #455 - so this should not happen again in the future ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@@ -1,45 +1,45 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, client side code that should stay with var for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@elboletaire
Copy link
Collaborator Author

Both list-components.js and component-info.js were reverted.

@matteofigus matteofigus merged commit b2a10d9 into opencomponents:master Apr 8, 2017
@matteofigus
Copy link
Member

Thanks for working on this @elboletaire 👍

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

Successfully merging this pull request may close these issues.

3 participants