#28543 closed enhancement (wontfix)
Allow stricter JSHint checks for core files
Reported by: | MattyRob | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | trivial | Version: | 3.7 |
Component: | Build/Test Tools | Keywords: | |
Focuses: | javascript | Cc: |
Description
http://make.wordpress.org/core/2013/11/13/finding-fixing-javascript-errors-with-jshint/
Many JSHint issues were fixed in core JavaScript files for the release of WordPress 3.8 (if I recall correctly). The above post makes refetene to “curly” and “eqeqeq” being ignored for now but would be revisited in the future.
I think therefore it makes sense to implement a stricter set of JSHint checks for core files. This could be done by simply making the current jshint:core task striker or a new jshint:corestrict could be introduced as per the attached patch.
Attachments (1)
Change History (10)
#3
in reply to:
↑ 2
@
10 years ago
Replying to jorbin:
I think the route we should take here is to fix these two issues individually rather than introduce a new temporary grunt task that won't pass. Introducing this task would cause the general jshint task to fail every single time until both curly and eqeqeq are fixed, and once they are fixed we wouldn't need this task.
We should handle turning off the curly and eqeqeq separately. eqeqeq is going to be much harder, but curly is something we can definitely do. I think we should close this ticket and open separate tickets for each of those two.
I'm not sure that I fully understand what you are saying, are you saying that creating a new 'jshint:corestrict' task that can be invoked with a command of "grunt jshint:core strict" that the build tests will fail all the time? Why would this new task be called as part of the automated build tool tests?
Perhaps your suggested way is cleaner by staging the removal of the current exclusions from 'jshint:core' and I did suggest that as an option above.
#4
@
10 years ago
- Keywords dev-feedback added
Just as an update, since my last post I have run the 'core strict' checks and corrected all issues in the 38 affected files. I have't had chance to check as that's probably too much to expect for one set of eyes but I would submit that these may be possible to fix concurrently and in fact - if desired - I can submit a patch or patches for all affected files.
#5
@
10 years ago
Related: #28464
A new patch on the above ticket allows specific JSHint tasks to be registered for the build tests thus allowing additional tests to be added without breaking the build tests.
#6
@
10 years ago
- Milestone changed from Awaiting Review to Future Release
- Version changed from trunk to 3.7
I don't feel strongly about this either way. I'd like to maybe handle curly in 4.1 (I have a script) and start to hack away at eqeqeq.
I think the route we should take here is to fix these two issues individually rather than introduce a new temporary grunt task that won't pass. Introducing this task would cause the general jshint task to fail every single time until both curly and eqeqeq are fixed, and once they are fixed we wouldn't need this task.
We should handle turning off the curly and eqeqeq separately. eqeqeq is going to be much harder, but curly is something we can definitely do. I think we should close this ticket and open separate tickets for each of those two.