error Mixed spaces and tabs no-mixed-spaces-and-tabs

"extends": "eslint:recommended"配置文件中的属性启用此规则。

大多数代码惯例要求使用制表符或空格来缩进。因此,如果单行代码与制表符和空格缩进,通常会出现错误。

此规则不允许使用混合空格和制表符进行缩进。

此规则的错误代码示例:

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

function add(x, y) {
// --->..return x + y;

      return x + y;
}

function main() {
// --->var x = 5,
// --->....y = 7;

    var x = 5,
        y = 7;
}

此规则的正确代码示例:

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

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

这条规则有一个字符串选项。

  • "smart-tabs" 当后者用于对齐时允许混合空间和标签。

智能标签

此规则的正确代码示例包含以下"smart-tabs"选项:

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

function main() {
// --->var x = 5,
// --->....y = 7;

    var x = 5,
        y = 7;
}

代码出现问题:

添加这句:

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


<template>
	<comp-setup>
		
	</comp-setup>
</template>

<script>
/*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
import CompSetup from './components/setupview'
export default {
  name: 'App',
  components: {
	  CompSetup,
  }
}
</script>

<style>

</style>

参考地址:https://cloud.tencent.com/developer/section/1135716

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值