How to make WebStorm format code according to eslint?

后端 未结 6 885
不知归路
不知归路 2021-01-30 10:23

I\'ve specified eslint configuration for my WebStorm project. But it does not seem to apply to code reformat feature. For example, it continues to format import { somethin

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-30 10:51

    (Described steps and screenshots are from IntelliJ IDEA 2017.2)

    You can add a keyboard shortcut to action 'Fix ESLint Problem'. Ensure plugin 'JavaScript Support' is installed and enabled.

    First got to Preferences | Language & Frameworks | JavaScript | Code Quality Tools | ESLint and enable it. You will need to define your 'Node interpreter', 'ESlint package' and optional 'Configuration file'.

    Next go to Preferences | Keymap and search there for 'eslint'. Now you can add for example the shortcut 'control + shift + L'.

提交回复
热议问题