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

ESLint Updates #3308

Merged
merged 9 commits into from
Sep 15, 2016
Merged

ESLint Updates #3308

merged 9 commits into from
Sep 15, 2016

Conversation

panzarino
Copy link
Contributor

These updates add more structure to code styling. Tests will now fail if the code does not match the style set forth by these guidelines. The official standards were created based off of the most commonly used styles in this project already.

Hopefully this will make code easier to read over time and will keep all styling uniform throughout the project.

Eventually these rules should be extended to all code in the project (tests, etc.) rather than just the src files.

I did my best to make sure that no functionality was changed through the adaptation of this styling throughout the project, but I might have caused a bug somewhere so please make sure that my changes will not induce any unexpected behavior.

Copy link
Member

@etimberg etimberg left a comment

Choose a reason for hiding this comment

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

Looks good. I didn't notice any changes to the behaviour. I had a few minor comments.

Great work 👍

@@ -405,7 +408,7 @@ module.exports = function(Chart) {
}
}
}
}).call(me);
}.call(me);
Copy link
Member

Choose a reason for hiding this comment

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

can probably remove the .call(me) because me is captured by scope now. that could be a different PR though

@@ -442,7 +445,7 @@ module.exports = function(Chart) {
}
}
}
}).call(me);
}.call(me);
Copy link
Member

Choose a reason for hiding this comment

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

same thing here about .call(me)

@@ -31,20 +31,20 @@ module.exports = function(Chart) {

// Helper function to draw a line to a point
function lineToPoint(previousPoint, point) {
var vm = point._view;
var pointvm = point._view;
Copy link
Member

Choose a reason for hiding this comment

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

minor nitpick, I think this is better as pointVM.

@panzarino
Copy link
Contributor Author

@etimberg Updated to include your suggestions

@etimberg
Copy link
Member

awesome! LGTM!

@@ -405,7 +408,7 @@ module.exports = function(Chart) {
}
}
}
}).call(me);
};
Copy link
Member

@etimberg etimberg Sep 15, 2016

Choose a reason for hiding this comment

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

probably need to call function and set return to found. maybe .call is right 😕
this caused the test fails

@panzarino
Copy link
Contributor Author

@etimberg Changed to only include pointvm --> pointVM

@etimberg
Copy link
Member

thanks :)

no-cond-assign: 2
no-console: 0
no-console: 1
Copy link
Member

@simonbrunel simonbrunel Sep 15, 2016

Choose a reason for hiding this comment

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

Could be set as "error" as you had in your Gist, but maybe only for console.log (so no-console: [2, { allow: [warn, error] }])?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update

@@ -96,7 +96,7 @@ rules:
radix: 2
vars-on-top: 0
wrap-iife: 2
yoda: 0
yoda: [1, never]
Copy link
Member

Choose a reason for hiding this comment

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

This one was "error" in your Gist, is there cases where we can't adapt the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When there is a comparison Val < raw number < otherval it gives an error but that is really the best way to have that statement

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I don't really mind about that rule, was just curious why :)

no-unused-vars: 0
no-use-before-define: 0
no-unused-vars: 2
no-use-before-define: 1
Copy link
Member

Choose a reason for hiding this comment

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

Same for this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was having problems with that in a certain file but I'm going to try to go back and see if I can fix it so the rule can be set as error

@@ -77,7 +77,7 @@ module.exports = function() {
onClick: null,
defaultColor: 'rgba(0,0,0,0.1)',
defaultFontColor: '#666',
defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
defaultFontFamily: '\'Helvetica Neue\', \'Helvetica\', \'Arial\', sans-serif',
Copy link
Member

Choose a reason for hiding this comment

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

Very minor, but I think I prefer the previous version which is easier to read and less character. What do you think? should we only allow double quotes to avoid escaping (quotes: [2, single, { avoidEscape: true }])?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, this change was automatically done with --fix so I didn't realize what it looked like

@simonbrunel
Copy link
Member

simonbrunel commented Sep 15, 2016

A few minor comments, that's a great work @zachpanz88

func-names: 0
brace-style: [2, 1tbs]
camelcase: 2
comma-dangle: [2, never]
Copy link
Member

Choose a reason for hiding this comment

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

Just remembered about that comment and I agree with rjmcguire. Should we allow (but not enforce) trailing comma in this special case (comma-dangle: [2, only-multiline])?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, will update

@panzarino
Copy link
Contributor Author

@simonbrunel updated to include your changes

Copy link
Member

@simonbrunel simonbrunel left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@fulldecent fulldecent left a comment

Choose a reason for hiding this comment

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

Thanks for this extensive work!

@panzarino
Copy link
Contributor Author

panzarino commented Sep 15, 2016

Clear to merge?

@simonbrunel simonbrunel merged commit 8e37a11 into chartjs:master Sep 15, 2016
@simonbrunel
Copy link
Member

Just pulled these changes locally and didn't think about the AutoCrlf git option which conflict with linebreak-style: [2, unix]. Can we turn this rule off?

@panzarino
Copy link
Contributor Author

Yep, you can go ahead and commit that

@etimberg
Copy link
Member

Fine to change

@panzarino panzarino deleted the eslint branch September 15, 2016 22:08
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
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.

4 participants