Add more jshint targets; this is the beginning of library build
support.
Showing
1 changed file
with
34 additions
and
4 deletions
... | @@ -206,6 +206,11 @@ module.exports = function (grunt) { | ... | @@ -206,6 +206,11 @@ module.exports = function (grunt) { |
206 | }); | 206 | }); |
207 | } | 207 | } |
208 | 208 | ||
209 | function jshintAddExtra(src, container, dest) { | ||
210 | if (src) { | ||
211 | container[dest] = container[dest].concat(src); | ||
212 | } | ||
213 | } | ||
209 | if (mpConfig.jshint) { | 214 | if (mpConfig.jshint) { |
210 | initConfig.jshint = { | 215 | initConfig.jshint = { |
211 | options: mpConfig.jshint.options, | 216 | options: mpConfig.jshint.options, |
... | @@ -222,15 +227,40 @@ module.exports = function (grunt) { | ... | @@ -222,15 +227,40 @@ module.exports = function (grunt) { |
222 | files: { | 227 | files: { |
223 | src: [ | 228 | src: [ |
224 | 'src/scripts/*.js', | 229 | 'src/scripts/*.js', |
230 | ], | ||
231 | }, | ||
232 | }, | ||
233 | model: { | ||
234 | options: _.extend({}, mpConfig.jshint.modelOptions || mpConfig.jshint.browserOptions, { | ||
235 | globals: { | ||
236 | define: false, | ||
237 | require: false, | ||
238 | }, | ||
239 | }), | ||
240 | files: { | ||
241 | src: [ | ||
225 | 'src/scripts/model/**/*.js', | 242 | 'src/scripts/model/**/*.js', |
243 | ], | ||
244 | }, | ||
245 | }, | ||
246 | view: { | ||
247 | options: _.extend({}, mpConfig.jshint.viewOptions || mpConfig.jshint.browserOptions, { | ||
248 | globals: { | ||
249 | define: false, | ||
250 | require: false, | ||
251 | }, | ||
252 | }), | ||
253 | files: { | ||
254 | src: [ | ||
226 | 'src/scripts/view/**/*.js', | 255 | 'src/scripts/view/**/*.js', |
227 | ], | 256 | ], |
228 | }, | 257 | }, |
229 | } | 258 | }, |
230 | }; | 259 | }; |
231 | if (mpConfig.jshint.all) { | 260 | jshintAddExtra(mpConfig.jshint.all, initConfig.jshint, 'all'); |
232 | initConfig.jshint.all = initConfig.jshint.all.concat(mpConfig.jshint.all); | 261 | jshintAddExtra(mpConfig.jshint.main, initConfig.jshint.main.files, 'src'); |
233 | } | 262 | jshintAddExtra(mpConfig.jshint.model, initConfig.jshint.model.files, 'src'); |
263 | jshintAddExtra(mpConfig.jshint.view, initConfig.jshint.view.files, 'src'); | ||
234 | checkList.push('jshint'); | 264 | checkList.push('jshint'); |
235 | } | 265 | } |
236 | 266 | ... | ... |
-
Please register or sign in to post a comment