Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react/jsx-indent throws an error with props default to true #2119

Closed
keqingrong opened this issue Jan 4, 2019 · 0 comments
Closed

react/jsx-indent throws an error with props default to true #2119

keqingrong opened this issue Jan 4, 2019 · 0 comments

Comments

@keqingrong
Copy link

Version:

"eslint": "^5.11.1",
"eslint-plugin-react": "^7.12.2"

Config:

"react/jsx-indent": ["warn",  2, { "checkAttributes": true }]

Code:

function Foo() {
  return (
    <input
      type="radio"
      defaultChecked
    />
  );
}

If no value passed for a prop, ESLint will crash and throw an error like this:

TypeError: Cannot read property 'type' of null
    at handleAttribute (D:\Workspace\eslint-demo\node_modules\eslint-plugin-react\lib\rules\jsx-indent.js:256:42)

https://github.com/yannickcr/eslint-plugin-react/blob/230c7e018b876a17336729f0f079f535227e3d0b/lib/rules/jsx-indent.js#L256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants