Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

JSLint and automatic indentation don't agree with non-default tabSize #7240

Closed
0b10011 opened this issue Mar 18, 2014 · 9 comments
Closed

JSLint and automatic indentation don't agree with non-default tabSize #7240

0b10011 opened this issue Mar 18, 2014 · 9 comments

Comments

@0b10011
Copy link

0b10011 commented Mar 18, 2014

Steps to reproduce

  1. Create a JavaScript file with it's contents set to var a = 0, b = 0;
  2. Set tabSize to 2
  3. Place the cursor after , and press Enter
  4. Save / Run JSLint

Expected results

JSLint should have 0 problems.

Actual results

JSLint reports 1 problem:

Expected 'b' at column 5, not column 9.

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

It already has this code - what's your spaceUnits setting?

if (!options.indent) {
            // default to using the same indentation value that the editor is using
            options.indent = PreferencesManager.get("spaceUnits");
        }

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

I simulated this with using tabSize for indent options but this only changes the error from 5-9 to Expected 'b' at column 3, not column 5. because it is automatically formatted to

var a = 0, 
    b = 0;

but JSLint with indent=2 would like to see it like this:

var a = 0, 
  b = 0;

@0b10011
Copy link
Author

0b10011 commented Mar 18, 2014

spaceUnits is set to 4 for me (I changed tabSize via the input in the status bar).

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

I put up a PR - it doesn't solve the indentation issue after var but it does pass correct indent option to JSLint.

@dangoor
Copy link
Contributor

dangoor commented Mar 19, 2014

Could the placement of the var on the next line be a result of #7218?

@zaggino
Copy link
Contributor

zaggino commented Mar 20, 2014

It's quite possible. We'll see after it gets fixed.

@redmunds
Copy link
Contributor

I think this indenting is caused by CodeMirror smartIndent addon which is on by default and can be turned off with "smartIndent": false.

@zaggino
Copy link
Contributor

zaggino commented Mar 21, 2014

@bfrohs can you re-test with latest master?

@0b10011
Copy link
Author

0b10011 commented Mar 23, 2014

@zaggino Fixed, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants