Happy0 / ssb-chess

A library for building scuttlebutt chess clients with
GNU General Public License v2.0
63 stars 16 forks source link

Add linter #75

Closed christianbundy closed 6 years ago

christianbundy commented 6 years ago

Hey @Happy0!

I thought I'd spend a few minutes to add some linting like we talked about, even if only to give you a foothold. I've got it set up like this:

The Airbnb style guide likes to call everything an error, so I've used .eslintrc.js to downgrade the majority of those to just warnings. If/when we fix those, we can remove the line from the config to upgrade it to an error. That should make future regressions easier to fight!

I've added dev dependencies from main.js like electron and ssb-client, but they won't be installed when ssb-chess is installed by Patchbay since they're just dev dependencies. There are still a few errors I wasn't able to resolve, maybe these are causing some of our problems? I'm especially suspicious of PubSub:

$ npm test

> ssb-chess@2.3.2 test /home/christianbundy/Source/ssb-chess
> eslint . --quiet

/home/christianbundy/Source/ssb-chess/ctrl/game_move.js
  47:7  error  'PubSub' is not defined  no-undef

/home/christianbundy/Source/ssb-chess/main.js
  66:31  error  Unable to resolve path to module './command_line'  import/no-unresolved
  70:22  error  Unable to resolve path to module './db/init'       import/no-unresolved

/home/christianbundy/Source/ssb-chess/ui/notify/notifier.js
  10:3   error  'userGamesWatcher' is not defined  no-undef
  53:30  error  'userGamesWatcher' is not defined  no-undef

✖ 5 problems (5 errors, 0 warnings)

npm ERR! Test failed.  See above for more details.
Happy0 commented 6 years ago

Thanks so much! :) <3