Early Access Program

New JavaScript Inspections and Intentions

In WebStorm 5.0 we’ve introduced new JavaScript static checks and editor intentions to improve your coding experience. Besides checks produced by JSDoc annotations described in the previous post, some fresh inspections for JSON, jQuery selectors and other contexts have been added.

1. JSON object literals have slightly different syntax than JavaScript and inspection checks that object literals defined in .json file conforms to JSON standard.

Also there are quick-fixes for removing extra commas, changing single quotes to double and quoting unquoted string values.

2. Some most evident jQuery efficiency problems are reported (inspired by this article).

ID selectors are significantly faster when used separately.

Duplicated selectors can be cached in a local variable (e.g. with a help of Introduce variable refactoring).

Attribute and pseudo-selectors will be highlighted if you enable it in inspection settings (Settings | Inspections).

3. Some possible errors are prevented.

One inspection keeps you from misspells and another checks that JSDoc parameters annotations match the function signature.

4. We are keeping your code clean.

The inspection Variable declarations are at the scope start (disabled by default) has a quick-fix to move declaration to the top.

5. New intention added: Convert parameters to object.

As usual, this quick-fix is invoked with Alt+Enter (⌥+Enter) when the caret is on the warning.

Develop with pleasure!
– JetBrains Web IDE Team

image description