WebStorm throwing 'Unexpected Token' in getter functions for xpath selectors in automation project

I am working on an automation project using Cucumber.js, but in my page object files, all of my getter functions that use xpath 2.0 selectors are throwing me the error "unexpected token". After clearing all of the inspections, I am still running into this issue, and there seems to be no way for me to get rid them. Here is an image a more detailed description. The errors that are being throw are only syntax errors, they do not cause me any issues during run time. 

Any help is appreciated, thanks in advance! 

4 comments

 This happens because WebStorm auto-injects CSS (or, more precisely, a special CSS subset called JqueryCSS) in $('') calls in order to provide classes/IDs completion/navigation, and xpath 2.0 selectors is definitely not a valid CSS syntax.

Unfortunately these injections are hardcoded and can't be removed (https://youtrack.jetbrains.com/issue/WEB-8191); I can only suggest switching errors highlighting off for such files: open your file in editor, click the Hector icon in the lower right corner and then move the slider to change the Highlighting level to None. See http://www.jetbrains.com/idea/webhelp/changing-highlighting-level-for-the-current-file.html.

2

Cool, thank you for the prompt response. Is there a way for me to change the Highlighting level to None for all files under a specific directory? 

0

No, it can only be changed for individual files:(

0

That's fine, I will make sure to do that from here on out. Than you! :) 

0

Please sign in to leave a comment.