At the bottom is a list of every file in core that is displaying JSHint errors. Files with a checkmark have been patched and should now be passing lint. Files marked with (@username #xxxxx) are already claimed, and being worked on.
Please read and understand the process we’ll be following to address these issues! Many thanks to @azaozz, @nacin and @jorbin for helping identify the safest way to approach fixing these errors, and to @rzen for posting the Inline Docs article on which we based this guide.
How to contribute:
- Leave a comment on this post with the file* you’re about to edit (check the list first to make sure it hasn’t already been claimed).
- Update your local WordPress SVN to the latest version of WordPress trunk (currently 3.8-alpha).
- Create a new ticket on Trac for the file.
- Format the title as “jshint shouldn’t throw errors – path/to/file.js”.
- Assign the ticket to the “Build Tools” component.
- Make sure your email is stored in Trac’s preferences
If you are logged in, you can click this link to automatically open a ticket with the right settings.
- Edit the file, and make a patch. Please make sure you create the patch from the root directory of your WordPress SVN checkout. If you are working on a large file, consider making multiple patches for each type of change.
- Upload your patch to the Trac ticket you created, and add the keyword “has-patch”.
*Note: We strongly encourage you to work on one file at a time. These shouldn’t take very long, but if you call a bunch at once and get tied up, we won’t be able to get through these as quickly as possible. To quote @rzen from the inline docs effort, “your edits should be made and patched swiftly so that they aren’t invalidated by (or don’t invalidate) another patch.”
Keeping Discussions Focused:
Any discussion about the specifics of a patch itself should happen on Trac. Discussion about the overall effort should take place during our standing weekly meeting, on Wednesdays at 1900 UTC in #wordpress-dev*.
Files needing patches:
Checked files are now passing JSHint
For the curious, this list was created with a jazzy little command @nacin came up with to pipe Grunt output through ack:
grunt jshint --force | ack '^Linting src/' | ack -o 'wp-.*.js' | sort | uniq -c | sort
What we’re NOT doing
The two JSHint options called out in the earlier post, “curly” and “eqeqeq,” would ordinarily make up the vast majority of the errors JSHint reports in our files. We’ve currently set Grunt and JSHint to ignore these two types of errors when JSHint is run against core. While these are best practices, we’ll come back to them once we address the more significant code smell issues like undefined variables.
Also note that we’re not tackling whitespace or non-JSHint-related refactoring during this effort. We’ll get there, but we have to mitigate the risk to core as much as possible so we don’t interrupt the 3.8 cycle. Keep your changes focused on passing JSHint this go-around.