简体   繁体   中英

How to disable “use strict” in JSHint

I'd like to eliminate the 'Missing "use strict" statement.' warning that JSHint shows in my .js files. Now, I want to keep the rest of the functionality intact, and I want a global way to disable the "use strict;" thing, because inserting the "use strict" command into every file is not an option for me.

I haven't been able to find any solutions that don't involve adding "use strict;" to each file, so I'm hoping this question will point me in the right direction.

Thanks.

Just set strict option to false , for more details look http://jshint.com/docs/options/#strict

false - disable warnings about strict mode


This option requires the code to run in ECMAScript 5's strict mode. Strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode eliminates some JavaScript pitfalls that didn't cause errors by changing them to produce errors. It also fixes mistakes that made it difficult for the JavaScript engines to perform certain optimizations.

  • "global" - there must be a "use strict"; directive at global level
  • "implied" - lint the code as if there is the "use strict"; directive
  • false - disable warnings about strict mode
  • true - there must be a "use strict"; directive at function level; this is preferable for scripts intended to be loaded in web browsers directly because enabling strict mode globally could adversely effect other scripts running on the same page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM