最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable "use strict" in JSHint - Stack Overflow

programmeradmin3浏览0评论

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" mand 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.

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" mand 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.

Share Improve this question asked Jun 22, 2016 at 20:08 Justin CarraoJustin Carrao 451 silver badge3 bronze badges 1
  • 1 jshint./docs/options/#strict – acupofjose Commented Jun 22, 2016 at 20:10
Add a ment  | 

1 Answer 1

Reset to default 4

Just set strict option to false, for more details look http://jshint./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
发布评论

评论列表(0)

  1. 暂无评论