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

standard --fix doesn't work sometimes #632

Closed
dcposch opened this issue Sep 19, 2016 · 14 comments

Comments

@dcposch
Copy link

commented Sep 19, 2016

Using Node.js command prompt:

C:\...\code>standard --fix
standard: Use JavaScript Standard Style (http://standardjs.com)
standard: Run `standard --fix` to automatically fix some problems.
  [list of issues]
@Flet

This comment has been minimized.

Copy link
Member

commented Sep 19, 2016

Works on my machine™
screen shot 2016-09-19 at 11 18 25 am

Although I did notice a few days ago that --fix does not work sometimes if multiple errors are mixed in the same lines, so it could be because of a specific combo of errors? I'll try to find the exact case I saw.

@feross

This comment has been minimized.

Copy link
Member

commented Sep 19, 2016

@dcposch Can you share the exact file (or better, a minimal example) that this bug happens on? Or is does it always happen for you on Windows?

@jacob-israel-turner

This comment has been minimized.

Copy link

commented Sep 21, 2016

--fix doesn't appear to be working for me, though I'm on OSX.

@feross

This comment has been minimized.

Copy link
Member

commented Sep 21, 2016

Without further information, this issue is really difficult to debug.

@jacob-israel-turner How can you tell it's not working? Is the output indicating that there are automatically fixable errors and then you run --fix and they're not fixed?

Can you share the file and output from standard that causes this?

Other ideas:

  1. Run --fix multiple times. Does it work on a second run?
  2. Remove the ~/.standard-cache folder and run again. Does it work now?
@mrchief

This comment has been minimized.

Copy link

commented Sep 22, 2016

It doesn't work on multiple runs.

Removing the ~/.standard-cache folder seemed to have done the trick. At least on my PC it worked.

@jacob-israel-turner

This comment has been minimized.

Copy link

commented Sep 22, 2016

@feross I would run standard --fix, and it would tell me all of my issues, while also saying 'Run with --fix to automatically fix most of these problems', or whatever the message is.

I saw @Flet's comment about multiple errors on one line, so I went through and fixed all errors that were on a single line, and it seemed like --fix removed some of the errors automatically, but I was still getting the prompt. So I just went through from the top and started manually fixing issues, every time running standard --fix. Eventually it stopped giving me that extra prompt when I ran the command.

Seems like there are just some situations where it thinks it can fix something for me, but in reality it can't. However, in the end, I didn't have to manually fix any beginning-of-line spacing, or remove any semicolons. So it definitely worked to an extent.

EDIT: And I didn't try removing the cache. That may have solved the issue.

@feross feross changed the title standard --fix doesn't work on Windows standard --fix doesn't work sometimes Sep 22, 2016

@kinyat

This comment has been minimized.

Copy link

commented Oct 6, 2016

I have an issue when migrating to standardJS, it wont auto align for the code written in JSX.
I need to manually changing every JSX code which is a bit annoying :(

@feross

This comment has been minimized.

Copy link
Member

commented Oct 7, 2016

@jacob-israel-turner Seems like there are just some situations where it thinks it can fix something for me, but in reality it can't.

This really nails it. Thanks for explaining the issue. Now we just need a reproducible case where this happens and we can report it to the ESLint project as a bug.

@feross

This comment has been minimized.

Copy link
Member

commented Oct 7, 2016

@kinyat This issue is about something different than your issue. If you want, you can open a new issue and one of the contributors will look into it further. But note: Not all rules are automatically fixable, but more are added all the time.

@prashanth-kalaga

This comment has been minimized.

Copy link

commented Jan 6, 2017

--fix option also doesnot correct '==' and '!=' usages , but eslint lists that as fixable

@feross

This comment has been minimized.

Copy link
Member

commented Jan 7, 2017

@prashanth-kalaga Only certain statically-verifiable cases of the eqeqeq rule can be fixed.

@feross

This comment has been minimized.

Copy link
Member

commented Jan 7, 2017

I'm closing this issue because it's been a while without any new information. It's not possible to debug this issue without additional information. If this is still an issue, please leave a comment or open a new issue.

@feross feross closed this Jan 7, 2017

@ChrisMorrisOrg

This comment has been minimized.

Copy link

commented Feb 28, 2017

I've actually just run into this issue as well.
Here's the before and after running --fix: https://www.diffchecker.com/YNtRGqSg

Here is the output:

standard: Use JavaScript Standard Style (http://standardjs.com)
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:18:7: 'canvaselm' is assigned a value but never used.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:24:7: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:26:7: 'keyDown' is assigned a value but never used.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:32:7: Identifier 'keystroke_array' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:33:7: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:36:17: 'Audio' is not defined.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:37:24: Identifier 'snake_array' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:37:52: Identifier 'backtomenu_timeout' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:37:72: Identifier 'game_loop' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:41:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:43:16: Identifier 'backtomenu_timeout' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:81:12: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:87:12: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:93:5: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:94:53: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:95:7: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:109:5: Identifier 'backtomenu_timeout' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:114:16: Identifier 'backtomenu_timeout' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:121:16: Identifier 'game_loop' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:124:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:126:7: 'screenshotJSON' is not defined.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:128:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:129:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:140:23: 'screenshotJSON' is not defined.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:147:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:157:17: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:160:9: Identifier 'backtomenu_timeout' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:166:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:167:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:168:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:177:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:178:5: Identifier 'keystroke_array' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:179:5: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:186:16: Identifier 'game_loop' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:189:16: Identifier 'backtomenu_timeout' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:191:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:192:5: Identifier 'game_loop' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:197:5: Identifier 'snake_array' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:201:29: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:208:11: Identifier 'temp_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:208:52: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:208:65: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:209:11: Identifier 'temp_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:209:52: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:209:65: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:218:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:220:11: Identifier 'next_move' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:223:11: Identifier 'next_move' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:223:21: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:223:44: Expected '!==' and instead saw '!='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:225:18: Identifier 'next_move' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:225:28: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:225:49: Expected '!==' and instead saw '!='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:225:90: Identifier 'next_move' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:225:100: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:225:124: Expected '!==' and instead saw '!='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:227:18: Identifier 'next_move' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:227:28: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:227:51: Expected '!==' and instead saw '!='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:232:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:233:9: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:234:9: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:236:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:237:19: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:238:7: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:239:26: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:240:7: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:241:26: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:242:7: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:243:26: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:244:7: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:247:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:249:11: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:249:33: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:249:93: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:250:11: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:250:42: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:251:9: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:251:69: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:253:11: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:254:9: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:254:69: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:256:11: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:256:42: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:257:9: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:257:69: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:261:5: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:262:5: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:264:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:265:9: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:265:22: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:265:35: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:265:48: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:273:11: 'tail' is already defined.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:274:16: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:275:16: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:278:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:279:20: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:279:42: Identifier 'snake_head_x' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:279:62: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:279:75: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:279:97: Identifier 'snake_head_y' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:279:117: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:284:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:295:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:301:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:307:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:313:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:315:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:319:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:322:22: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:322:37: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:324:24: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:324:39: Identifier 'cell_size' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:329:22: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:329:41: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:334:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:336:5: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:339:5: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:339:13: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:339:28: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:341:7: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:342:12: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:342:20: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:342:35: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:344:7: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:345:12: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:345:20: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:345:35: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:347:7: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:348:12: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:348:20: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:348:35: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:350:7: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:351:12: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:351:20: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:354:12: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:354:20: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:357:12: Opening curly brace does not appear on the same line as controlling statement.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:357:20: Expected '===' and instead saw '=='.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:362:9: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:363:2: Mixed spaces and tabs.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:363:2: Unexpected tab character.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:365:59: Identifier 'next_direction' is not in camel case.
  /Users/chrismorris/Documents/Projects/5nake/public_html/js/5nake.js:382:7: Identifier 'game_loop' is not in camel case.
@mrchief

This comment has been minimized.

Copy link

commented Feb 28, 2017

@ChrisMorrisOrg I doubt if anyone looks at closed issues. You should open a new one.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
8 participants
You can’t perform that action at this time.