Skip to content

Commit cf21e90

Browse files
committed
Docs: update docs
1 parent ff5bfdc commit cf21e90

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ Vue.component('AsyncComponent', (resolve, reject) => {
7171
})
7272
```
7373

74+
### `eslint-disable` functionality in `<template>`
75+
76+
You can use `<!-- eslint-disable -->`-like HTML comments in `<template>` of `.vue` files. For example:
77+
78+
```html
79+
<template>
80+
<!-- eslint-disable-next-line vue/max-attributes-per-line -->
81+
<div a="1" b="2" c="3" d="4">
82+
</div>
83+
</template>
84+
```
85+
86+
If you want to disallow `eslint-disable` functionality, please disable [vue/comment-directive](./docs/rules/comment-directive.md) rule.
87+
7488
## :gear: Configs
7589

7690
This plugin provides two predefined configs:

docs/rules/comment-directive.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# support comment-directives in `<template>` (comment-directive)
22

3-
This rule supports the following comment directives in `<template>`:
3+
Sole purpose of this rule is to provide `eslint-disable` functionality in `<template>`.
4+
It supports usage of the following comments:
45

56
- `eslint-disable`
67
- `eslint-enable`
@@ -17,8 +18,16 @@ For example:
1718
</template>
1819
```
1920

21+
> Note: we can't write HTML comments in tags.
22+
2023
This rule doesn't make any warning.
2124

22-
## Further reading
25+
## :book: Rule Details
26+
27+
ESLint doesn't provide any API to enhance `eslint-disable` functionality and ESLint rules cannot affect other rules. But ESLint provides [processors API](https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins).
28+
29+
This rule sends all `eslint-disable`-like comments as warnings to the post-process of the `.vue` file processor, then the post-process removes all `vue/comment-directive` warnings and warnings in disabled-area.
30+
31+
## :books: Further reading
2332

2433
- [Disabling rules with inline comments](https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments)

0 commit comments

Comments
 (0)