Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: improve warnings about key on template elements #45

Merged
merged 3 commits into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ The `--fix` option on the command line automatically fixes problems reported by
| :white_check_mark: | [no-invalid-v-show](./docs/rules/no-invalid-v-show.md) | disallow invalid v-show directives. |
| :white_check_mark: | [no-invalid-v-text](./docs/rules/no-invalid-v-text.md) | disallow invalid v-text directives. |
| :white_check_mark: | [no-parsing-error](./docs/rules/no-parsing-error.md) | disallow parsing errors in `<template>`. |
| | [no-template-key](./docs/rules/no-template-key.md) | disallow 'key' attribute on '<template>'. |

<!--RULES_TABLE_END-->

Expand Down
10 changes: 5 additions & 5 deletions docs/rules/html-end-tags.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Enforce end tag style (html-end-tags)

- 🔧 This rule is fixable with `eslint --fix` command.
- :wrench: This rule is fixable with `eslint --fix` command.

This rule enforce the way of end tags.

- [Void elements] disallow end tags.
- Other elements require end tags.

## 📖 Rule Details
## :book: Rule Details

This rule reports the following elements:

- [Void elements] which have end tags.
- Other elements which do not have end tags and are not self-closing.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -28,7 +28,7 @@ This rule reports the following elements:
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -42,7 +42,7 @@ This rule reports the following elements:
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.

Expand Down
10 changes: 5 additions & 5 deletions docs/rules/html-no-self-closing.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Disallow self-closing elements (html-no-self-closing)

- 🔧 This rule is fixable with `eslint --fix` command.
- :wrench: This rule is fixable with `eslint --fix` command.

Self-closing (e.g. `<br/>`) is syntax of XML/XHTML.
HTML ignores it.

## 📖 Rule Details
## :book: Rule Details

This rule reports every self-closing element except XML context.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -19,7 +19,7 @@ This rule reports every self-closing element except XML context.
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -33,6 +33,6 @@ This rule reports every self-closing element except XML context.
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.
12 changes: 6 additions & 6 deletions docs/rules/html-quotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ You can shoose quotes of HTML attributes from:

This rule enforces the quotes style of HTML attributes.

## 📖 Rule Details
## :book: Rule Details

This rule reports the quotes of attributes if it is different to configured quotes.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -23,7 +23,7 @@ This rule reports the quotes of attributes if it is different to configured quot
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -33,7 +33,7 @@ This rule reports the quotes of attributes if it is different to configured quot
</template>
```

👎 Examples of **incorrect** code for this rule with `"single"` option:
:-1: Examples of **incorrect** code for this rule with `"single"` option:

```html
<template>
Expand All @@ -44,7 +44,7 @@ This rule reports the quotes of attributes if it is different to configured quot
</template>
```

👍 Examples of **correct** code for this rule with `"single"` option:
:+1: Examples of **correct** code for this rule with `"single"` option:

```html
<template>
Expand All @@ -54,7 +54,7 @@ This rule reports the quotes of attributes if it is different to configured quot
</template>
```

## 🔧 Options
## :wrench: Options

- `"double"` (default) ... requires double quotes.
- `"single"` ... requires single quotes.
8 changes: 4 additions & 4 deletions docs/rules/no-confusing-v-for-v-if.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

So when they exist on the same node, `v-if` directive should use the reference which is to the variables which are defined by the `v-for` directives.

## 📖 Rule Details
## :book: Rule Details

This rule reports the elements which have both `v-for` and `v-if` directives in the following cases:

- The `v-if` directive does not use the reference which is to the variables which are defined by the `v-for` directives.

In that case, the `v-if` should be written on the wrapper element.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -26,7 +26,7 @@ In that case, the `v-if` should be written on the wrapper element.
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -48,6 +48,6 @@ In that case, the `v-if` should be written on the wrapper element.
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.
8 changes: 4 additions & 4 deletions docs/rules/no-duplicate-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
When duplicate arguments exist, only the last one is valid.
It's possibly mistakes.

## 📖 Rule Details
## :book: Rule Details

This rule reports duplicate attributes.
`v-bind:foo` directives are handled as the attributes `foo`.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
<div foo="abc" :foo="def"></div>
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -25,7 +25,7 @@ This rule reports duplicate attributes.
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.

Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-invalid-template-root.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This rule checks whether every template root is valid.

## 📖 Rule Details
## :book: Rule Details

This rule reports the template root in the following cases:

Expand All @@ -12,7 +12,7 @@ This rule reports the template root in the following cases:
- The root element has `v-for` directives. E.g. `<template><div v-for="x in list">{{x}}</div></template>`.
- The root element is `<template>` or `<slot>` elements. E.g. `<template><template>hello</template></template>`.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -38,7 +38,7 @@ This rule reports the template root in the following cases:
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -59,6 +59,6 @@ This rule reports the template root in the following cases:
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.
10 changes: 5 additions & 5 deletions docs/rules/no-invalid-v-bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This rule checks whether every `v-bind` directive is valid.

## 📖 Rule Details
## :book: Rule Details

This rule reports `v-bind` directives in the following cases:

Expand All @@ -13,7 +13,7 @@ This rule does not report `v-bind` directives which do not have their argument (

This rule does not check syntax errors in directives because it's checked by [no-parsing-error] rule.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -25,7 +25,7 @@ This rule does not check syntax errors in directives because it's checked by [no
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -38,11 +38,11 @@ This rule does not check syntax errors in directives because it's checked by [no
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.

## 👫 Related rules
## :couple: Related rules

- [no-parsing-error]

Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-invalid-v-cloak.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

This rule checks whether every `v-cloak` directive is valid.

## 📖 Rule Details
## :book: Rule Details

This rule reports `v-cloak` directives in the following cases:

- The directive has that argument. E.g. `<div v-cloak:aaa></div>`
- The directive has that modifier. E.g. `<div v-cloak.bbb></div>`
- The directive has that attribute value. E.g. `<div v-cloak="ccc"></div>`

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -22,7 +22,7 @@ This rule reports `v-cloak` directives in the following cases:
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -32,6 +32,6 @@ This rule reports `v-cloak` directives in the following cases:
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.
10 changes: 5 additions & 5 deletions docs/rules/no-invalid-v-else-if.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This rule checks whether every `v-else-if` directive is valid.

## 📖 Rule Details
## :book: Rule Details

This rule reports `v-else-if` directives in the following cases:

Expand All @@ -14,7 +14,7 @@ This rule reports `v-else-if` directives in the following cases:

This rule does not check syntax errors in directives because it's checked by [no-parsing-error] rule.

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -26,7 +26,7 @@ This rule does not check syntax errors in directives because it's checked by [no
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -37,11 +37,11 @@ This rule does not check syntax errors in directives because it's checked by [no
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.

## 👫 Related rules
## :couple: Related rules

- [no-invalid-v-if]
- [no-invalid-v-else]
Expand Down
10 changes: 5 additions & 5 deletions docs/rules/no-invalid-v-else.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This rule checks whether every `v-else` directive is valid.

## 📖 Rule Details
## :book: Rule Details

This rule reports `v-else` directives in the following cases:

Expand All @@ -12,7 +12,7 @@ This rule reports `v-else` directives in the following cases:
- The directive is on the elements that the previous element don't have `v-if`/`v-if-else` directives. E.g. `<div v-else></div>`
- The directive is on the elements which have `v-if`/`v-if-else` directives. E.g. `<div v-if="foo" v-else></div>`

👎 Examples of **incorrect** code for this rule:
:-1: Examples of **incorrect** code for this rule:

```html
<template>
Expand All @@ -24,7 +24,7 @@ This rule reports `v-else` directives in the following cases:
</template>
```

👍 Examples of **correct** code for this rule:
:+1: Examples of **correct** code for this rule:

```html
<template>
Expand All @@ -35,11 +35,11 @@ This rule reports `v-else` directives in the following cases:
</template>
```

## 🔧 Options
## :wrench: Options

Nothing.

## 👫 Related rules
## :couple: Related rules

- [no-invalid-v-if]
- [no-invalid-v-else]
Expand Down
Loading