| | 10 | // Limit JSHint's run to a single specified file |
| | 11 | // grunt jshint --file=filename.js |
| | 12 | function jshintFilter( filepath ) { |
| | 13 | var file = grunt.option( 'file' ); |
| | 14 | |
| | 15 | // Don't filter when no target file is specified |
| | 16 | if ( ! file ) { |
| | 17 | return true; |
| | 18 | } |
| | 19 | |
| | 20 | // Normalize filepath for Windows |
| | 21 | filepath = filepath.replace( /\\/g, '/' ); |
| | 22 | |
| | 23 | // Match only the filename passed from cli |
| | 24 | if ( filepath.lastIndexOf( '/' + file ) === filepath.length - ( file.length + 1 ) ) { |
| | 25 | return true; |
| | 26 | } |
| | 27 | |
| | 28 | return false; |
| | 29 | } |
| | 30 | |
| 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; |
| 146 | | } |
| | 150 | filter: jshintFilter |