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

[fix] prefer-stateless-function: avoid crash on ts empty constructor #2582

Merged

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Mar 1, 2020

fixes #2187

Typescript allows constructor without body, like

class Foo {
  constructor(a)
}

This PR adds a null check to avoid crash.

}
}
`,
parser: parsers.TYPESCRIPT_ESLINT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid test case, similar to the two cases above in line 138 - 156.

@golopot
Copy link
Contributor Author

golopot commented Mar 1, 2020

The build is failing for unrelated reasons.

@golopot
Copy link
Contributor Author

golopot commented Mar 1, 2020

Blocked by #2583.

@ljharb ljharb force-pushed the fix-crash-empty-constructor-in-ts branch from 5299132 to 5959b5f Compare March 3, 2020 04:18
@ljharb ljharb merged commit 5959b5f into jsx-eslint:master Mar 3, 2020
@golopot golopot deleted the fix-crash-empty-constructor-in-ts branch March 4, 2020 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

[prefer-stateless-function] not work with @typescript-eslint/parser
2 participants