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

Use ESLint and compatible with .jshintrc #1338

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

gucong3000
Copy link

@gucong3000 gucong3000 commented Jul 28, 2017

  • .eslintrc.json is compatible with .jshintrc.
  • Fixing lint errors on precommit.
  • All errors written before 2017-8-2 will be ignored.
  • Fixed: generate/templates/templates/nodegit.js

@gucong3000 gucong3000 changed the title Use ESLint with compatible with .jshintrc Use ESLint and compatible with .jshintrc Jul 28, 2017
@gucong3000 gucong3000 changed the title Use ESLint and compatible with .jshintrc [WIP] Use ESLint and compatible with .jshintrc Jul 28, 2017
@gucong3000 gucong3000 changed the title [WIP] Use ESLint and compatible with .jshintrc Use ESLint and compatible with .jshintrc Jul 28, 2017
@gucong3000 gucong3000 closed this Aug 3, 2017
@gucong3000 gucong3000 reopened this Aug 3, 2017
@gucong3000
Copy link
Author

gucong3000 commented Aug 3, 2017

This PR provides a smooth transition from jshint to eslint solutions.
Then we can gradually enhance the eslint rules without affecting the existing code.

@gucong3000
Copy link
Author

Right now it is the most popular ES linter.

Copy link
Member

@implausible implausible left a comment

Choose a reason for hiding this comment

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

I'd prefer not to bring in gulp for this. Doesn't eslint provide good, descriptive output without gulp-reporter? Can we not use eslint via cmd line?

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

Choose a reason for hiding this comment

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

Should we be worried about linting this generated file?

Copy link
Author

Choose a reason for hiding this comment

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

What is your plan about this? How about just remove this line?

Copy link
Member

Choose a reason for hiding this comment

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

Disable lint from the entire file imo. Perhaps we could have a post generate linter?

@gucong3000
Copy link
Author

@implausible
Copy link
Member

So I have no qualms with using eslint, but I don't want to bring in any gulp packages. You'll need to update your push to use eslint on the CLI.

@gucong3000
Copy link
Author

$ eslint lib test/tests test/utils examples lifecycleScripts

E:\work\nodegit\lib\commit.js
  28:66  error  'callback' is defined but never used  no-unused-vars

E:\work\nodegit\lib\repository.js
   640:65  error  'callback' is defined but never used  no-unused-vars
  1156:53  error  'payload' is defined but never used   no-unused-vars

E:\work\nodegit\lib\tree_entry.js
  92:37  error  'callback' is defined but never used  no-unused-vars

E:\work\nodegit\lib\tree.js
  126:32  error  'blobsOnly' is defined but never used   no-unused-vars
  162:45  error  'entryIndex' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\branch.js
  115:22  error  'branch' is defined but never used  no-unused-vars
  118:19  error  'error' is defined but never used   no-unused-vars
  153:22  error  'branch' is defined but never used  no-unused-vars
  156:19  error  'error' is defined but never used   no-unused-vars

E:\work\nodegit\test\tests\checkout.js
   31:20  error  'blob' is defined but never used    no-unused-vars
  126:20  error  'branch' is defined but never used  no-unused-vars
  149:20  error  'commit' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\clone.js
   67:38  error  'progress' is defined but never used  no-unused-vars
  108:40  error  'progress' is defined but never used  no-unused-vars
  146:34  error  'progress' is defined but never used  no-unused-vars
  346:23  error  'reason' is defined but never used    no-unused-vars

E:\work\nodegit\test\tests\commit.js
   33:52  error  'commitMessage' is defined but never used       no-unused-vars
  391:35  error  'commit' is defined but never used              no-unused-vars
  402:34  error  'err' is defined but never used                 no-unused-vars
  464:41  error  'entry' is defined but never used               no-unused-vars
  472:39  error  'entries' is defined but never used             no-unused-vars
  679:9   error  'signature' is assigned a value but never used  no-unused-vars

E:\work\nodegit\test\tests\config.js
  51:24  error  'e' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\diff.js
  232:33  error  'payload' is defined but never used  no-unused-vars
  265:33  error  'payload' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\filter.js
  160:24  error  'result' is defined but never used  no-unused-vars
  270:23  error  'error' is defined but never used   no-unused-vars
  464:35  error  'source' is defined but never used  no-unused-vars
  510:35  error  'source' is defined but never used  no-unused-vars
  512:28  error  'buf' is defined but never used     no-unused-vars
  516:30  error  'attr' is defined but never used    no-unused-vars
  551:35  error  'source' is defined but never used  no-unused-vars
  553:28  error  'buf' is defined but never used     no-unused-vars
  557:30  error  'attr' is defined but never used    no-unused-vars
  593:35  error  'source' is defined but never used  no-unused-vars
  595:28  error  'buf' is defined but never used     no-unused-vars
  599:30  error  'attr' is defined but never used    no-unused-vars
  621:24  error  'oid' is defined but never used     no-unused-vars
  650:35  error  'source' is defined but never used  no-unused-vars
  652:28  error  'buf' is defined but never used     no-unused-vars
  656:30  error  'attr' is defined but never used    no-unused-vars
  679:24  error  'oid' is defined but never used     no-unused-vars

E:\work\nodegit\test\tests\merge.js
   146:9   error  'theirCommit' is assigned a value but never used  no-unused-vars
   147:9   error  'ourBranch' is assigned a value but never used    no-unused-vars
   262:9   error  'theirCommit' is assigned a value but never used  no-unused-vars
   263:9   error  'ourBranch' is assigned a value but never used    no-unused-vars
   384:9   error  'ourCommit' is assigned a value but never used    no-unused-vars
   385:9   error  'theirCommit' is assigned a value but never used  no-unused-vars
   534:11  error  'ourCommit' is assigned a value but never used    no-unused-vars
   535:11  error  'theirCommit' is assigned a value but never used  no-unused-vars
   691:11  error  'ourCommit' is assigned a value but never used    no-unused-vars
   692:11  error  'theirCommit' is assigned a value but never used  no-unused-vars
   844:9   error  'theirCommit' is assigned a value but never used  no-unused-vars
   845:9   error  'ourBranch' is assigned a value but never used    no-unused-vars
   963:9   error  'ourCommit' is assigned a value but never used    no-unused-vars
   964:9   error  'theirCommit' is assigned a value but never used  no-unused-vars
  1110:9   error  'ourCommit' is assigned a value but never used    no-unused-vars
  1111:9   error  'theirCommit' is assigned a value but never used  no-unused-vars

E:\work\nodegit\test\tests\note.js
  62:14  error  'noteSha' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\rebase.js
    77:28  error  'branch' is defined but never used  no-unused-vars
   476:22  error  'oid' is defined but never used     no-unused-vars
   728:28  error  'branch' is defined but never used  no-unused-vars
  1341:22  error  'oid' is defined but never used     no-unused-vars

E:\work\nodegit\test\tests\remote.js
  285:40  error  'userName' is defined but never used  no-unused-vars
  321:40  error  'userName' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\repository.js
  64:28  error  'isBare' is defined but never used  no-unused-vars

E:\work\nodegit\test\tests\revwalk.js
  111:11  error  'storedCommits' is assigned a value but never used  no-unused-vars

E:\work\nodegit\test\tests\signature.js
  94:9  error  'time' is assigned a value but never used  no-unused-vars

E:\work\nodegit\test\tests\stash.js
  148:11  error  'oldContent' is assigned a value but never used  no-unused-vars
  179:11  error  'oldContent' is assigned a value but never used  no-unused-vars

E:\work\nodegit\test\utils\index_setup.js
  66:22  error  'commitOid' is defined but never used  no-unused-vars

E:\work\nodegit\examples\index-add-and-remove.js
  91:26  error  'matchedPattern' is defined but never used  no-unused-vars

Copy link
Member

@implausible implausible left a comment

Choose a reason for hiding this comment

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

I don't think I'm getting my point across, so here are the packages I don't want to bring into NodeGit. All of the scripts you wrote that are using these packages can be written without the use of any gulp utilities.

@@ -48,11 +48,17 @@
"clean-for-publish": "~1.0.2",
"combyne": "~0.8.1",
"coveralls": "~2.11.4",
"eslint": "^4.4.1",
"gulp-debug": "^3.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

I don't want this package in NodeGit.

@@ -48,11 +48,17 @@
"clean-for-publish": "~1.0.2",
"combyne": "~0.8.1",
"coveralls": "~2.11.4",
"eslint": "^4.4.1",
"gulp-debug": "^3.1.0",
"gulp-eslint": "^4.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

I don't want this package in NodeGit.

"eslint": "^4.4.1",
"gulp-debug": "^3.1.0",
"gulp-eslint": "^4.0.0",
"gulp-reporter": "^2.2.1",
Copy link
Member

Choose a reason for hiding this comment

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

I don't want this package in NodeGit.

"gulp-debug": "^3.1.0",
"gulp-eslint": "^4.0.0",
"gulp-reporter": "^2.2.1",
"husky": "^0.14.3",
Copy link
Member

Choose a reason for hiding this comment

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

What is this package for?

@gucong3000
Copy link
Author

gucong3000 commented Sep 1, 2017

Can we not use eslint via cmd line?

It will make so many error.

@cjhoward92
Copy link
Collaborator

@gucong3000 By saying eslint will cause many errors do you mean linter errors or something else breaks? If it is just linter errors the eslint rules should be modified to work with the existing rules, correct?

@wmertens
Copy link
Contributor

wmertens commented Mar 7, 2021

FYI, I didn't notice this PR, I also made one that adds ESLint but without gulp. #1825

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

4 participants