| | 126 | }, |
| | 127 | // Limit JSHint's run to a single specified file |
| | 128 | // grunt jshint:core --file=filename.js |
| | 129 | filter: function( filepath ) { |
| | 130 | var file = grunt.option( 'file' ); |
| | 131 | |
| | 132 | // Don't filter when no target file is specified |
| | 133 | if ( ! file ) { |
| | 134 | return true; |
| | 135 | } |
| | 136 | |
| | 137 | // Normalize filepath for Windows |
| | 138 | filepath = filepath.replace( /\\/g, '/' ); |
| | 139 | |
| | 140 | // Match only the filename passed from cli |
| | 141 | if ( filepath.lastIndexOf( '/' + file ) === filepath.length - ( file.length + 1 ) ) { |
| | 142 | return true; |
| | 143 | } |
| | 144 | |
| | 145 | return false; |