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

This blog is permanently closed.

For up-to-date information please follow to corresponding WebStorm blog or PhpStorm blog.

 
This entry was posted in Cool Feature, PhpStorm, WebStorm and tagged , , , , , . Bookmark the permalink.

4 Responses to New JavaScript inspections and intentions

  1. Oliver Turner says:

    Are there any plans to bring this functionality to CoffeeScript?

    Sinceerely hope so…

  2. Bryan Green says:

    This stuff is great! I’m looking forward to trying it out.

  3. Andrey Vokin says:

    We are already working on making all JS inspections enabled for CoffeeScript files.

    You could vote for the issue: http://youtrack.jetbrains.com/issue/RUBY-11020

Comments are closed.