Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMake code pass lint #55
Conversation
This comment has been minimized.
This comment has been minimized.
ivantodorovich
commented
May 13, 2014
|
Waiting to see @feross reaction.. |
This comment has been minimized.
This comment has been minimized.
|
Note that most of the code in this repo (lib/*) is stale and has been deleted in my latest pull request because it now all resides in the isolated and more up-to-date bittorrent-client repository. What linter are you using and with what options? Certainly need to wait on @feross, but in general, I'd recommend adding a jshintrc as good practice so everyone's on the same page about style expectations going forwards. |
This comment has been minimized.
This comment has been minimized.
|
I'd have to pull up the one I'm using in sublime to see. A lot of the linting I'm doing is in my head before it actually finishes parsing and let's me know what lines are bad. I'll check out your pull and re-lint it as well. A JavaScript spec would be nice since I see numerous styles throughout the code (which is why I ignored the horrendous overuse of 'var self = this'. |
This comment has been minimized.
This comment has been minimized.
|
Not everything passes lint anymore since I'm pulling the changes you made over. |
This comment has been minimized.
This comment has been minimized.
gauravsaini
commented
May 14, 2014
|
How can I check whether it is running from terminal ? |
This comment has been minimized.
This comment has been minimized.
|
npm start --help or if you want, just pass it a torrent id such as this leaves of grass infohash to start downloading a torrent |
This comment has been minimized.
This comment has been minimized.
|
If it works, you should get a nice auto-updating terminal UI until the torrent finishes downloading. |
This comment has been minimized.
This comment has been minimized.
|
After merging @fisch0920's changes it looks like this PR doesn't do much. So I'll close it for now. Note that the current code style is intentional. No semicolons, function blocks whenever possible, When sending PRs, make sure to match the style of the existing code and you'll be fine. |
This comment has been minimized.
This comment has been minimized.
|
I could make a simple lint module ( |
This comment has been minimized.
This comment has been minimized.
|
The problem with no semi-colons is that this is javascript, not python. There are many cases where forgetting a semicolon will break your code. http://www.codecademy.com/blog/78-your-guide-to-semicolons-in-javascript Self is fine is some cases, but when you define it and do nothing with it you are just wasting CPU cycles and memory. In truth using a variable to reference this will be a problem for performance/memory usage and IMO should only be used if you need to preserve scope somehow (referencing this inside an anonymous function properly etc). When we are working on something that we care about having good performance on (Like this project) we should never sacrifice performance for a coding style that is just a matter of preference. |
This comment has been minimized.
This comment has been minimized.
|
Updated to work with the last merge. |
Eeems commentedMay 13, 2014
I've touched up all the JavaScript files so they would pass a lint, and so they wouldn't throw error if you ran them in strict mode. I've also done a tiny bit of optimizing of some of the small functions that could be cut down to a single return statement instead of a small if block. I may go through and do cpu/memory optimizations later.