eslint检查jsx语法规则

1、IDE报错如下图片描述

2、eslint配置如下

{
  "env": {
    "es6": true,
    "node":true,
    "browser": true
  },
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "experimentalObjectRestSpread": true
    }
  },
  "extends": [
    "plugin:react/recommended"
  ],
  ...
  "indent": [2, 2, {
      "SwitchCase": 1,
      "ObjectExpression": 1
    }],
}

3、我要怎么配置才能让eslint检查的时候是根据元素标签的属性(即如图中按19格对齐)对齐不报错。

阅读 7.3k
2 个回答

直接给indent配置为0,就不检查了。
indent: 0.

新手上路,请多包涵

并不是对齐有错,而是前边多了空格

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题