Opened 12 years ago
Closed 12 years ago
#28464 closed enhancement (fixed)
grunt jshint for plugins and plugin developers
| Reported by: | MattyRob | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.0 |
| Component: | Build/Test Tools | Version: | 4.0 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
Description
Grunt jshint can be used on core files and theme files (with the latter seeming limited to twenty fourteen at the moment).
I've extended my local Gruntfile.js to allow the plugins folder to be scanned and also implemented a 'folder' filter so a plugin folder name can be specified to be scanned.
This allows plugin developers easier access to JSHint and supports good coding standards. Is it worth adding to core?
Attachments (4)
Change History (19)
#3
in reply to: ↑ 2
@
12 years ago
Replying to jorbin:
This looks like a good addition to me and one that will help plugin developers.
My only feedback is that I think the inline docs are a bit repetitive. I think the first line can have Optionally added to the start of it and it would be clearer.
That's a good point - I'd just copied and pasted from the 'core' filename filter and through my edits made them the same! Update patch on the way.
This ticket was mentioned in IRC in #wordpress-dev by jorbin. View the logs.
12 years ago
#7
@
12 years ago
- Resolution fixed
- Status closed → reopened
Let's call this dir or directory in lieu of folder.
#9
@
12 years ago
Two thoughts:
1) This task will only run JSHint on plugins being developed in \src\wp-content\plugins
- If a plugin developer needs, and I believe that they should, they should be running WordPress trunk from
/buildvia thedevelop.svnrepo or they should usecore.svnto develop their plugin.
- Developing plugins by loading WordPress via
\src\wp-content\pluginsof thedevelop.svnrepo excludes RTL CSS or admin themes CSS (Midnight, Ocean etc) and I think we should be encouraging plugin authors to test their plugins for compatibility with these core features.
2) The jshint:plugin task is now included by default in grunt precommit and grunt travis:js tasks
- It does not cause an error running either task though a warning is displayed (see image below)
- If not we should register a new task eg.
jshint:corejsto call fromgrunt precommitandgrunt travis:jssojshint:pluginis not included. eg 28464.corejs.diff
#12
in reply to: ↑ 11
;
follow-up:
↓ 13
@
12 years ago
Replying to helen:
grunt precommit needs to not run this, please.
Isn't that covered in the patch submitted by netweb above?
#13
in reply to: ↑ 12
@
12 years ago
Replying to MattyRob:
Replying to helen:
grunt precommit needs to not run this, please.
Isn't that covered in the patch submitted by netweb above?
Yes, 28464.corejs.diff excludes jshint:plugins from both grunt precommit and grunt travis:js tasks.
I'm not overly excited about the naming in that patch, it add's a task jshint:corejs because we already have jshint:core, I was thinking of switching the names of each of those tasks and there are both back compat pro's and con's for either. Happy for any other ideas or methods to implement this.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)

This looks like a good addition to me and one that will help plugin developers.
My only feedback is that I think the inline docs are a bit repetitive. I think the first line can have Optionally added to the start of it and it would be clearer.