Skip to content

Commit 85ee7d9

Browse files
committed
update document
1 parent 656fdb5 commit 85ee7d9

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

Diff for: docs/rules/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ For example:
136136
| Rule ID | Description | |
137137
|:--------|:------------|:---|
138138
| [vue/script-indent](./script-indent.md) | enforce consistent indentation in `<script>` | :wrench: |
139+
| [vue/valid-slot-scope](./valid-slot-scope.md) | enforce valid `slot-scope` attributes | |
139140

140141
## Deprecated
141142

Diff for: docs/rules/valid-slot-scope.md

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# enforce valid `slot-scope` attributes (vue/valid-slot-scope)
1+
---
2+
pageClass: rule-details
3+
sidebarDepth: 0
4+
title: vue/valid-slot-scope
5+
description: enforce valid `slot-scope` attributes
6+
---
7+
# vue/valid-slot-scope
8+
> enforce valid `slot-scope` attributes
29
310
This rule checks whether every `slot-scope` (or `scope`) attributes is valid.
411

@@ -8,46 +15,44 @@ This rule reports `slot-scope` attributes in the following cases:
815

916
- The `slot-scope` attribute does not have that attribute value. E.g. `<div slot-scope></div>`
1017

11-
This rule does not check syntax errors in directives because it's checked by [no-parsing-error] rule.
12-
13-
:-1: Examples of **incorrect** code for this rule:
14-
18+
<eslint-code-block :rules="{'vue/valid-slot-scope': ['error']}">
1519
```vue
1620
<template>
21+
<!-- ✓ GOOD -->
1722
<TheComponent>
18-
<template slot-scope>
23+
<template slot-scope="prop">
1924
...
2025
</template>
2126
</TheComponent>
2227
<TheComponent>
23-
<template slot-scope="">
28+
<template slot-scope="{ a, b, c }">
2429
...
2530
</template>
2631
</TheComponent>
27-
</template>
28-
```
29-
30-
:+1: Examples of **correct** code for this rule:
31-
32-
```vue
33-
<template>
3432
<TheComponent>
35-
<template slot-scope="prop">
33+
<template slot-scope="[ a, b, c ]">
3634
...
3735
</template>
3836
</TheComponent>
37+
38+
<!-- ✗ BAD -->
3939
<TheComponent>
40-
<template slot-scope="{ a, b, c }">
40+
<template slot-scope>
4141
...
4242
</template>
4343
</TheComponent>
4444
<TheComponent>
45-
<template slot-scope="[ a, b, c ]">
45+
<template slot-scope="">
4646
...
4747
</template>
4848
</TheComponent>
4949
</template>
5050
```
51+
</eslint-code-block>
52+
53+
::: warning Note
54+
This rule does not check syntax errors in directives because it's checked by [no-parsing-error] rule.
55+
:::
5156

5257
## :wrench: Options
5358

@@ -57,8 +62,13 @@ Nothing.
5762

5863
- [no-parsing-error]
5964

60-
## Related links
65+
## :books: Further reading
6166

6267
- [Guide - Scoped Slots](https://vuejs.org/v2/guide/components-slots.html#Scoped-Slots)
6368

6469
[no-parsing-error]: no-parsing-error.md
70+
71+
## :mag: Implementation
72+
73+
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/valid-slot-scope.js)
74+
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/valid-slot-scope.js)

Diff for: lib/rules/valid-slot-scope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = {
5858
docs: {
5959
description: 'enforce valid `slot-scope` attributes',
6060
category: undefined,
61-
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v5.0.0-beta.5/docs/rules/valid-slot-scope.md'
61+
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v5.0.0/docs/rules/valid-slot-scope.md'
6262
},
6363
fixable: null,
6464
schema: [],

0 commit comments

Comments
 (0)