Skip to content

button-has-type mistakenly says "null" in its error message #1874

Closed
@lydell

Description

@lydell

Extracted from #1555 (comment)

// index.js
<button type={foo}>test</button>
$ eslint index.js 

/home/lydell/stuff/eslint/index.js
  1:1  error  "null" is an invalid value for button type attribute  react/button-has-type

✖ 1 problem (1 error, 0 warnings)
// .eslintrc.js
module.exports = {
  parserOptions: {
    ecmaVersion: 2018,
    ecmaFeatures: {
      jsx: true
    }
  },
  plugins: ["react"],
  rules: {
    "react/button-has-type": "error"
  }
}
// package.json
{
  "private": true,
  "dependencies": {
    "eslint": "5.0.1",
    "eslint-plugin-react": "7.10.0"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions