question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[sort comp] error when defining static async before lifecycle methods

See original GitHub issue

we are using eslint-plugin-react in a next.js project. common pattern is:

class Comp extends React.Component {
  static async getInitialProps() {
    ...
  }
  componentDidMount() {
    ...
  }
}

since last update 7.9.1 you get a sort-comp error complaining that the static method should be placed after componentDidMount. Was that intended? Looks like a bug to me. this is maybe related to #1808

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Jun 7, 2018

The airbnb config doesn’t allow async functions.

1reaction
yannickcrcommented, Jun 5, 2018

I could not reproduce the bug with the default configuration.

@maerzhase Can you share your rule configuration ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[sort comp] error when defining static async before lifecycle ...
we are using eslint-plugin-react in a next.js project. common pattern is: class Comp extends React.Component { static async getInitialProps() { ...
Read more >
reactjs - How to fix warning caused by Flow Function Types ...
But I'm unable to fix the warning. I want the Function Types before constructor the same as the other Type Definition. How can...
Read more >
ASP.NET Core Razor component lifecycle | Microsoft Learn
The Razor component processes Razor component lifecycle events in a set of synchronous and asynchronous lifecycle methods.
Read more >
Spring Data for Apache Cassandra - Reference Documentation
You can apply static ordering by appending an OrderBy clause to the query method that references a property and by providing a sorting...
Read more >
48 answers on StackOverflow to the most popular Angular ...
ngOnInit is a lifecycle hook called by Angular2 to indicate that Angular is done creating the component. We have to import OnInit in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found