Configure * all * JSHint Settings in WebStorm IDE

After some comprehensive evaluation of the IDE for use in front end development, WebStorm leads the package, I think.

One missing element is that we cannot configure JSHint as we need. The WebStorm GUI settings provide some options, but not a complete set. The GUI allows you to configure only 15 of the 30 available actual parameters.

This is a problem because we don’t want to change our encoding methods just because the IDE does not allow us to customize the way we want.

Is there a hacker way to log in and set up the JSHint library behind the scenes for WebStorm?

+4
source share
3 answers

You can configure all the options you want in the .jshintrc file located in the root directory of your project. This will be the setting throughout the project.

From https://www.jetbrains.com/webstorm/webhelp/jshint.html :

Use configuration files

Select this check box to have the code checked in accordance with the settings from the configuration file. The configuration file is a JSON file with the extension .jshintrc , which indicates which JSHint settings should be enabled or disabled. WebStorm will search for the .jshintrc file in the working directory. If the search failed, WebStorm will search in the parent folder, and then again in the parent folder. The process repeats until WebStorm finds .jshintrc or reaches the root of the project. For WebStorm to still perform validation in this case, specify the default configuration file to use.

I have been using this for a while and it works great. In addition, you can transfer it to your repo and ensure that the whole team adheres to the same code style. Also a great place to add globals.

+3
source

I don’t know about any hacker way to do this, but you can vote for an existing feature request .

+2
source

It has a solution for every file that works, but not perfect. Prefer an IDE or fix / hack a project.

Set the JSHint options at the top of the file:

 /*jshint laxcomma:true, asi:true */ 
+2
source

Source: https://habr.com/ru/post/1433605/


All Articles