Versions

no-mixed-spaces-and-tabs

Disallow mixed spaces and tabs for indentation

This rule was deprecated in ESLint v8.53.0. Please use the corresponding rule in @stylistic/eslint-plugin-js.

Most code conventions require either tabs or spaces be used for indentation. As such, it’s usually an error if a single line of code is indented with both tabs and spaces.

Rule Details

This rule disallows mixed spaces and tabs for indentation.

Examples of incorrect code for this rule:

Open in Playground
/*eslint no-mixed-spaces-and-tabs: "error"*/

function add(x, y) {
	  return x + y;
}

function main() {
	var x = 5,
	    y = 7;
}

Examples of correct code for this rule:

Open in Playground
/*eslint no-mixed-spaces-and-tabs: "error"*/

function add(x, y) {
	return x + y;
}

Options

This rule has a string option.

  • "smart-tabs" allows mixed tabs and spaces when the spaces are used for alignment.

smart-tabs

Examples of correct code for this rule with the "smart-tabs" option:

Open in Playground
/*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/

function main() {
	var x = 5,
	    y = 7;
}

Version

This rule was introduced in ESLint v0.7.1.

Further Reading

Resources

Change Language
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy