Skip to content

Commit 3edce05

Browse files
committed
Merge branch 'master' into feat/add-no-use-computed-property-like-method
2 parents 96fecb1 + 7e5f2e9 commit 3edce05

File tree

317 files changed

+14371
-1286
lines changed

Some content is hidden

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

317 files changed

+14371
-1286
lines changed

.env-cmdrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"version": {
3+
"IN_VERSION_SCRIPT": "true"
4+
}
5+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Since single file components in Vue are not plain JavaScript, the default parser
4040

4141
To know more about certain nodes in produced ASTs, go here:
4242
- [ESTree docs](https://github.com/estree/estree)
43-
- [vue-eslint-parser AST docs](https://github.com/mysticatea/vue-eslint-parser/blob/master/docs/ast.md)
43+
- [vue-eslint-parser AST docs](https://github.com/vuejs/vue-eslint-parser/blob/master/docs/ast.md)
4444

4545
The `vue-eslint-parser` provides a few useful parser services that help traverse the produced AST and access tokens of the template:
4646
- `context.parserServices.defineTemplateBodyVisitor(visitor, scriptVisitor)`

docs/.vuepress/components/eslint-code-block.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ export default {
124124
// Load linter.
125125
const [
126126
{ default: Linter },
127-
{ default: noUndefRule },
127+
{ default: coreRules },
128128
{ parseForESLint }
129129
] = await Promise.all([
130130
import('eslint4b/dist/linter'),
131-
import('eslint/lib/rules/no-undef'),
131+
import('eslint4b/dist/core-rules'),
132132
import('espree').then(() => import('vue-eslint-parser'))
133133
])
134134
@@ -137,7 +137,7 @@ export default {
137137
for (const ruleId of Object.keys(rules)) {
138138
linter.defineRule(`vue/${ruleId}`, rules[ruleId])
139139
}
140-
linter.defineRule('no-undef', noUndefRule)
140+
linter.defineRule('no-undef', coreRules['no-undef'])
141141
142142
linter.defineParser('vue-eslint-parser', { parseForESLint })
143143
}

docs/.vuepress/config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'use strict'
66

77
const rules = require('../../tools/lib/rules')
8+
const path = require('path')
89

910
const uncategorizedRules = rules.filter(
1011
(rule) =>
@@ -122,7 +123,8 @@ module.exports = {
122123
return {
123124
resolve: {
124125
alias: {
125-
module: require.resolve('./shim/module')
126+
module: require.resolve('./shim/module'),
127+
eslint: path.resolve(__dirname, './shim/eslint')
126128
}
127129
}
128130
}

docs/.vuepress/shim/eslint/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const Linter = require('eslint4b')
2+
module.exports = { Linter }

docs/.vuepress/shim/eslint/lib/rules/index.js

Whitespace-only changes.

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebarDepth: 0
66

77
Official ESLint plugin for Vue.js.
88

9-
This plugin allows us to check the `<template>` and `<script>` of `.vue` files with ESLint.
9+
This plugin allows us to check the `<template>` and `<script>` of `.vue` files with ESLint, as well as Vue code in `.js` files.
1010

1111
- Finds syntax errors.
1212
- Finds the wrong use of [Vue.js Directives](https://v3.vuejs.org/api/directives.html).

docs/developer-guide/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Since single file components in Vue are not plain JavaScript, we can't use the d
3939

4040
To know more about certain nodes in produced ASTs, go here:
4141
- [ESTree docs](https://github.com/estree/estree)
42-
- [vue-eslint-parser AST docs](https://github.com/mysticatea/vue-eslint-parser/blob/master/docs/ast.md)
42+
- [vue-eslint-parser AST docs](https://github.com/vuejs/vue-eslint-parser/blob/master/docs/ast.md)
4343

4444
The `vue-eslint-parser` provides few useful parser services, to help traverse the produced AST and access tokens of the template:
4545
- `context.parserServices.defineTemplateBodyVisitor(visitor, scriptVisitor)`

docs/rules/README.md

Lines changed: 267 additions & 255 deletions
Large diffs are not rendered by default.

docs/rules/array-bracket-newline.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
pageClass: rule-details
3+
sidebarDepth: 0
4+
title: vue/array-bracket-newline
5+
description: enforce linebreaks after opening and before closing array brackets
6+
since: v7.1.0
7+
---
8+
# vue/array-bracket-newline
9+
10+
> enforce linebreaks after opening and before closing array brackets
11+
12+
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
13+
14+
This rule is the same rule as core [array-bracket-newline] rule but it applies to the expressions in `<template>`.
15+
16+
## :books: Further Reading
17+
18+
- [array-bracket-newline]
19+
20+
[array-bracket-newline]: https://eslint.org/docs/rules/array-bracket-newline
21+
22+
## :rocket: Version
23+
24+
This rule was introduced in eslint-plugin-vue v7.1.0
25+
26+
## :mag: Implementation
27+
28+
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/array-bracket-newline.js)
29+
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/array-bracket-newline.js)
30+
31+
<sup>Taken with ❤️ [from ESLint core](https://eslint.org/docs/rules/array-bracket-newline)</sup>

docs/rules/array-bracket-spacing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/array-bracket-spacing
55
description: enforce consistent spacing inside array brackets
6+
since: v5.2.0
67
---
78
# vue/array-bracket-spacing
9+
810
> enforce consistent spacing inside array brackets
911
1012
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
@@ -17,6 +19,10 @@ This rule is the same rule as core [array-bracket-spacing] rule but it applies t
1719

1820
[array-bracket-spacing]: https://eslint.org/docs/rules/array-bracket-spacing
1921

22+
## :rocket: Version
23+
24+
This rule was introduced in eslint-plugin-vue v5.2.0
25+
2026
## :mag: Implementation
2127

2228
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/array-bracket-spacing.js)

docs/rules/arrow-spacing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/arrow-spacing
55
description: enforce consistent spacing before and after the arrow in arrow functions
6+
since: v5.2.0
67
---
78
# vue/arrow-spacing
9+
810
> enforce consistent spacing before and after the arrow in arrow functions
911
1012
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
@@ -17,6 +19,10 @@ This rule is the same rule as core [arrow-spacing] rule but it applies to the ex
1719

1820
[arrow-spacing]: https://eslint.org/docs/rules/arrow-spacing
1921

22+
## :rocket: Version
23+
24+
This rule was introduced in eslint-plugin-vue v5.2.0
25+
2026
## :mag: Implementation
2127

2228
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/arrow-spacing.js)

docs/rules/attribute-hyphenation.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/attribute-hyphenation
55
description: enforce attribute naming style on custom components in template
6+
since: v3.9.0
67
---
78
# vue/attribute-hyphenation
9+
810
> enforce attribute naming style on custom components in template
911
1012
- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
@@ -45,6 +47,7 @@ Default casing is set to `always` with `['data-', 'aria-', 'slot-scope']` set to
4547
- `"ignore"` ... Array of ignored names
4648

4749
### `"always"`
50+
4851
It errors on upper case letters.
4952

5053
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
@@ -62,6 +65,7 @@ It errors on upper case letters.
6265
</eslint-code-block>
6366

6467
### `"never"`
68+
6569
It errors on hyphens except `data-`, `aria-` and `slot-scope`.
6670

6771
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never']}">
@@ -82,6 +86,7 @@ It errors on hyphens except `data-`, `aria-` and `slot-scope`.
8286
</eslint-code-block>
8387

8488
### `"never", { "ignore": ["custom-prop"] }`
89+
8590
Don't use hyphenated name but allow custom attributes
8691

8792
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never', { ignore: ['custom-prop']}]}">
@@ -102,6 +107,15 @@ Don't use hyphenated name but allow custom attributes
102107

103108
</eslint-code-block>
104109

110+
## :couple: Related Rules
111+
112+
- [vue/v-on-event-hyphenation](./v-on-event-hyphenation.md)
113+
- [vue/prop-name-casing](./prop-name-casing.md)
114+
115+
## :rocket: Version
116+
117+
This rule was introduced in eslint-plugin-vue v3.9.0
118+
105119
## :mag: Implementation
106120

107121
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/attribute-hyphenation.js)

docs/rules/attributes-order.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/attributes-order
55
description: enforce order of attributes
6+
since: v4.3.0
67
---
78
# vue/attributes-order
9+
810
> enforce order of attributes
911
1012
- :gear: This rule is included in `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
@@ -25,7 +27,9 @@ This rule aims to enforce ordering of component attributes. The default order is
2527
- `GLOBAL`
2628
e.g. 'id'
2729
- `UNIQUE`
28-
e.g. 'ref', 'key', 'v-slot', 'slot'
30+
e.g. 'ref', 'key'
31+
- `SLOT`
32+
e.g. 'v-slot', 'slot'.
2933
- `TWO_WAY_BINDING`
3034
e.g. 'v-model'
3135
- `OTHER_DIRECTIVES`
@@ -89,7 +93,33 @@ This rule aims to enforce ordering of component attributes. The default order is
8993

9094
</eslint-code-block>
9195

96+
Note that `v-bind="object"` syntax is considered to be the same as the next or previous attribute categories.
97+
98+
<eslint-code-block fix :rules="{'vue/attributes-order': ['error']}">
99+
100+
```vue
101+
<template>
102+
<!-- ✓ GOOD (`v-bind="object"` is considered GLOBAL category) -->
103+
<MyComponent
104+
v-bind="object"
105+
id="x"
106+
v-model="x"
107+
v-bind:foo="x">
108+
</MyComponent>
109+
110+
<!-- ✗ BAD (`v-bind="object"` is considered UNIQUE category) -->
111+
<MyComponent
112+
key="x"
113+
v-model="x"
114+
v-bind="object">
115+
</MyComponent>
116+
</template>
117+
```
118+
119+
</eslint-code-block>
120+
92121
## :wrench: Options
122+
93123
```json
94124
{
95125
"vue/attributes-order": ["error", {
@@ -99,7 +129,7 @@ This rule aims to enforce ordering of component attributes. The default order is
99129
"CONDITIONALS",
100130
"RENDER_MODIFIERS",
101131
"GLOBAL",
102-
"UNIQUE",
132+
["UNIQUE", "SLOT"],
103133
"TWO_WAY_BINDING",
104134
"OTHER_DIRECTIVES",
105135
"OTHER_ATTR",
@@ -111,7 +141,7 @@ This rule aims to enforce ordering of component attributes. The default order is
111141
}
112142
```
113143

114-
### `"alphabetical": true`
144+
### `"alphabetical": true`
115145

116146
<eslint-code-block fix :rules="{'vue/attributes-order': ['error', {alphabetical: true}]}">
117147

@@ -220,6 +250,10 @@ This rule aims to enforce ordering of component attributes. The default order is
220250
- [Style guide - Element attribute order](https://v3.vuejs.org/style-guide/#element-attribute-order-recommended)
221251
- [Style guide (for v2) - Element attribute order](https://vuejs.org/v2/style-guide/#Element-attribute-order-recommended)
222252

253+
## :rocket: Version
254+
255+
This rule was introduced in eslint-plugin-vue v4.3.0
256+
223257
## :mag: Implementation
224258

225259
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/attributes-order.js)

docs/rules/block-spacing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/block-spacing
55
description: disallow or enforce spaces inside of blocks after opening block and before closing block
6+
since: v5.2.0
67
---
78
# vue/block-spacing
9+
810
> disallow or enforce spaces inside of blocks after opening block and before closing block
911
1012
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
@@ -17,6 +19,10 @@ This rule is the same rule as core [block-spacing] rule but it applies to the ex
1719

1820
[block-spacing]: https://eslint.org/docs/rules/block-spacing
1921

22+
## :rocket: Version
23+
24+
This rule was introduced in eslint-plugin-vue v5.2.0
25+
2026
## :mag: Implementation
2127

2228
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/block-spacing.js)

0 commit comments

Comments
 (0)