eslint中校验的方法


链接规则参数检查:https://eslint.vuejs.org/rules/require-component-is.html

1、在整个文件中取消eslint检查:

在整个文件中取消eslint检查:

/* eslint-disable */

// Disables all rules for the rest of the file 
alert(‘foo’);

2、针对某一行禁用eslint检查:

    其中若出现的问题也可以这种方式处理:Expected blank line between class members (lines-between-class-members) at 

alert(‘foo’); // eslint-disable-line

// eslint-disable-next-line 
alert(‘foo’);

3、针对文件取消eslint中需要v-bind:is<component>元素的检查:

<!-- eslint-disable vue/require-component-is -->
<template>
  <component v-bind="linkProps(to)">
    <slot/>
  </component>
</template>

 4、针对文件class暴露中取消空行的检查:

/* eslint lines-between-class-members: ["error", "never"] */
class Foo{
  bar(){}
  baz(){}
}

 5、针对文件switch中没有defalut时候取消检查:

/*eslint default-case: "error"*/
switch (a) {
    case 1:
        /* code */
        break;
    default:
        /* code */
        break;
}
switch (a) {
    case 1:
        /* code */
        break;
    // no default
}
switch (a) {
    case 1:
        /* code */
        break;
    // No Default
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM