Skip to content

Commit 6bd81ea

Browse files
authored
Rename vue/no-invalid-attribute-name rule to vue/invalid-attribute-name and add it to presets (#1892)
* Add `vue/no-invalid-attribute-name` rule to the presets * Rename no-invalid-attribute-name rule to invalid-attribute-name
1 parent ab85fd6 commit 6bd81ea

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

docs/rules/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Rules in this category are enabled for all presets provided by eslint-plugin-vue
105105
| [vue/return-in-computed-property](./return-in-computed-property.md) | enforce that a return statement is present in computed property | | :three::two::warning: |
106106
| [vue/return-in-emits-validator](./return-in-emits-validator.md) | enforce that a return statement is present in emits validator | | :three::two::warning: |
107107
| [vue/use-v-on-exact](./use-v-on-exact.md) | enforce usage of `exact` modifier on `v-on` | | :three::two::hammer: |
108+
| [vue/valid-attribute-name](./valid-attribute-name.md) | require valid attribute names | | :three::two::warning: |
108109
| [vue/valid-define-emits](./valid-define-emits.md) | enforce valid `defineEmits` compiler macro | | :three::two::warning: |
109110
| [vue/valid-define-props](./valid-define-props.md) | enforce valid `defineProps` compiler macro | | :three::two::warning: |
110111
| [vue/valid-model-definition](./valid-model-definition.md) | require valid keys in model option | | :two::warning: |
@@ -224,7 +225,6 @@ For example:
224225
| [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: | :hammer: |
225226
| [vue/no-duplicate-attr-inheritance](./no-duplicate-attr-inheritance.md) | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | | :hammer: |
226227
| [vue/no-empty-component-block](./no-empty-component-block.md) | disallow the `<template>` `<script>` `<style>` block to be empty | | :hammer: |
227-
| [vue/no-invalid-attribute-name](./no-invalid-attribute-name.md) | require valid attribute names | | :warning: |
228228
| [vue/no-multiple-objects-in-class](./no-multiple-objects-in-class.md) | disallow to pass multiple objects into array to class | | :hammer: |
229229
| [vue/no-potential-component-option-typo](./no-potential-component-option-typo.md) | disallow a potential typo in your component property | :bulb: | :hammer: |
230230
| [vue/no-restricted-block](./no-restricted-block.md) | disallow specific block | | :hammer: |

docs/rules/no-invalid-attribute-name.md renamed to docs/rules/valid-attribute-name.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
---
22
pageClass: rule-details
33
sidebarDepth: 0
4-
title: vue/no-invalid-attribute-name
4+
title: vue/valid-attribute-name
55
description: require valid attribute names
66
---
7-
# vue/no-invalid-attribute-name
7+
# vue/valid-attribute-name
88

99
> require valid attribute names
1010
1111
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
12+
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
1213

1314
## :book: Rule Details
1415

1516
This rule detects invalid HTML attributes.
1617

17-
<eslint-code-block :rules="{'vue/no-invalid-attribute-name': ['error']}">
18+
<eslint-code-block :rules="{'vue/valid-attribute-name': ['error']}">
1819

1920
```vue
2021
<template>
@@ -39,5 +40,5 @@ Nothing.
3940

4041
## :mag: Implementation
4142

42-
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-invalid-attribute-name.js)
43-
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-invalid-attribute-name.js)
43+
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/valid-attribute-name.js)
44+
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/valid-attribute-name.js)

lib/configs/essential.js

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = {
4949
'vue/return-in-computed-property': 'error',
5050
'vue/return-in-emits-validator': 'error',
5151
'vue/use-v-on-exact': 'error',
52+
'vue/valid-attribute-name': 'error',
5253
'vue/valid-define-emits': 'error',
5354
'vue/valid-define-props': 'error',
5455
'vue/valid-model-definition': 'error',

lib/configs/vue3-essential.js

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ module.exports = {
6666
'vue/return-in-computed-property': 'error',
6767
'vue/return-in-emits-validator': 'error',
6868
'vue/use-v-on-exact': 'error',
69+
'vue/valid-attribute-name': 'error',
6970
'vue/valid-define-emits': 'error',
7071
'vue/valid-define-props': 'error',
7172
'vue/valid-next-tick': 'error',

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ module.exports = {
9191
'no-export-in-script-setup': require('./rules/no-export-in-script-setup'),
9292
'no-expose-after-await': require('./rules/no-expose-after-await'),
9393
'no-extra-parens': require('./rules/no-extra-parens'),
94-
'no-invalid-attribute-name': require('./rules/no-invalid-attribute-name'),
9594
'no-invalid-model-keys': require('./rules/no-invalid-model-keys'),
9695
'no-irregular-whitespace': require('./rules/no-irregular-whitespace'),
9796
'no-lifecycle-after-await': require('./rules/no-lifecycle-after-await'),
@@ -197,6 +196,7 @@ module.exports = {
197196
'v-on-function-call': require('./rules/v-on-function-call'),
198197
'v-on-style': require('./rules/v-on-style'),
199198
'v-slot-style': require('./rules/v-slot-style'),
199+
'valid-attribute-name': require('./rules/valid-attribute-name'),
200200
'valid-define-emits': require('./rules/valid-define-emits'),
201201
'valid-define-props': require('./rules/valid-define-props'),
202202
'valid-model-definition': require('./rules/valid-model-definition'),

lib/rules/no-invalid-attribute-name.js renamed to lib/rules/valid-attribute-name.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module.exports = {
1212
type: 'problem',
1313
docs: {
1414
description: 'require valid attribute names',
15-
categories: undefined,
16-
url: 'https://eslint.vuejs.org/rules/no-invalid-attribute-name.html'
15+
categories: ['vue3-essential', 'essential'],
16+
url: 'https://eslint.vuejs.org/rules/valid-attribute-name.html'
1717
},
1818
fixable: null,
1919
schema: [],

tests/lib/rules/no-invalid-attribute-name.js renamed to tests/lib/rules/valid-attribute-name.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @author *****your name*****
2+
* @author Doug Wade <[email protected]>
33
* See LICENSE file in root directory for full license.
44
*/
55
'use strict'
66

77
const RuleTester = require('eslint').RuleTester
8-
const rule = require('../../../lib/rules/no-invalid-attribute-name')
8+
const rule = require('../../../lib/rules/valid-attribute-name')
99

1010
const tester = new RuleTester({
1111
parser: require.resolve('vue-eslint-parser'),
@@ -15,7 +15,7 @@ const tester = new RuleTester({
1515
}
1616
})
1717

18-
tester.run('no-invalid-attribute-name', rule, {
18+
tester.run('valid-attribute-name', rule, {
1919
valid: [
2020
{
2121
filename: 'test.vue',

0 commit comments

Comments
 (0)