Webstorm Jasmine Integration - JSHint Does Not Recognize Jasmine

I installed Jasmine integration in Webstorm 8.0.4 using File> Preferences> JavaScript> Libraries. I added the karma-jasmine library with the lib / folder of my karma-jasmine node module.

This works fine, so the syntax highlighting works, I can go to the declaration, and the documentation is displayed correctly. So the connection seems to be perfect. However, JSHint still complains about every keyword that is not defined, like

 JSHint: 'describe' is not defined. (117) 

See also the following screenshot. As you can see, the syntax highlighting is great, but I still get the error message.

webstorm jasmine integration JSHint

+5
source share
2 answers

Given what I have from yoman build my .jshintrc, yes, you need to add these names to this file.

Annoying, yes, if you didn’t use something for the scaffold, like, well, yoman!

Here is the .jshintrc that yoman creates for me - plus the addition of lodash / underscore and jQuery.

 { "node": true, "browser": true, "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "eqeqeq": true, "immed": true, "indent": 4, "latedef": true, "newcap": true, "noarg": true, "quotmark": "single", "undef": true, "unused": true, "strict": true, "trailing": true, "smarttabs": true, "multistr": true, "globals": { "after": false, "afterEach": false, "angular": false, "before": false, "beforeEach": false, "browser": false, "describe": false, "expect": false, "inject": false, "it": false, "jasmine": false, "spyOn": false, "$": false, "_": false } } 
+8
source

This is a JSHint function. JSHint works on a per-file basis and does not know anything about global variables and functions defined in other files if they are not added to the "global" list. This can be done by adding the appropriate comments (/* global MY_LIB*/ - see http://www.jshint.com/docs/ ) into the code or by adding variables / functions that you would like to use globally in the "Predefined" list in Preferences -> Javascript -> Code Quality Tool -> JSHint -> Predefined (,separated) . This is the last item in the JSHint parameter list.

+3
source

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


All Articles