【vscode系列】 =>ESlint配置问题

1.配置eslintrc.js

在.eslintrc.js文件里
设置

indent: ['off', 2],
rules: {
  'quote-props': 0,
  'dot-notation': 0,
  'consistent-return': 0,
  'no-multiple-empty-lines': 0,
  'prefer-arrow-callback': 0,
  'wrap-iife': 0,
  'no-undef-init': 0,
  'no-new-wrappers': 0,
  'linebreak-style': 0,
  'max-len': [0, 160],
  'lines-between-class-members': 0,
  'prefer-const': 0,
  'no-plusplus': 0,
  'comma-dangle': 0,
  'func-names': 0,
  'space-before-function-paren': 0,
  'prefer-template': 0,
  'no-else-return': 0,
  'object-curly-newline': 0,
  'no-bitwise': 0,
  'max-classes-per-file': 0,
  'class-methods-use-this': 0,
  'no-useless-constructor': 0,
  'no-unused-expressions': 0,
  'no-param-reassign': 0,
  'no-empty-function': 0,
  'no-console': 0,
  'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  'no-unused-vars': 0,
  'no-underscore-dangle': 0,
  'arrow-body-style': 0,
  'consistent-return': 0,
  'one-var': 0,
  'one-var-declaration-per-line': 0,
  'prefer-promise-reject-errors': 0,
  eqeqeq: 0,
  camelcase: 0,
  'object-shorthand': 0,
  indent: ['off', 2],
   'import/prefer-default-export': 0,
   'prefer-destructuring': 0,
}

2.配置.prettierrc.js

module.exports = {
    // 一行最多 100 字符
    printWidth: 100,
    // 不使用缩进符,而使用空格
    useTabs: false,
    // 使用 2 个空格缩进
    tabWidth: 4,
    tabSize: 4,
    // 行尾需要有分号
    semi: true,
    // 使用单引号
    singleQuote: true,
    // 对象的 key 仅在必要时用引号
    quoteProps: 'as-needed',
    // jsx 不使用单引号,而使用双引号
    jsxSingleQuote: false,
    // 末尾不需要逗号
    trailingComma: 'es5',
    // 大括号内的首尾需要空格
    bracketSpacing: true,
    // jsx 标签的反尖括号需要换行
    jsxBracketSameLine: false,
    // 箭头函数,只有一个参数的时候,也需要括号
    arrowParens: 'always',
    // 每个文件格式化的范围是文件的全部内容
    rangeStart: 0,
    rangeEnd: Infinity,
    // 不需要写文件开头的 @prettier
    requirePragma: false,
    // 不需要自动在文件开头插入 @prettier
    insertPragma: false,
    // 使用默认的折行标准
    proseWrap: 'preserve',
    // 根据显示样式决定 html 要不要折行
    htmlWhitespaceSensitivity: 'css',
    // 换行符使用 lf 结尾是 \n \r \n\r auto
    endOfLine: 'lf',
};

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不停喝水

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值