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

Indentation for 'const' using 4 spaces #9566

Closed
snooopcatt opened this issue Nov 2, 2017 · 2 comments
Closed

Indentation for 'const' using 4 spaces #9566

snooopcatt opened this issue Nov 2, 2017 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@snooopcatt
Copy link

Tell us about your environment

  • ESLint Version: 4.9.0
  • Node Version: 8.4.0
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using? default, I assume

Please show your full configuration:

I want to achieve this result with 4 spaces indentation, which currently results in erorr

function a() {
    const id    = 1,
          value = 2;
}

Basically, 6 spaces for multiline const declaration.
In my case it would be handy to use either 1.5 level of indentation, or maybe some way to override indentation settings, smth like:

// Option A
"indent": ["error", 4, {
    "VariableDeclarator": {
        "const": 1.5
    }
}]

// Option B
"indent": ["error", 4, {
    "VariableDeclarator": {
        "const": {
            "level": 2, // indentation level
            "indent": 3 // amount of spaces
        }
    }
}]

// Option C
"indent": ["error", 4, {
    "VariableDeclarator": {
        "const": "6s" // shorthand for '6 spaces'
    }
}]

I assume that one of the options would be to use rule such as:

"indent": ["error", 2, {
    "VariableDeclarator": {
        "const": 3,
        "let": 2,
        "var": 2
    },
    // every property listed in rule documentation, specifying 2 levels of indentation:
    "ArrayExpression": 2,
    ...
}]
but it appears hacky.

I would like even more flexible config, in other words.
Thanks.
@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Nov 2, 2017
@snooopcatt
Copy link
Author

Tried with 2 spaces indent, it doesn't work as expected. So no suitable solution so far

@not-an-aardvark
Copy link
Member

Closing as a duplicate of #8976

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 2, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants