WebStorm 2017.1 EAP, 171.2455: improved integration with TSLint

A new Early Access Preview build for WebStorm 2017.1 (171.2455.4) is now available! You can download it here and install it side-by-side with your current stable WebStorm version, or if you have the previous EAP build, you should soon get a notification in the IDE about a patch update.

Improved integration with TSLint

We’ve updated the integration with TSLint making it faster (thanks to the new architecture that allows the IDE to communicate with TSLint as with a language service) and open source. We are still finalizing the documentation, but we hope that this plugin can be a good reference point for those who would like to implement a plugin for some other linter.

Fix options

You can now apply the TSLint-powered fixes for some of the issues TSLint detects.

tslint-fix

For that hit Alt-Enter on the highlighted problem and select either TSLint: fix current problem to fix only this particular issue or TSLint: fix current file to apply the fixes when possible to the whole file.

Import code style from tslint.json

WebStorm now understands some of the TSLint rules described in tslint.json and allows to apply them to the project’s TypeScript code style configuration in WebStorm. To do so open tslint.json and answer Yes to the question “Apply code style from TSLint?” on top of the editor.

tslint-apply

Please note that only some rules can be applied (e.g. quotes style, indent type, etc).

Use of semicolons in JavaScript and TypeScript

WebStorm 2017.1 allows you to configure whether you’d like to use semicolons to terminate statements in JavaScript and TypeScript or not. You can find it under Preferences | Editor | Code Style – JavaScript or TypeScript – Other.

code-style-semicolon

If you select Use semicolon in new code, WebStorm will add semicolons to the new code it generates on code completion, but won’t add semicolons to the existing code on reformatting. If you want to add semicolons in all your code – select Use semicolon always. Or select Don’t use semicolon to avoid them at the end of the statements.

Among other improvements is support for dynamic imports proposal for JavaScript.

You can find the full list of issues addressed in this EAP build in the Release notes.

Learn more about other new features in WebStorm 2017.1:

  • WebStorm 2017.1 EAP, 171.1834: Run Mocha tests with the gutter icon; The test status is now shown right next to the test; Integration with the Angular language service; Linters are now detected and enabled by default for the new projects; Support for emoji in the editor; Zero-latency typing is now enabled by default.
  • WebStorm 2017.1 EAP, 171.2014: New intentions that convert forEach and for..in iterations over arrays to for..of; Code style options for quotes and ternary operators; New inspection Equality operator may cause type coercion.
  • WebStorm 2017.1 EAP, 171.2271: Standard code style; Completion in package.json.
  • WebStorm 2017.1 EAP, 171.2822: Initial support for Vue.js; Code style option for trailing comma; Debugging Dart VM tests.

Please report your feedback to our issue tracker. To get notifications of new EAP builds as they become available, subscribe to the EAP channel in Preferences | Appearance & Behavior | System Settings | Updates.

– JetBrains WebStorm Team

About Ekaterina Prigara

Ekaterina Prigara is WebStorm product marketing manager at JetBrains. She's passionate about new technologies, UX and coffee.
This entry was posted in Early Access Preview and tagged , . Bookmark the permalink.

11 Responses to WebStorm 2017.1 EAP, 171.2455: improved integration with TSLint

  1. Nick says:

    Auto configuration from tslint doesn’t handle { NamedImport } spacing

  2. Andreas says:

    Can I bind the “Tslint: Fix current file” command to a shortcut in intellij? Its tedious to always hit alt+enter to open a dialog and then select it.

  3. nolazybits says:

    This is not working sadly.
    Using

    IntelliJ IDEA 2018.1 EAP (Ultimate Edition)
    Build #IU-181.3986.9, built on February 28, 2018
    IntelliJ IDEA EAP User
    Expiration date: March 30, 2018
    JRE: 1.8.0_152-release-1136-b16 x86_64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    macOS 10.13.3

    there are/were no popup showing in my tslint.json to apply tslint rules to code style.

    My 2 cents would be best to have a setting option true/false without overwrite codestyle rules with tsconfig file rules in the tslint settings.

    Cheers

    • Ekaterina Prigara says:

      Hi,

      In IntelliJ IDEA 2018.1, the code style from the tslint.json file is imported automatically when you open the project for the first time.
      You will see the notification on top of the file only in case when there are still some TSLint rules in the tslint.json file that are known to the IDE (not all TSLint rules can be applied) that don’t match the current code style. If all known rules are already applied, then you will not see the notification.

      • nolazybits says:

        Hello Ekaterina,
        Thanks for the reply.
        If I try to modify any rules (do you have a list of the ones supported by intelliJ IDEA btw) I see no popup either.
        Also, Code Style and tslint sometimes fight each other, like for instance on the import optimization and tslint import rules.

        What I would like to see is:
        * a supported list of rules
        * as said an option to be able to say intelliJ to have it’s codestyle rules overwritten by the tslint ones.

        Cheers :)

        • Ekaterina Prigara says:

          Any chance you can send us your TSLint configuration file so we can have a closer look at it? By the way, is it located in the project root?

          Unfortunately, we don’t have a document with a full list of supported rules. Some rules are only applied when they don’t contain additional options. Basically, we support the rules related to spacing, semicolons, quotes and line length. You can get the idea from this file.
          For imports we support the “import-blacklist” and “import-destructuring-spacing” rules.

          > * as said an option to be able to say intelliJ to have it’s codestyle rules overwritten by the tslint ones.
          So that is basically what this feature does. However, since we can only override the rules that have a corresponding IDE code style setting, we can’t guarantee that the code will have no warnings from TSLint.

          • Xavier Martin says:

            Hello and thanks for the reply.
            So i guess my problem is I thought IntelliJ was supporting the full rules set (when they can be applied to code style).
            I have created a ticket here
            https://youtrack.jetbrains.com/issue/IDEA-187912
            attaching the tslint.json file too.

            Thanks again for your support :)

          • Ekaterina Prigara says:

            > So i guess my problem is I thought IntelliJ was supporting the full rules set (when they can be applied to code style).
            No, sorry, we only apply those rules that have matching code style rules in IntelliJ IDEA. Moreover, in general, not all rules that can be reported can be actually fixed automatically.
            Thanks for the issue!

  4. nolazybits says:

    * My 2 cents would be best to have a setting option true/false with overwrite codestyle rules with tsconfig file rules in the tslint settings

Leave a Reply

Your email address will not be published. Required fields are marked *