stellar / js-stellar-sdk

Main Stellar client library for the JavaScript language.
https://stellar.github.io/js-stellar-sdk/
Apache License 2.0
628 stars 311 forks source link

Chore: appease linter #990

Closed BlaineHeffron closed 3 months ago

BlaineHeffron commented 3 months ago

A number of fixes to remove the warnings and errors across the src/ directory of the project.

I noticed the src/.eslintrc.js files was not actually being used when running yarn fmt. Since yarn fmt only runs the linter in the src directory anyway, I just merged the src/.eslintrc.js file with the top level .eslintrc.js file.

Then, I added the settings below to be ignored. These were mostly minor docstring formatting complaints or some other trivial things like having spaces in comments.

 "jsdoc/require-param-type": 0,
 "jsdoc/require-returns-type": 0,
 "jsdoc/no-blank-blocks": 0, 
 "jsdoc/no-multi-asterisks": 0,
 "jsdoc/tag-lines": "off",
 "jsdoc/require-jsdoc": "off",
 "valid-jsdoc": "off",
 "import/extensions": 0,
"spaced-comment": 0,

I then fixed all other issues. The only logic changes are where functions contained for loops, I used iterators instead (e.g forEach, some, filter, etc). There was one case where I added eslint-ignore comments for a double nested for loop that was a bit more complicated so I just decided to leave it be.

Sometimes there were names prefixed with an underscore, in those cases I just removed the underscore.

Shaptic commented 3 months ago

@BlaineHeffron I'm too scared to touch the test conflict :sweat_smile:

BlaineHeffron commented 3 months ago

Addressed @chadoh comments, performed rebase, and then added yarn fmt fixes after the rebase. The main fix applied after the rebase was a dependency cycle involving DEFAULT_TIMEOUT and NULL_ACCOUNT. I moved these to types.ts to fix the issue.

BlaineHeffron commented 3 months ago

Reverted webauth/utils.ts and addressed the other comments. Should be good to go.

chadoh commented 3 months ago

I think you need to merge, @Shaptic!