當苦於要一個個修復webstorm的eslint報錯的問題時,您需要這篇文章.
開啟webstorm->file->settings->eslint

選項解讀:

- eslint package:匯入的是eslint的包
- automatic search:是webstorm自動查詢專案中的.eslintrc檔案
- configuration file:是使用者特定的.eslintrc檔案(使用在有多個.eslintrc檔案的情況下)
- extra eslint options:可以用來設定公共的eslint規則,用在所有專案上.
按我選的就好
這樣的話,右鍵點選fix eslint problems,webstorm就可以根據.eslintrc檔案的規則來自動恢復. 但是有快捷鍵的話,就更加方便了,那我們就給他一個快捷鍵. 同樣在settings裡搜尋eslint

外傳:
很多小夥伴會有跟我之前一樣的疑惑:webtorm恢復的會不會是webstorm自定義的規則,而不是我們自定義的.eslintrc規則.
針對這個問題,我展開了深入的探索.
我們就找一條規則測試吧
"no-extra-semi": "error"
意思是禁用額外分號
這是沒有新增規則的情況下:


yes.