Eslint rules block conflicts with extended config, and linting is not happy either way

Viewed 65

The relevant part of my package.json:

  "eslintConfig": {
    "root": true,
    "extends": [
      "eslint:recommended",
      "airbnb",
      "airbnb-typescript"
    ],
    "parserOptions": {
      "project": "tsconfig.json"
    },
    "rules": {
      "indent": [
        "error",
        4
      ],
      "react/jsx-indent": [
        "error",
        4
      ],
      "react/tsx-indent": [
        "error",
        4
      ],
      "react/jsx-filename-extension": [
        1,
        {
          "extensions": [
            ".js",
            ".jsx",
            ".ts",
            ".tsx"
          ]
        }
      ]
    }
  }

The airbnb ruleset specifies an indent of two spaces, my rules specify four spaces. Running --fix does nothing to indentation, and when I look at linting errors, if a line is indented by 4 spaces, it complains that it should be indented by 2, and vice versa: if a line is indented by 2 spaces, it complains that it should be indented by 4.

To me, this suggests that the 'rules' block is conflicting with the 'extends' block, but my understanding is that the rules should override the 'extends' block.

0 Answers
Related