vue prettier/prettier eslintrc相关问题

修改 eslint 记得重新 run 一下

1:warning Delete prettier/prettier(eslint配置的一些问题)

原因描述
在window系统中,clone代码下来,会自动把换行符LF(linefeed character) 转换成回车符CRLF(carriage-return character)。这时候我们本地的代码都是回车符。

方法一: 自动修复,不可能每次拉代码都要修改好麻烦不支持

npm run lint --fix

方法二:git 修改配置

git config --global core.autocrlf false

2:Replace (变量) with 变量eslintprettier/prettier

箭头函数单个参数时,vscode的prettier和vue的prettier冲突,解决办法,eslintrc.js中添加
错误信息 this.(values).then((success) => ({
Replace(success)withsuccesseslintprettier/prettier

//处理箭头函数单个参数括号规则冲突
.eslintrc.js
rules: {
    "prettier/prettier": ["error", { singleQuote: true, parser: "flow" }] 
 },

3:vue-cli3报error Parsing error: Unexpected token (太难了)

这个问题网上所有办法都不行,最后直接拿出一个完整版

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',
  },
};

持续更新中

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值