Intendation for const variables
See original GitHub issueIt’s likely that this issued has already raised in the repo, but I could not find it 😞
My proposal is to change aligning of const
variables declaration.
Current view:
const locomotive = require('locomotive'),
Controller = locomotive.Controller;
Desired:
const locomotive = require('locomotive'),
Controller = locomotive.Controller,
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How should we indent `const` declarations?
I'm a huge fan of the additions to JavaScript of let and const to declare block-scoped variables. In particular, I love const for...
Read more >How to align const indent in ESLint? - javascript - Stack Overflow
If I set the rule to: "indent": ["error", 4, {"VariableDeclarator": {"const": 1}}], The correct align will be 4 spaces: const cc = 3,...
Read more >C Style Guide
C Style Guidelines · Meaningful names for variables, constants and functions. · Good indentation (3 or 4 spaces). · If variables have the...
Read more >2022-03-14 Proper indentation after a const in Emacs
When using const to declare variables, and the declaration not fitting in one line, the indentation of the next line was broken like...
Read more >Declarations (indent: Indent and Format C Program Source)
By default indent will line up identifiers, in the column specified by the ... The value given to the -di option will still...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You are the first to have raised it.
Some thoughts:
Nowhere in prettier do we indent by an arbitrary amount of spaces to match the indentation of a keyword. So this would be an exception and may be seen as inconsistent.
If you have series of
const
andlet
, it would look very odd having the indentation be off.My suggestion is for you to add a const before each line, this way they all look nicely aligned:
I use one
const
(orlet
orvar
) per variable. Makes it easier to move the declarations around.