¥Sole purpose of this rule is to provide eslint-disable functionality in the <template> and in the block level. It supports usage of the following comments:
¥ESLint doesn't provide any API to enhance eslint-disable functionality and ESLint rules cannot affect other rules. But ESLint provides processors API.
¥This rule sends all eslint-disable-like comments as errors to the post-process of the .vue file processor, then the post-process removes all vue/comment-directive errors and the reported errors in disabled areas.
Now loading...
类似 eslint-disable 的注释可以在 <template> 和块级别中使用。
¥The eslint-disable-like comments can be used in the <template> and in the block level.
Now loading...
eslint-disable 注释在一个块之后无效。
¥The eslint-disable comments has no effect after one block.
¥The eslint-disable-like comments can include descriptions to explain why the comment is necessary. The description must occur after the directive and is separated from the directive by two or more consecutive - characters. For example:
vue/comment-directive
"plugin:vue/base"、*.configs["flat/base"]、"plugin:vue/vue2-essential"、*.configs["flat/vue2-essential"]、"plugin:vue/essential"、*.configs["flat/essential"]、"plugin:vue/vue2-strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/vue2-recommended"、*.configs["flat/vue2-recommended"]、"plugin:vue/recommended"和*.configs["flat/recommended"]中。此规则的唯一目的是在
<template>和块级别提供eslint-disable功能。它支持使用以下注释:¥Sole purpose of this rule is to provide
eslint-disablefunctionality in the<template>and in the block level. It supports usage of the following comments:eslint-disableeslint-enableeslint-disable-lineeslint-disable-next-line注意
我们不能在标签中写 HTML 注释。
¥We can't write HTML comments in tags.
📖 规则详情
ESLint 不提供任何 API 来增强
eslint-disable功能,并且 ESLint 规则不能影响其他规则。但 ESLint 提供 处理器 API。¥ESLint doesn't provide any API to enhance
eslint-disablefunctionality and ESLint rules cannot affect other rules. But ESLint provides processors API.此规则将所有
eslint-disable类注释作为错误发送到.vue文件处理器的后处理,然后后处理删除所有vue/comment-directive错误和禁用区域中报告的错误。¥This rule sends all
eslint-disable-like comments as errors to the post-process of the.vuefile processor, then the post-process removes allvue/comment-directiveerrors and the reported errors in disabled areas.类似
eslint-disable的注释可以在<template>和块级别中使用。¥The
eslint-disable-like comments can be used in the<template>and in the block level.eslint-disable注释在一个块之后无效。¥The
eslint-disablecomments has no effect after one block.类似
eslint-disable的注释可以包含描述以解释注释的必要性。描述必须出现在指令之后,并且与指令之间由两个或更多连续的-字符分隔。例如:¥The
eslint-disable-like comments can include descriptions to explain why the comment is necessary. The description must occur after the directive and is separated from the directive by two or more consecutive-characters. For example:🔧选项
¥🔧 Options
reportUnusedDisableDirectives...如果是true,则报告未使用的eslint-disableHTML 注释。默认false¥
reportUnusedDisableDirectives... Iftrue, to report unusedeslint-disableHTML comments. defaultfalse{ "reportUnusedDisableDirectives": true }注意
无法使用
eslint-disableHTML 注释抑制未使用的报告。¥Unused reports cannot be suppressed with
eslint-disableHTML comments.📚扩展阅读
¥📚 Further Reading
使用内联注释禁用规则
¥Disabling rules with inline comments
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v4.1.0 中引入
¥This rule was introduced in eslint-plugin-vue v4.1.0
🔍代码实现
¥🔍 Implementation
规则源
¥Rule source
测试源
¥Test source