Skip to content

react/jsx-indent-props false positive in ternary operator #2841

Closed
@polyrainbow

Description

@polyrainbow

Since 7.21.4 I get a react/jsx-indent-props false positive when using props in a ternary operator. I thought issue I'm having is the same as #2828 and thus would be fixed in 7.21.5, but it looks like #2828 is fixed in 7.21.5 and this is not. 7.21.3 works fine. See below for eslint config.

Error

Bildschirmfoto 2020-10-22 um 15 19 27

Code

import { h } from "preact";

const Component = (props) => {
  return props.prop
    ? <input
      type="email"
    />
    : "";
};

export default Component;
eslint-Config
{
  "env": {
    "browser": true,
    "commonjs": true,
    "es6": true,
    "jest": true
  },
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module"
  },
  "extends": [
    "standard",
    "eslint:recommended",
    "standard-react"
  ],
  "plugins": [
    "react-hooks",
    "jsx-props-no-empty-lines"
  ],
  "settings": {
    "react": {
      "pragma": "h",
      "version": "16.3"
    }
  },
  "rules": {
    "indent": [
      "error",
      2
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      "error",
      "double"
    ],
    "semi": [
      "error",
      "always"
    ],
    "no-unused-vars": [
      "error", {
        "vars": "all",
        "args": "after-used",
        "ignoreRestSiblings": false
      }
    ],
    "eqeqeq": ["error"],
    "no-redeclare": ["error"],
    "no-empty": ["error"],
    "vars-on-top": ["error"],
    "no-eq-null": ["error"],
    "no-extra-boolean-cast": ["error"],
    "no-label-var": ["error"],
    "no-undefined": ["error"],
    "no-use-before-define": ["error"],
    "no-mixed-requires": ["error"],
    "camelcase": ["error"],
    "no-mixed-spaces-and-tabs": ["error"],
    "no-multi-assign": ["error"],
    "no-const-assign": ["error"],
    "no-var": ["error"],
    "prefer-const": ["error"],
    "operator-linebreak": ["error", "before"],
    "no-console": ["error"],
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn",
    "jsx-props-no-empty-lines/no-empty-lines": "error",
    "jsx-quotes": ["error", "prefer-double"],
    "react/jsx-pascal-case": "error",
    "react/prop-types": [0],
    "react/jsx-closing-bracket-location": [0],
    "react/jsx-closing-tag-location": [0],
    "react/jsx-handler-names": [0],
    "react/jsx-indent-props": [
      "error",
      2
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions