Reputation: 4174
I have the following error for my files in tests:
Expected an assignment or function call and instead saw an expression.
It is generated from Chai libraries asserts. How can I turn it off in Webstorm? It makes the line yellow and shows a warning.
Upvotes: 18
Views: 9983
Reputation: 835
It's for phpstorm
Disable JSHint and configure its behavior in PhpStorm In the Settings/Preferences dialog ⌘ , go to Languages and Frameworks | JavaScript | Code Quality Tools | JSHint.
On the JSHint page that opens, Unselect the Enable checkbox.
Refer link: https://www.jetbrains.com/help/phpstorm/jshint.html
Upvotes: 4
Reputation: 24902
Had the same issue when using chai
, here is what fixed it for me —
WebStorm
then Preferences
Expression statement which is not assignment
Upvotes: 18
Reputation: 670
The issue here is that WebStorm generates internal warnings using JSHint, but this internal mechanism is entirely separate from enabling JSHint under Settings/Languages & Frameworks/JavaScript/Code Quality Tools/JSHint. (If you enable JSHint there, you'll get even more warnings, it seems like JSHint is basically running twice with different configurations.)
You need to configure the inspections in Settings/Editor/Inspections, then in the list on the right, find JavaScript/JavaScript validity issues. That worked for me to remove the Chai warnings. (I am using the WebStorm 11 EAP at the moment.)
Upvotes: 15
Reputation: 93728
Settings/Languages & Frameworks/JavaScript/Code Quality Tools/JSHint, Relaxing Options/Suppress warnings about the use of expressions as statements
Upvotes: 1