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

Extend eslint to test files #3473

Merged
merged 4 commits into from
Oct 16, 2016
Merged

Extend eslint to test files #3473

merged 4 commits into from
Oct 16, 2016

Conversation

panzarino
Copy link
Contributor

Adds eslint rules for test files so that they follow the same standards as source files which helps to increase overall code style

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. In a couple of places I actually preferred the old style since stuff lined up, but it's great to have this all consistent

@@ -141,7 +143,21 @@ function lintTask() {
rules: {
'complexity': [1, 6],
'max-statements': [1, 30]
}
},
globals: [
Copy link
Member

Choose a reason for hiding this comment

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

do you think any problems will occur from having the globals defined for the src as well?

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 doubt it, there were no previous issues with those globals so it would only affect future changes. An alternative would be to run a lint on the source and tests separately.

Copy link
Member

Choose a reason for hiding this comment

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

yeah. running separately is an option but I've found that it can slow down gulp if the tasks aren't run in parallel

Copy link
Member

Choose a reason for hiding this comment

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

I would definitively keep only one lint task, including all files.

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.

Looks good!

{ b: 290, w: 91, x: 209, y: 419 },
{ b: 290, w: 91, x: 322, y: 161 },
{ b: 290, w: 91, x: 436, y: 419 }
[{b: 290, w: 91, x: 95, y: 161},
Copy link
Member

Choose a reason for hiding this comment

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

That's the only formatting change I don't really like, I prefer the old way because all entries were aligned with a tab. Maybe we should consider to move the first value on a new line:

[
    {b: 290, w: 91, x: 95, y: 161},
    {b: 290, w: 91, x: 209, y: 419},
    // ...
].forEach(...

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 think that would be the best way to do it, I will update the PR with that change soon.

@@ -141,7 +143,21 @@ function lintTask() {
rules: {
'complexity': [1, 6],
'max-statements': [1, 30]
}
},
globals: [
Copy link
Member

Choose a reason for hiding this comment

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

I would definitively keep only one lint task, including all files.

@@ -1,3 +1,6 @@
/* eslint no-unused-vars: 1 */
Copy link
Member

Choose a reason for hiding this comment

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

With the globals in gulp lint options, do we still need this no-unused-vars: 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the functions that are defined in lines 80-102, it says that the last parameter is an unused variable. For example, y is unused in lineTo: function(x, y) and h is unused in strokeRect: function(x, y, w, h) {},, etc.

Copy link
Member

Choose a reason for hiding this comment

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

we could also remove those parameters since they do nothing

@panzarino
Copy link
Contributor Author

I will merge by command line to fix the merge conflict when we agree to merge the PR.

@simonbrunel
Copy link
Member

Sure, if you do it by command line, can you please rebase and squash your commits before merging fast-forward. Though, would also be handy to rebase and force push your branch to update that PR (keep iteration history), and finally "Squash and merge".

@panzarino panzarino merged commit 766ca49 into chartjs:master Oct 16, 2016
@panzarino panzarino deleted the extend-eslint branch October 16, 2016 21:35
@simonbrunel
Copy link
Member

Nice work @zachpanz88!

@simonbrunel simonbrunel added this to the Version 2.4 milestone Oct 24, 2016
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
* Add eslint to test files

* Fix mockContext for tests

* Make formatting look better for nested objects
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