I'm working on an Aurelia project and as the part of the templating system use references to my view-model JavaScript files inside of my view HTML files. For example:
<label>${contact.lastName}</label>
<input value.bind="contact.lastName">
In both lines, WebStorm correctly identifies contact.lastName
as a JavaScript fragment and therefore highlights it with the "Expression statement is not assignment or call" inspection. While this is technically true, it's not a problem in this context.
I know that the simple solution is to disable that inspection in WebStorm, but that would also presumably disable it in all of my actual JavaScript files too where I would still want this inspection to happen.
What I want to know is, is there a way to turn off this inspection only in HTML files?
is there a way to turn off this inspection only in HTML files?
Yes -- every inspection can be altered on scope level (scope works with whole files). By default every inspection has 1 rule that affects whole project.
Settings/Preferences | Appearance & Behaviour | Scopes
Go there and create a custom Scope that would include such unwanted files/folders.
Save changes (either Apply
... or use OK
and re-open Settings screen again)
Settings/Preferences | Editor | Inspections
Locate inspection which you wish to alter.
Create new rule for recently created Scope. For that just click on In All Scopes
button (it's a button when only 1 rule is defined) and choose that scope.
Now just disable this inspection for that scope.
(Screenshots are for another language/inspection and done in older IDE version but everything else remains the same)
Official help pages: