1

When using ESLint in Microsoft Visual Studio Code, ESLint is deciding that my tab is four spaces. When I click 'quick fix' and 'fix this indent problem' it fixes it fine, but why is my tab key not inserting a tab ESLint recognizes? I have read this and turned off editor.insertSpaces but that does not seem to have fixed it. Any idea how to get ESLint to register my tabs? I would prefer not to disable the rule entirely, but I will if I have to.

Edit: it would seem that this problem only occurs in my index.js file.

NeNaD
  • 18,172
  • 8
  • 47
  • 89
johng3587
  • 103
  • 9
  • Does this help? https://stackoverflow.com/questions/29972396/how-can-i-customize-the-tab-to-space-conversion-factor – admcfajn Nov 16 '21 at 02:39
  • Unfortunately that is the one I read prior, and changing the insertSpaces rule did not work, ill try the others though. – johng3587 Nov 16 '21 at 02:44
  • I think `"editor.tabSize": 2,` might be what you're looking for. There's also the option of manually copy/pasting a tab character that the linter expects – admcfajn Nov 16 '21 at 02:46
  • That did work, however now my tabs are skinny, can I do it somehow keeping the other tab size? – johng3587 Nov 16 '21 at 02:49
  • Does this answer your question? [How can I customize the tab-to-space conversion factor?](https://stackoverflow.com/questions/29972396/how-can-i-customize-the-tab-to-space-conversion-factor) – Heretic Monkey Nov 16 '21 at 03:00
  • Yes it did, thanks! – johng3587 Nov 16 '21 at 03:22

1 Answers1

1

In settings.json file, you should add this line:

"editor.tabSize": 2
NeNaD
  • 18,172
  • 8
  • 47
  • 89