解決vue3.0運(yùn)行項(xiàng)目warning Insert `·` prettier/prettier問(wèn)題
vue3.0運(yùn)行項(xiàng)目warning Insert `·` prettier/prettier
警告:
解決
執(zhí)行 npm run lint --fix
vue prettier/prettier eslintrc相關(guān)問(wèn)題
修改 eslint 記得重新 run 一下
1:warning Delete ? prettier/prettier(eslint配置的一些問(wèn)題)
原因描述
在window系統(tǒng)中,clone代碼下來(lái),會(huì)自動(dòng)把換行符LF(linefeed character) 轉(zhuǎn)換成回車(chē)符CRLF(carriage-return character)。這時(shí)候我們本地的代碼都是回車(chē)符。
方法一: 自動(dòng)修復(fù),不可能每次拉代碼都要修改好麻煩不支持
npm run lint --fix
方法二:git 修改配置
git config --global core.autocrlf false
2:Replace (變量) with 變量eslintprettier/prettier
箭頭函數(shù)單個(gè)參數(shù)時(shí),vscode的prettier和vue的prettier沖突,
解決辦法,eslintrc.js中添加
錯(cuò)誤信息 this.(values).then((success) => ({
Replace(success)withsuccesseslintprettier/prettier
//處理箭頭函數(shù)單個(gè)參數(shù)括號(hào)規(guī)則沖突 .eslintrc.js rules: { "prettier/prettier": ["error", { singleQuote: true, parser: "flow" }] },
3:vue-cli3報(bào)error Parsing error: Unexpected token (太難了)
這個(gè)問(wèn)題網(wǎng)上所有辦法都不行,最后直接拿出一個(gè)完整版
module.exports = { root: true, env: { node: true, }, extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/prettier'], parserOptions: { parser: 'babel-eslint', ecmaFeatures: { // open the `decorators` function legacyDecorators: true, }, }, // 'arrow-parens': ['error', 'as-needed'], rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-param-reassign': 'off', 'no-unused-vars': 'off', 'no-underscore-dangle': 'off', 'no-unreachable': 'off', 'generator-star-spacing': 'off', 'import/no-extraneous-dependencies': 'off', 'array-callback-return': 'off', 'no-useless-escape': 'off', 'no-confusing-arrow': 'off', 'consistent-return': 'off', 'no-debugger': 'warn', 'no-plusplus': 'off', 'jsx-a11y/label-has-associated-control': 'off', 'jsx-a11y/label-has-for': 'off', 'comma-dangle': 0, 'object-curly-newline': 'off', 'operator-linebreak': 'off', 'import/prefer-default-export': 'off', 'implicit-arrow-linebreak': 'off', 'import/no-unresolved': 'off', 'import/extensions': 'off', 'arrow-parens': 0, 'prettier/prettier': 'off', }, };
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vuejs在v-for中,利用index來(lái)對(duì)第一項(xiàng)添加class的方法
下面小編就為大家分享一篇Vuejs在v-for中,利用index來(lái)對(duì)第一項(xiàng)添加class的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-03-03Vue實(shí)現(xiàn)項(xiàng)目通用配置環(huán)境管理詳解
這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)項(xiàng)目通用配置環(huán)境管理的相關(guān)知識(shí),文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2024-03-03vue控制多行文字展開(kāi)收起的實(shí)現(xiàn)示例
這篇文章主要介紹了vue控制多行文字展開(kāi)收起的實(shí)現(xiàn)示例(也叫控制文字展開(kāi)隱藏),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10sublime如何配置開(kāi)發(fā)VUE環(huán)境自動(dòng)格式化代碼
這篇文章主要介紹了sublime如何配置開(kāi)發(fā)VUE環(huán)境自動(dòng)格式化代碼問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03Ant Design Vue全局對(duì)話確認(rèn)框(confirm)的回調(diào)不觸發(fā)
這篇文章主要介紹了Ant Design Vue全局對(duì)話確認(rèn)框(confirm)的回調(diào)不觸發(fā)問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07vue3的父?jìng)髯訂?wèn)題(單項(xiàng)數(shù)據(jù)流)
這篇文章主要介紹了vue3的父?jìng)髯訂?wèn)題(單項(xiàng)數(shù)據(jù)流),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-01-01