How to get JSHint smarttabs option working in Sublime Text 2

杀马特。学长 韩版系。学妹 提交于 2019-12-12 02:34:35

问题


I can't seem to get the Sublime Text 2 SublimeLinter package to stop showing the "Mixed tabs and spaces" warning.

I've set "smarttabs" : true in the settings, but it's still not taking.

Has anyone else solved this problem yet?

Here's my user settings for the SublimeLinter package: https://gist.github.com/3737558

Thanks.


回答1:


I solve the problem like this.

First do not use mix tabs and spaces in the files. Use spaces only. Sublime can finely handle the indentation without a hard tab character.

Setup Sublime Text 2 to use spaces only:

// Tab and whitespace handling.
// Indent using spaces, 4 spaces ber indent by default, clean up extra whitespaces on save
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,

// Do not try to detect the tab size from the opened file
"detect_indentation" : false,

If you encounter any old files with mixed tabs and spaces you can convert them to spaces only from View > Indentation > Convert tabs to spaces menu.

Why tab character is bad in your source code

  • http://opensourcehacker.com/2012/05/13/never-use-hard-tabs/



回答2:


i have the same problem, maybe i found the reason

the smarttabsoptions can control the warning when space after tab, but can't control the warning tabs after the space, you can try it

if you want to disable the warning you can add a comment at top top of the file

/*jshint -W099*/



来源:https://stackoverflow.com/questions/12461291/how-to-get-jshint-smarttabs-option-working-in-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!