1.安装File Watchers插件

2.打开设置点击Preferences>Tools>File Watchers项,增加一个监听任务

任务配置如下
File type: Any (or JavaScript)
Scope: Project files
Program: $ProjectFileDir$/node_modules/.bin/eslint
Arguments: --fix $FilePath$
Output paths to refresh: $FileDir$