2012-03-19 15 views
11

¿Cómo paso la configuración global a jshint? No encontré la respuesta en la documentación.¿Cómo paso la configuración global a jshint?

Mi fichero de configuración:

>type tests\jshint_options.js 
/*jshint globalstrict:true */ 

Esto es lo que he probado hasta ahora:

>jshint myfile.js --config=tests\jshint_options.js 
myfile.js: line 1, col 1, Use the function form of "use strict". 
myfile.js: line 4, col 24, Unescaped '['. 
myfile.js: line 4, col 49, Unescaped '['. 

3 errors 

>jshint myfile.js --config tests\jshint_options.js 

node.js:201 
     throw e; // process.nextTick error, or 'error' event on first tick 
      ^
SyntaxError: Unexpected end of input 
    at Object.parse (native) 
    at _loadAndParseConfig (C:\Users\RONG\AppData\Roaming\npm\node_modules\jshint\lib\cli.js:28:18) 
    at Object.interpret (C:\Users\RONG\AppData\Roaming\npm\node_modules\jshint\lib\cli.js:114:22) 
    at Object.<anonymous> (C:\Users\RONG\AppData\Roaming\npm\node_modules\jshint\bin\hint:2:25) 
    at Module._compile (module.js:441:26) 
    at Object..js (module.js:459:10) 
    at Module.load (module.js:348:31) 
    at Function._load (module.js:308:12) 
    at Array.0 (module.js:479:10) 
    at EventEmitter._tickCallback (node.js:192:40) 

> 
+0

FYI, se abrió un problema para documentar esto: https://github.com/jshint/jshint/issues/483 – ripper234

Respuesta

10

Después de mucha excavación, encontré este helpful blog post que deleitó ...

que el archivo de configuración está en formato JSON, ¡no en comentarios de JavaScript!

{ 
    "supernew": true 
} 

P.S.

¡Esto está realmente documentado en nodejs-jshint documentations! No estoy seguro de por qué no he encontrado eso antes.