Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code: Check semicolon on javascript?

I need an extension for checking, if my javascript has a semicolon on the lineend. By searching the extension i only could find auto set semicolon extension, but i want to check large existing code.

Maybe i can build a custom rule?

like image 574
taa Avatar asked Feb 09 '18 13:02

taa


1 Answers

As Alexis Mateo mentioned you can use the ESLint Extension for vscode.
If you want to check for semicolons after a statement you do not need to write your own rule. Instead by setting an option like this in vscode's settings.json:

{
    "eslint.options": { "configFile": "C:/mydirectory/.eslintrc.json" }
}

you tell the extension where to look for the rule set it should apply.
Now you add the semi rule to your .eslintrc.json like this:

{
    "rules": {
        "semi": ["error", "always"]
    }
}

Here you can explore further rules.

like image 155
HaaLeo Avatar answered Sep 22 '22 00:09

HaaLeo