Search code examples
javascriptvisual-studio-codejshint

In VSCode, JSHint warns about missing semicolons


I am working on a JavaScript project. Visual Studio Code is my IDE and I see warnings about missing semicolons at the end of lines. The warnings are generated by JSHint. Since having semicolons at the end of lines is optional, I want to get rid of these warnings.


Solution

  • JSHint has an option that suppresses warnings about missing semicolons called asi. Open VSCode settings (Ctrl + ,), search jshint options and click on Edit in settings.json

    enter image description here

    Add the following to settings.json:

    "jshint.options": {
        "asi": true
    }
    

    If you already have "jsint.options" in your settings.json, simply just add "asi": true inside it.

    Note:

    You can edit settings.json for User or Workspace. In the image, you see that User tab (indicated by a red 1) is selected. In this mode, any change in settings.json affects all VSCode projects. If you want to apply this change only on this project, first select Workspace tab (indicated by a red 2) and then click on Edit in settings.json.