简体   繁体   中英

why does Eslint throws error with the Airbnb style guide's two spaces rule in atom even though I have it set to two spaces and hard tabs?

I want to use eslint and the Airbnb style guide.

But it keeps throwing an error regarding indentation.

The error says:

Expected indentation of two characters but found 0

But in atom's settings I have the tab length option set (as it is by default) to two spaces.

I also unchecked the soft tab option, and, set the tab type to hard.

Still the error continues.

What do I have to do in order that, when I use a tab, atom transform my tab into two spaces and so I can use the tab key to indent, instead of having to use the spacebar?

Change your Atom settings to soft tabs (spaces), eslint is expecting soft tabs of 2 spaces. Soft tabs are spaces, hard tabs are tab characters.

Just to be sure, you can check with atom's " toggle invisibles " command that every tab is equal to 2 spaces. ( ctrl + shift + P to enter a command)

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