【eslint】eslint踩坑日記


用腳手架創建一個vue cli3項目,采用eslint+Prettie 進行代碼格式化。

啟用eslint 后會有   Failed to load config "standard" to extend from.報錯

解決辦法 

yarn add eslint-plugin-promise

yarn add eslint-plugin-node

yarn add eslint-plugin-import

yarn add eslint-plugin-standard

yarn add eslint-config-standard

 錯誤代碼 Expected indentation of 2 spaces but found 1 tab

解決辦法     rules中添加   indent: ['error', 'tab'],   eslint默認是用2個空格縮進,這句話改為使用tab縮進 ,配合.editorconfig文件中的

indent_style = tab
indent_size = 4 代碼4空格縮進效果

 

 

 

eslint 配置  解決 4個空格,空格與tab沖突等問題

添加.editorconfig  .eslintignore .eslintrc.js 這三個文件

需改 settings.json

給一個調好eslint的的鏈接   提取碼7uff

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM