Skip to content

"I just think it's weird that you use spaces instead of tabs." β€” Richard Hendricks

Require word separators to be tabs, not spaces (prefer-tab) ​

πŸ’Ό This rule is enabled in the 🌐 all config.

πŸ”§ This rule is automatically fixable by the --fix CLI option.

πŸ“– Rule details ​

Tabs are better than spaces. However and unfortunately, most developers still use spaces to separate words.

πŸ’‘ Examples ​

js
// ❌ Incorrect
if (a) {
  b = c
  function foo(d) {
    e = f
  }
}

// βœ… Correct
if	(a)	{
		b	=	c
		function	foo(d)	{
				e	=	f
		}
}

πŸ”§ Config ​

js
{ rules: { 'ninja/prefer-tab': 2 } }

πŸ§‘β€πŸ’» Demo ​

Released under the MIT License