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 weird lint output #1226

Merged
merged 1 commit into from
Dec 10, 2016
Merged

Conversation

n3tr
Copy link
Contributor

@n3tr n3tr commented Dec 10, 2016

fixes #1218

Since I can't reproduce it by myself, I use https://github.com/dtinth/pixelpaint to reproduce and verify.

Result

Compiled with warnings.

Warning in ./src/App.js

/Users/n3tr/Code/js/pixelpaint/src/App.js
  45:49  warning  Unexpected mix of '&&' and '||'  no-mixed-operators
  46:44  warning  Unexpected mix of '&&' and '||'  no-mixed-operators

✖ 2 problems (0 errors, 2 warnings)


Warning in ./src/ReduxCanvasV3.js

/Users/n3tr/Code/js/pixelpaint/src/ReduxCanvasV3.js
  25:5  warning  Expected a default case  default-case

✖ 1 problem (0 errors, 1 warning)


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

@@ -39,6 +33,12 @@ function formatMessage(message) {
lines[0] = lines[0].substr(lines[0].lastIndexOf('!') + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

This line would crash if lines had no elements.
I think it should be if (lines[0] && ...

Copy link
Contributor Author

@n3tr n3tr Dec 10, 2016

Choose a reason for hiding this comment

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

I don't think it would crash since lines come from message.split('\n'); and it should has at least one element of empty string.

We're also checking if (lines[0].lastIndexOf('!') !== -1) (line 38) and it would be false if lines[0] is an empty string.

@gaearon
Copy link
Contributor

gaearon commented Dec 10, 2016

You're right.

@gaearon gaearon merged commit 7e2a08b into facebook:master Dec 10, 2016
@gaearon gaearon added this to the 0.8.4 milestone Dec 10, 2016
@gaearon gaearon mentioned this pull request Dec 11, 2016
alexdriaguine pushed a commit to alexdriaguine/create-react-app that referenced this pull request Jan 23, 2017
randycoulman pushed a commit to CodingZeal/create-react-app that referenced this pull request May 8, 2017
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Weird lint output
3 participants