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 eslint errors #3374

Merged
merged 4 commits into from
Jan 31, 2019
Merged

Fix eslint errors #3374

merged 4 commits into from
Jan 31, 2019

Conversation

kravets-levko
Copy link
Collaborator

Mostly just removed extra empty lines at EoF.

@ranbena and @gabrieldutra There are also some fixes to components you were recently working on, so please check it. Thanks!

this.setState({
preview: markdown.toHTML(this.state.text),
preview: markdown.toHTML(text),
Copy link
Contributor

Choose a reason for hiding this comment

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

What lint error is this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

react/no-access-state-in-setstate

}

init.init = true;

Copy link
Contributor

Choose a reason for hiding this comment

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

This is related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I just noticed that this directive is not used anymore (checked twice 😄), so decided to remove it instead of fixing eslint warnings there.

Copy link
Contributor

@ranbena ranbena left a comment

Choose a reason for hiding this comment

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

One question about the removal of client/app/components/transclude-replace.js - is it related to this PR?

If so, go ahead and merge before anyone else.

@@ -47,13 +47,13 @@ export class DynamicForm extends React.Component {
}

setActionInProgress = (actionName, inProgress) => {
this.setState({
this.setState(prevState => ({
Copy link
Member

Choose a reason for hiding this comment

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

Cool, I didn't know prevState existed here 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Me too. I just read the docs 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BTW - it's the same warning as @ranbena mentioned above - react/no-access-state-in-setstate

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, eslint is smart enough to detect code like this (the same rule):

updateCounter() {
  const counter = this.state.counter + 1;
  this.setState({ counter });
}

(I tried to modify code this way, but warning didn't disappear 😅)

@kravets-levko kravets-levko merged commit 3d58860 into getredash:master Jan 31, 2019
@ghost ghost removed the in progress label Jan 31, 2019
@kravets-levko kravets-levko deleted the fix-eslint-errors branch January 31, 2019 12:33
@pr-triage pr-triage bot added the PR: merged label Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants