-
Notifications
You must be signed in to change notification settings - Fork 69
chore: Switch from JSHint/JSCS to ESLint #581
Conversation
Other fun tools: depcheck, which reports potentially unused dependencies... Currently reports the following:
|
According to http://eslint.org/docs/user-guide/configuring#configuration-file-formats using Is there really a need for two targets? I only ever see |
Good catch. I did that for the top level, but totally choked on the override config in test/.
A need? No. But it can make things a lot easier if we add more linting tools in the future. For example, if we ever add CSS linting [or whatever], we could just tweak the package.json's |
@@ -61,9 +58,8 @@ | |||
"open": "0.0.5", | |||
"promzard": "0.3.0", | |||
"read": "1.0.7", | |||
"request": "2.67.0", |
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.
Removed unused deps, per #581 (comment)
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.
This is great but I'd like to make sure it doesn't happen again. Can we use this rule maybe?
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.
No. I added that plugin and configured it, and then added the request dependency back and ESLint still passed, so it doesn't seem to do the same thing as depcheck.
We can probably just use depcheck either on Travis-CI only, or add it to devDependencies.
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.
Hmm, I swear I've done this before (cant' find it) but maybe it was for a project only with ES6 imports.
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.
ok, if you can run depcheck as part of the Travis build, that would be great
@@ -76,11 +72,10 @@ | |||
"conventional-changelog-cli": "1.2.0", | |||
"conventional-changelog-lint": "1.0.0", | |||
"dive": "0.4.0", | |||
"eslint": "2.13.1", |
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.
Oh, and I forgot that I should throw a comment on here...
I'm not sure what version of ESLint to use. Per http://eslint.org/docs/user-guide/migrating-to-3.0.0
With ESLint v3.0.0, we are dropping support for Node.js versions prior to 4. Node.js 0.10 and 0.12 are in maintenance mode and Node.js 4 is the current LTS version. If you are using an older version of Node.js, we recommend upgrading to at least Node.js 4 as soon as possible. If you are unable to upgrade to Node.js 4 or higher, then we recommend continuing to use ESLint v2.x until you are ready to upgrade Node.js.
Important: We will not be updating the ESLint v2.x versions going forward. All bug fixes and enhancements will land in ESLint v3.x.
I wasn't 100% on our support for Node < 4 (the package.json mentions node>=0.10
), so I left this as eslint@2. If we're only supporting Node >= 4, we should probably upgrade to eslint@3.
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.
As travis only runs 4+, and this is a devDependency this shouldn't be a problem, there are already devDependencies that only support node 4 and up (get-firefox as an example).
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.
Updated to eslint@3 and re-pushed.
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.
Thanks, this is really helpful! The original contributor who added jshint went with that since he didn't know eslint even though that's what I had wanted. I wasn't trying to be picky about a contribution though :)
I requested just a few changes but let me know if adding the dep-check rule is too much for this patch (we can do it later).
@@ -16,10 +16,10 @@ | |||
"addon_runners": "node ./test/run.js addon_runners", | |||
"unit": "node ./test/run.js unit", | |||
"documentation": "mocha -t 5000 test/documentation", | |||
"jshint": "jshint bin/jpm lib test --exclude test/addons,test/addon_runners,test/fixtures", | |||
"jscs": "jscs bin/jpm lib", | |||
"eslint": "eslint bin/jpm lib test", |
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.
I think the lint
command is enough, right? I'd like to avoid aliases if we don't need them.
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.
Removed eslint
alias and just left lint
(which still lets me be consistent with our other repos). 👍
@@ -61,9 +58,8 @@ | |||
"open": "0.0.5", | |||
"promzard": "0.3.0", | |||
"read": "1.0.7", | |||
"request": "2.67.0", |
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.
This is great but I'd like to make sure it doesn't happen again. Can we use this rule maybe?
hmm, I'm not sure what these test failures are about |
I think this broke when I added the All the other changes in that commit were just comparing to strings or numbers. I'll see if switching back to Computers are hard. |
Just talking to myself here while my Travis-CI is running in the background. So, with depcheck, we can get it to ignore certain dependencies using the Not super pretty though: $ depcheck --ignores=commander,jpm-core,node-watch,object-assign,open,eslint-plugin-*,husky,release-it
Missing dependencies
* sdk
* chrome
$ echo $? # 0 So it doesn't seem to know how to handle the quirky UPDATE: Filed upstream depcheck issue as depcheck/depcheck#167 Also, doesn't look like an easy/good way to pretty up that horrible |
I think the proper fix to ignore the |
The latest failure looks like a flaky timeout so I restarted it |
That'd solve 2/3 of the problems. We'd still need a solution for the
But yes, works great for the two $ ./node_modules/.bin/depcheck --ignores=commander,jpm-core,node-watch,object-assign,open,eslint-plugin-*,husky,release-it,depcheck --ignore-dirs=data
Missing dependencies
* chrome I can't seem to find the right combination of getting this to work, although my inferior brain seems to think it should: --ignore-dirs=data,test/fixtures/mock-sdk/lib/sdk/addon Maybe it's choking on the UPDATE: My assumption was correct, it fails on nested directories: depcheck/depcheck#138 |
In this new "GitHub review" world, is there a way that I can mark the requested changes as complete? Or can only repo owners/admins/members do that? TL;DR: Merge this quick while it's green! |
Thanks @pdehaan ! Can you file a new issue to fix the TODOs that you commented about in |
Fixes #571