Skip to content

Commit 83555ae

Browse files
authored
Merge branch 'master' into no-v-html-ignorePattern
2 parents 90380c6 + 15185f5 commit 83555ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2666
-558
lines changed

.changeset/beige-teams-camp.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/eight-camels-refuse.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/strong-masks-fetch.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/true-pumas-open.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@
55
"type": "node",
66
"request": "launch",
77
"name": "Start testing",
8-
"program": "${workspaceFolder}/node_modules/.bin/mocha",
9-
"args": ["${file}", "--watch"],
8+
"program": "${workspaceFolder}/node_modules/.bin/vitest",
9+
"args": ["run", "${file}", "--reporter=verbose"],
10+
"console": "integratedTerminal"
11+
},
12+
{
13+
"type": "node",
14+
"request": "launch",
15+
"name": "Start testing (watch)",
16+
"program": "${workspaceFolder}/node_modules/.bin/vitest",
17+
"args": ["${file}", "--reporter=verbose"],
1018
"console": "integratedTerminal"
1119
}
1220
]
13-
}
21+
}

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# eslint-plugin-vue
22

3+
## 10.4.0
4+
5+
### Minor Changes
6+
7+
- Added `ignoreParents` option to [`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) ([#2784](https://github.com/vuejs/eslint-plugin-vue/pull/2784))
8+
9+
- Added new [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html) rule ([#2794](https://github.com/vuejs/eslint-plugin-vue/pull/2794))
10+
11+
- Added new [`vue/no-negated-condition`](https://eslint.vuejs.org/rules/no-negated-condition.html) rule ([#2795](https://github.com/vuejs/eslint-plugin-vue/pull/2795))
12+
13+
### Patch Changes
14+
15+
- Resolved TypeScript compatibility issues introduced by eslint-typegen ([#2790](https://github.com/vuejs/eslint-plugin-vue/pull/2790))
16+
17+
- Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages ([#2805](https://github.com/vuejs/eslint-plugin-vue/pull/2805))
18+
319
## 10.3.0
420

521
### Minor Changes

docs/rules/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ For example:
237237
| [vue/no-empty-component-block] | disallow the `<template>` `<script>` `<style>` block to be empty | :wrench: | :hammer: |
238238
| [vue/no-import-compiler-macros] | disallow importing Vue compiler macros | :wrench: | :warning: |
239239
| [vue/no-multiple-objects-in-class] | disallow passing multiple objects in an array to class | | :hammer: |
240+
| [vue/no-negated-v-if-condition] | disallow negated conditions in v-if/v-else | :bulb: | :hammer: |
240241
| [vue/no-potential-component-option-typo] | disallow a potential typo in your component property | :bulb: | :hammer: |
241242
| [vue/no-ref-object-reactivity-loss] | disallow usages of ref objects that can lead to loss of reactivity | | :warning: |
242243
| [vue/no-restricted-block] | disallow specific block | | :hammer: |
@@ -484,6 +485,7 @@ The following rules extend the rules provided by ESLint itself and apply them to
484485
[vue/no-multiple-template-root]: ./no-multiple-template-root.md
485486
[vue/no-mutating-props]: ./no-mutating-props.md
486487
[vue/no-negated-condition]: ./no-negated-condition.md
488+
[vue/no-negated-v-if-condition]: ./no-negated-v-if-condition.md
487489
[vue/no-parsing-error]: ./no-parsing-error.md
488490
[vue/no-potential-component-option-typo]: ./no-potential-component-option-typo.md
489491
[vue/no-ref-as-operand]: ./no-ref-as-operand.md

docs/rules/no-negated-condition.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/no-negated-condition
55
description: Disallow negated conditions in `<template>`
6+
since: v10.4.0
67
---
78

89
# vue/no-negated-condition
910

1011
> Disallow negated conditions in `<template>`
1112
12-
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> _**This rule has not been released yet.**_ </badge>
13-
1413
## :book: Rule Details
1514

1615
This rule is the same rule as core [no-negated-condition] rule but it applies to the expressions in `<template>`.
1716

1817
## :couple: Related Rules
1918

19+
- [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html)
2020
- [unicorn/no-negated-condition](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md)
2121

2222
## :books: Further Reading
@@ -25,6 +25,10 @@ This rule is the same rule as core [no-negated-condition] rule but it applies to
2525

2626
[no-negated-condition]: https://eslint.org/docs/rules/no-negated-condition
2727

28+
## :rocket: Version
29+
30+
This rule was introduced in eslint-plugin-vue v10.4.0
31+
2832
## :mag: Implementation
2933

3034
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-negated-condition.js)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
pageClass: rule-details
3+
sidebarDepth: 0
4+
title: vue/no-negated-v-if-condition
5+
description: disallow negated conditions in v-if/v-else
6+
since: v10.4.0
7+
---
8+
9+
# vue/no-negated-v-if-condition
10+
11+
> disallow negated conditions in v-if/v-else
12+
13+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
14+
15+
## :book: Rule Details
16+
17+
This rule disallows negated conditions in `v-if` and `v-else-if` directives which have an `v-else` branch.
18+
19+
Negated conditions make the code less readable. When there's an `else` clause, it's better to use a positive condition and switch the branches.
20+
21+
<eslint-code-block :rules="{'vue/no-negated-v-if-condition': ['error']}">
22+
23+
```vue
24+
<template>
25+
<!-- ✓ GOOD -->
26+
<div v-if="foo">First</div>
27+
<div v-else>Second</div>
28+
29+
<div v-if="!foo">First</div>
30+
<div v-else-if="bar">Second</div>
31+
32+
<div v-if="!foo">Content</div>
33+
34+
<div v-if="a !== b">Not equal</div>
35+
36+
<!-- ✗ BAD -->
37+
<div v-if="!foo">First</div>
38+
<div v-else>Second</div>
39+
40+
<div v-if="a !== b">First</div>
41+
<div v-else>Second</div>
42+
43+
<div v-if="foo">First</div>
44+
<div v-else-if="!bar">Second</div>
45+
<div v-else>Third</div>
46+
</template>
47+
```
48+
49+
</eslint-code-block>
50+
51+
## :wrench: Options
52+
53+
Nothing.
54+
55+
## :couple: Related Rules
56+
57+
- [no-negated-condition](https://eslint.org/docs/latest/rules/no-negated-condition)
58+
- [vue/no-negated-condition](https://eslint.vuejs.org/rules/no-negated-condition.html)
59+
- [unicorn/no-negated-condition](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md)
60+
61+
## :rocket: Version
62+
63+
This rule was introduced in eslint-plugin-vue v10.4.0
64+
65+
## :mag: Implementation
66+
67+
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-negated-v-if-condition.js)
68+
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-negated-v-if-condition.js)

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default typegen([
7777
globals: {
7878
...globals.es6,
7979
...globals.node,
80-
...globals.mocha
80+
...globals.vitest
8181
}
8282
},
8383
linterOptions: {

0 commit comments

Comments
 (0)