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

Add ESLint no-unused-vars rule #1497

Merged
merged 1 commit into from Aug 2, 2018
Merged

Add ESLint no-unused-vars rule #1497

merged 1 commit into from Aug 2, 2018

Conversation

maclover7
Copy link
Contributor

Checklist
Description of change

Adds the no-unused-vars ESLint rule. Can add npm run lint to nodegyp-test-commit if people would like that.

@maclover7 maclover7 requested a review from bnoordhuis July 8, 2018 00:59
@maclover7
Copy link
Contributor Author

@maclover7
Copy link
Contributor Author

@gibfahn
Copy link
Member

gibfahn commented Jul 23, 2018

Can add npm run lint to nodegyp-test-commit if people would like that.

I'd rather we add npm run lint to npm test (see #1336 (comment))

package.json Outdated
},
"scripts": {
"test": "tape test/test-*"
"lint": "node_modules/eslint/bin/eslint.js --no-eslintrc --rule no-unused-vars:error bin lib test",
Copy link
Member

Choose a reason for hiding this comment

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

Can you not just do:

-     "lint": "node_modules/eslint/bin/eslint.js --no-eslintrc --rule no-unused-vars:error bin lib test", 
+     "lint": "eslint --no-eslintrc --rule no-unused-vars:error bin lib test", 

Also is there a reason to add the lint rules here instead of just adding a .eslintrc.yaml? I assume we're going to add more rules in the future...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had listed just the one rule for now, since didn't want to introduce tons of style changes all at once (and different parts of the codebase follow different standards...)

Copy link
Member

Choose a reason for hiding this comment

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

Oh yeah, I didn't mean that you should add a full set of rules, just that adding a second rule will be a lot easier if it's just adding a line to a yaml file.

I think using .eslintrc.yaml is the convention in everything but nodejs/node (and that's a recent change).

@maclover7
Copy link
Contributor Author

@gibfahn Added npm run lint to npm test, but looks like CI came back with some interesting Windows errors (cc @joaocgreis): https://ci.nodejs.org/job/nodegyp-test-pull-request/68/

@joaocgreis
Copy link
Member

@maclover7 fixed the job error - npm.cmd was not being copied to path so npm could not be used from CMD.

Test run: https://ci.nodejs.org/job/nodegyp-test-commit/391/nodes=win2016-vs2017/console

About the new error, can you use just eslint (installed by npm to node_modules/.bin) instead of the full path?

@maclover7
Copy link
Contributor Author

CI (https://ci.nodejs.org/job/nodegyp-test-pull-request/77/) is passing now besides for Node.js v4.x, but support for that release line is being removed soon from the master branch.

PTAL @gibfahn @joaocgreis

@joaocgreis
Copy link
Member

Windows fix LGTM. The rest of the diff looks reasonable at a glance but I didn't test.

Copy link
Member

@gibfahn gibfahn left a comment

Choose a reason for hiding this comment

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

Seems reasonable.

@gibfahn
Copy link
Member

gibfahn commented Aug 1, 2018

@maclover7 just to confirm, all the fixes come from eslint warnings right?

@maclover7
Copy link
Contributor Author

@maclover7 just to confirm, all the fixes come from eslint warnings right?

@gibfahn Yep, they came from when I ran npm test

- Uses `.eslintrc.yaml` for configuration
- `npm run lint` is part of `npm test`
@maclover7
Copy link
Contributor Author

Final CI before landing: https://ci.nodejs.org/job/nodegyp-test-pull-request/81/

@maclover7 maclover7 merged commit b2e5cf0 into nodejs:master Aug 2, 2018
@maclover7
Copy link
Contributor Author

Landed in b2e5cf0

@maclover7 maclover7 deleted the jm-lint-vars branch August 2, 2018 22:12
rvagg pushed a commit that referenced this pull request Apr 24, 2019
- Uses `.eslintrc.yaml` for configuration
- `npm run lint` is part of `npm test`

PR-URL: #1497
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
@rvagg rvagg mentioned this pull request Apr 24, 2019
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.

None yet

3 participants