VS Code Extension: Add “use strict” to your JavaScript files

本篇本章設有中文版

ECMAScript 5 (Known as JavaScript) has a “strict mode”, while you should add 'use strict' to all JavaScript files in your Node.js projects, in order to enable strict mode. (You may also add a — use_strict flag while running your application. But those third parties libraries used in your project are out of your control, and may not work well in strict mode. Therefore this method is not recommended.) This time-consuming and error-prone process should be done with extensions.

But there are a few issues in the similar extensions on MarketPlace:

  1. No option to use single quote(') or double quote(")
  2. No option to add semicolon(;) or not
  3. Repeatedly add the 'use strict' statement to the files already have it

I better write my own one. So there we have it: Insert use strict.

There are a few configurations you can adjust, should be enough for different coding styles. You may find the details and usage in the download page.

If you find any issues or if you want to submit pull requests, please visit GitHub.

A JavaScript/Node/Flutter developer who love technical stuffs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store