简体   繁体   中英

Eslint thinks a tab is 4 spaces

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.

settings.json文件中,您应该添加以下行:

"editor.tabSize": 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM