Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 371913a

Browse files
G-RathFloEdelmannCopilot
authored
feat: introduce -error versions of configs that have all rules configured to error (#2796)
Co-authored-by: Flo Edelmann <git@flo-edelmann.de> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 684a3d2 commit 371913a

13 files changed

+316
-21
lines changed

‎.changeset/brown-eels-care.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-vue": minor
3+
---
4+
5+
Added [new `-error` config variants](https://eslint.vuejs.org/user-guide/#bundle-configurations-eslint-config-js), with all rules' severity set to `error`: `strongly-recommended-error`, `recommended-error`, `vue2-strongly-recommended-error`, `vue2-recommended-error` (along with their flat config equivalents)

‎docs/user-guide/index.md‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,21 @@ You can use the following configs by adding them to `eslint.config.js`.
6464
- `*.configs["flat/base"]` ... Settings and rules to enable correct ESLint parsing.
6565
- Configurations for using Vue.js 3.x:
6666
- `*.configs["flat/essential"]` ... `base`, plus rules to prevent errors or unintended behavior.
67-
- `*.configs["flat/strongly-recommended"]` ... Above, plus rules to considerably improve code readability and/or dev experience.
68-
- `*.configs["flat/recommended"]` ... Above, plus rules to enforce subjective community defaults to ensure consistency.
67+
- `*.configs["flat/strongly-recommended"]` ... `essential`, plus rules to considerably improve code readability and/or dev experience.
68+
- `*.configs["flat/strongly-recommended-error"]` ... Same as `strongly-recommended`, except with all rules configured to error instead of warn.
69+
- `*.configs["flat/recommended"]` ... `strongly-recommended`, plus rules to enforce subjective community defaults to ensure consistency.
70+
- `*.configs["flat/recommended-error"]` ... Same as `recommended`, except with all rules configured to error instead of warn.
6971
- Configurations for using Vue.js 2.x:
7072
- `*.configs["flat/vue2-essential"]` ... `base`, plus rules to prevent errors or unintended behavior.
71-
- `*.configs["flat/vue2-strongly-recommended"]` ... Above, plus rules to considerably improve code readability and/or dev experience.
72-
- `*.configs["flat/vue2-recommended"]` ... Above, plus rules to enforce subjective community defaults to ensure consistency
73+
- `*.configs["flat/vue2-strongly-recommended"]` ... `vue2-essential`, plus rules to considerably improve code readability and/or dev experience.
74+
- `*.configs["flat/vue2-strongly-recommended-error"]` ... Same as `vue2-strongly-recommended`, except with all rules configured to error instead of warn.
75+
- `*.configs["flat/vue2-recommended"]` ... `vue2-strongly-recommended`, plus rules to enforce subjective community defaults to ensure consistency.
76+
- `*.configs["flat/vue2-recommended-error"]` ... Same as `vue2-recommended`, except with all rules configured to error instead of warn.
7377

7478
:::warning Reporting rules
7579
By default, all rules from **base** and **essential** categories report ESLint errors. Other rules - because they're not covering potential bugs in the application - report warnings. What does it mean? By default - nothing, but if you want - you can set up a threshold and break the build after a certain amount of warnings, instead of any. More information [here](https://eslint.org/docs/user-guide/command-line-interface#handling-warnings).
80+
81+
Alternatively, there are versions of the configs with all rules set to error suffixed with `-error` that you can use.
7682
:::
7783

7884
#### Specifying Globals (`eslint.config.js`)
@@ -186,15 +192,21 @@ You can use the following configs by adding them to `extends`.
186192
- `"plugin:vue/base"` ... Settings and rules to enable correct ESLint parsing.
187193
- Configurations for using Vue.js 3.x:
188194
- `"plugin:vue/essential"` ... `base`, plus rules to prevent errors or unintended behavior.
189-
- `"plugin:vue/strongly-recommended"` ... Above, plus rules to considerably improve code readability and/or dev experience.
190-
- `"plugin:vue/recommended"` ... Above, plus rules to enforce subjective community defaults to ensure consistency.
195+
- `"plugin:vue/strongly-recommended"` ... `essential`, plus rules to considerably improve code readability and/or dev experience.
196+
- `"plugin:vue/strongly-recommended-error"` ... Same as `strongly-recommended`, except with all rules configured to error instead of warn.
197+
- `"plugin:vue/recommended"` ... `strongly-recommended`, plus rules to enforce subjective community defaults to ensure consistency.
198+
- `"plugin:vue/recommended-error"` ... Same as `recommended`, except with all rules configured to error instead of warn.
191199
- Configurations for using Vue.js 2.x:
192200
- `"plugin:vue/vue2-essential"` ... `base`, plus rules to prevent errors or unintended behavior.
193-
- `"plugin:vue/vue2-strongly-recommended"` ... Above, plus rules to considerably improve code readability and/or dev experience.
194-
- `"plugin:vue/vue2-recommended"` ... Above, plus rules to enforce subjective community defaults to ensure consistency.
201+
- `"plugin:vue/vue2-strongly-recommended"` ... `vue2-essential`, plus rules to considerably improve code readability and/or dev experience.
202+
- `"plugin:vue/vue2-strongly-recommended-error"` ... Same as `vue2-strongly-recommended`, except with all rules configured to error instead of warn.
203+
- `"plugin:vue/vue2-recommended"` ... `vue2-strongly-recommended`, plus rules to enforce subjective community defaults to ensure consistency.
204+
- `"plugin:vue/vue2-recommended-error"` ... Same as `vue2-recommended`, except with all rules configured to error instead of warn.
195205

196206
:::warning Reporting rules
197207
By default, all rules from **base** and **essential** categories report ESLint errors. Other rules - because they're not covering potential bugs in the application - report warnings. What does it mean? By default - nothing, but if you want - you can set up a threshold and break the build after a certain amount of warnings, instead of any. More information [here](https://eslint.org/docs/user-guide/command-line-interface#handling-warnings).
208+
209+
Alternatively, there are versions of the configs with all rules set to error suffixed with `-error` that you can use.
198210
:::
199211

200212
:::warning Status of Vue.js 3.x supports
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
'use strict'
7+
const config = require('./vue2-strongly-recommended-error.js')
8+
9+
module.exports = [
10+
...config,
11+
{
12+
name: 'vue/vue2-recommended-error/rules',
13+
rules: {
14+
'vue/attributes-order': 'error',
15+
'vue/block-order': 'error',
16+
'vue/no-lone-template': 'error',
17+
'vue/no-multiple-slot-args': 'error',
18+
'vue/no-required-prop-with-default': 'error',
19+
'vue/no-v-html': 'error',
20+
'vue/order-in-components': 'error',
21+
'vue/this-in-template': 'error'
22+
}
23+
}
24+
]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
'use strict'
7+
const config = require('./vue2-essential.js')
8+
9+
module.exports = [
10+
...config,
11+
{
12+
name: 'vue/vue2-strongly-recommended-error/rules',
13+
rules: {
14+
'vue/attribute-hyphenation': 'error',
15+
'vue/component-definition-name-casing': 'error',
16+
'vue/first-attribute-linebreak': 'error',
17+
'vue/html-closing-bracket-newline': 'error',
18+
'vue/html-closing-bracket-spacing': 'error',
19+
'vue/html-end-tags': 'error',
20+
'vue/html-indent': 'error',
21+
'vue/html-quotes': 'error',
22+
'vue/html-self-closing': 'error',
23+
'vue/max-attributes-per-line': 'error',
24+
'vue/multiline-html-element-content-newline': 'error',
25+
'vue/mustache-interpolation-spacing': 'error',
26+
'vue/no-multi-spaces': 'error',
27+
'vue/no-spaces-around-equal-signs-in-attribute': 'error',
28+
'vue/no-template-shadow': 'error',
29+
'vue/one-component-per-file': 'error',
30+
'vue/prop-name-casing': 'error',
31+
'vue/require-default-prop': 'error',
32+
'vue/require-prop-types': 'error',
33+
'vue/singleline-html-element-content-newline': 'error',
34+
'vue/v-bind-style': 'error',
35+
'vue/v-on-style': 'error',
36+
'vue/v-slot-style': 'error'
37+
}
38+
}
39+
]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
'use strict'
7+
const config = require('./vue3-strongly-recommended-error.js')
8+
9+
module.exports = [
10+
...config,
11+
{
12+
name: 'vue/recommended-error/rules',
13+
rules: {
14+
'vue/attributes-order': 'error',
15+
'vue/block-order': 'error',
16+
'vue/no-lone-template': 'error',
17+
'vue/no-multiple-slot-args': 'error',
18+
'vue/no-required-prop-with-default': 'error',
19+
'vue/no-v-html': 'error',
20+
'vue/order-in-components': 'error',
21+
'vue/this-in-template': 'error'
22+
}
23+
}
24+
]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
'use strict'
7+
const config = require('./vue3-essential.js')
8+
9+
module.exports = [
10+
...config,
11+
{
12+
name: 'vue/strongly-recommended-error/rules',
13+
rules: {
14+
'vue/attribute-hyphenation': 'error',
15+
'vue/component-definition-name-casing': 'error',
16+
'vue/first-attribute-linebreak': 'error',
17+
'vue/html-closing-bracket-newline': 'error',
18+
'vue/html-closing-bracket-spacing': 'error',
19+
'vue/html-end-tags': 'error',
20+
'vue/html-indent': 'error',
21+
'vue/html-quotes': 'error',
22+
'vue/html-self-closing': 'error',
23+
'vue/max-attributes-per-line': 'error',
24+
'vue/multiline-html-element-content-newline': 'error',
25+
'vue/mustache-interpolation-spacing': 'error',
26+
'vue/no-multi-spaces': 'error',
27+
'vue/no-spaces-around-equal-signs-in-attribute': 'error',
28+
'vue/no-template-shadow': 'error',
29+
'vue/one-component-per-file': 'error',
30+
'vue/prop-name-casing': 'error',
31+
'vue/require-default-prop': 'error',
32+
'vue/require-explicit-emits': 'error',
33+
'vue/require-prop-types': 'error',
34+
'vue/singleline-html-element-content-newline': 'error',
35+
'vue/v-bind-style': 'error',
36+
'vue/v-on-event-hyphenation': [
37+
'error',
38+
'always',
39+
{
40+
autofix: true
41+
}
42+
],
43+
'vue/v-on-style': 'error',
44+
'vue/v-slot-style': 'error'
45+
}
46+
}
47+
]

‎lib/configs/index.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,30 @@ const configs = {
44

55
'vue2-essential': require('./vue2-essential'),
66
'vue2-strongly-recommended': require('./vue2-strongly-recommended'),
7+
'vue2-strongly-recommended-error': require('./vue2-strongly-recommended-error'),
78
'vue2-recommended': require('./vue2-recommended'),
9+
'vue2-recommended-error': require('./vue2-recommended-error'),
810

911
essential: require('./vue3-essential'),
1012
'strongly-recommended': require('./vue3-strongly-recommended'),
13+
'strongly-recommended-error': require('./vue3-strongly-recommended-error'),
1114
recommended: require('./vue3-recommended'),
15+
'recommended-error': require('./vue3-recommended-error'),
1216

1317
// flat configs
1418
'flat/base': require('./flat/base.js'),
1519

1620
'flat/vue2-essential': require('./flat/vue2-essential.js'),
1721
'flat/vue2-strongly-recommended': require('./flat/vue2-strongly-recommended.js'),
22+
'flat/vue2-strongly-recommended-error': require('./flat/vue2-strongly-recommended-error.js'),
1823
'flat/vue2-recommended': require('./flat/vue2-recommended.js'),
24+
'flat/vue2-recommended-error': require('./flat/vue2-recommended-error.js'),
1925

2026
'flat/essential': require('./flat/vue3-essential.js'),
2127
'flat/strongly-recommended': require('./flat/vue3-strongly-recommended.js'),
28+
'flat/strongly-recommended-error': require('./flat/vue3-strongly-recommended-error.js'),
2229
'flat/recommended': require('./flat/vue3-recommended.js'),
30+
'flat/recommended-error': require('./flat/vue3-recommended-error.js'),
2331

2432
// config-format-agnostic configs
2533
'no-layout-rules': require('./no-layout-rules')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
module.exports = {
7+
extends: require.resolve('./vue2-strongly-recommended-error'),
8+
rules: {
9+
'vue/attributes-order': 'error',
10+
'vue/block-order': 'error',
11+
'vue/no-lone-template': 'error',
12+
'vue/no-multiple-slot-args': 'error',
13+
'vue/no-required-prop-with-default': 'error',
14+
'vue/no-v-html': 'error',
15+
'vue/order-in-components': 'error',
16+
'vue/this-in-template': 'error'
17+
}
18+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
module.exports = {
7+
extends: require.resolve('./vue2-essential'),
8+
rules: {
9+
'vue/attribute-hyphenation': 'error',
10+
'vue/component-definition-name-casing': 'error',
11+
'vue/first-attribute-linebreak': 'error',
12+
'vue/html-closing-bracket-newline': 'error',
13+
'vue/html-closing-bracket-spacing': 'error',
14+
'vue/html-end-tags': 'error',
15+
'vue/html-indent': 'error',
16+
'vue/html-quotes': 'error',
17+
'vue/html-self-closing': 'error',
18+
'vue/max-attributes-per-line': 'error',
19+
'vue/multiline-html-element-content-newline': 'error',
20+
'vue/mustache-interpolation-spacing': 'error',
21+
'vue/no-multi-spaces': 'error',
22+
'vue/no-spaces-around-equal-signs-in-attribute': 'error',
23+
'vue/no-template-shadow': 'error',
24+
'vue/one-component-per-file': 'error',
25+
'vue/prop-name-casing': 'error',
26+
'vue/require-default-prop': 'error',
27+
'vue/require-prop-types': 'error',
28+
'vue/singleline-html-element-content-newline': 'error',
29+
'vue/v-bind-style': 'error',
30+
'vue/v-on-style': 'error',
31+
'vue/v-slot-style': 'error'
32+
}
33+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* IMPORTANT!
3+
* This file has been automatically generated,
4+
* in order to update its content execute "npm run update"
5+
*/
6+
module.exports = {
7+
extends: require.resolve('./vue3-strongly-recommended-error'),
8+
rules: {
9+
'vue/attributes-order': 'error',
10+
'vue/block-order': 'error',
11+
'vue/no-lone-template': 'error',
12+
'vue/no-multiple-slot-args': 'error',
13+
'vue/no-required-prop-with-default': 'error',
14+
'vue/no-v-html': 'error',
15+
'vue/order-in-components': 'error',
16+
'vue/this-in-template': 'error'
17+
}
18+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /