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

Rename vue/no-invalid-attribute-name rule to vue/invalid-attribute-name and add it to presets #1892

Merged
merged 2 commits into from May 17, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/rules/README.md
Expand Up @@ -105,6 +105,7 @@ Rules in this category are enabled for all presets provided by eslint-plugin-vue
| [vue/return-in-computed-property](./return-in-computed-property.md) | enforce that a return statement is present in computed property | | :three::two::warning: |
| [vue/return-in-emits-validator](./return-in-emits-validator.md) | enforce that a return statement is present in emits validator | | :three::two::warning: |
| [vue/use-v-on-exact](./use-v-on-exact.md) | enforce usage of `exact` modifier on `v-on` | | :three::two::hammer: |
| [vue/valid-attribute-name](./valid-attribute-name.md) | require valid attribute names | | :three::two::warning: |
| [vue/valid-define-emits](./valid-define-emits.md) | enforce valid `defineEmits` compiler macro | | :three::two::warning: |
| [vue/valid-define-props](./valid-define-props.md) | enforce valid `defineProps` compiler macro | | :three::two::warning: |
| [vue/valid-model-definition](./valid-model-definition.md) | require valid keys in model option | | :two::warning: |
Expand Down Expand Up @@ -224,7 +225,6 @@ For example:
| [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: | :hammer: |
| [vue/no-duplicate-attr-inheritance](./no-duplicate-attr-inheritance.md) | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | | :hammer: |
| [vue/no-empty-component-block](./no-empty-component-block.md) | disallow the `<template>` `<script>` `<style>` block to be empty | | :hammer: |
| [vue/no-invalid-attribute-name](./no-invalid-attribute-name.md) | require valid attribute names | | :warning: |
| [vue/no-multiple-objects-in-class](./no-multiple-objects-in-class.md) | disallow to pass multiple objects into array to class | | :hammer: |
| [vue/no-potential-component-option-typo](./no-potential-component-option-typo.md) | disallow a potential typo in your component property | :bulb: | :hammer: |
| [vue/no-restricted-block](./no-restricted-block.md) | disallow specific block | | :hammer: |
Expand Down
@@ -1,20 +1,21 @@
---
pageClass: rule-details
sidebarDepth: 0
title: vue/no-invalid-attribute-name
title: vue/valid-attribute-name
description: require valid attribute names
---
# vue/no-invalid-attribute-name
# vue/valid-attribute-name

> require valid attribute names

- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- :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"`.

## :book: Rule Details

This rule detects invalid HTML attributes.

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

```vue
<template>
Expand All @@ -39,5 +40,5 @@ Nothing.

## :mag: Implementation

- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-invalid-attribute-name.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-invalid-attribute-name.js)
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/valid-attribute-name.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/valid-attribute-name.js)
1 change: 1 addition & 0 deletions lib/configs/essential.js
Expand Up @@ -49,6 +49,7 @@ module.exports = {
'vue/return-in-computed-property': 'error',
'vue/return-in-emits-validator': 'error',
'vue/use-v-on-exact': 'error',
'vue/valid-attribute-name': 'error',
'vue/valid-define-emits': 'error',
'vue/valid-define-props': 'error',
'vue/valid-model-definition': 'error',
Expand Down
1 change: 1 addition & 0 deletions lib/configs/vue3-essential.js
Expand Up @@ -66,6 +66,7 @@ module.exports = {
'vue/return-in-computed-property': 'error',
'vue/return-in-emits-validator': 'error',
'vue/use-v-on-exact': 'error',
'vue/valid-attribute-name': 'error',
'vue/valid-define-emits': 'error',
'vue/valid-define-props': 'error',
'vue/valid-next-tick': 'error',
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -91,7 +91,6 @@ module.exports = {
'no-export-in-script-setup': require('./rules/no-export-in-script-setup'),
'no-expose-after-await': require('./rules/no-expose-after-await'),
'no-extra-parens': require('./rules/no-extra-parens'),
'no-invalid-attribute-name': require('./rules/no-invalid-attribute-name'),
'no-invalid-model-keys': require('./rules/no-invalid-model-keys'),
'no-irregular-whitespace': require('./rules/no-irregular-whitespace'),
'no-lifecycle-after-await': require('./rules/no-lifecycle-after-await'),
Expand Down Expand Up @@ -197,6 +196,7 @@ module.exports = {
'v-on-function-call': require('./rules/v-on-function-call'),
'v-on-style': require('./rules/v-on-style'),
'v-slot-style': require('./rules/v-slot-style'),
'valid-attribute-name': require('./rules/valid-attribute-name'),
'valid-define-emits': require('./rules/valid-define-emits'),
'valid-define-props': require('./rules/valid-define-props'),
'valid-model-definition': require('./rules/valid-model-definition'),
Expand Down
Expand Up @@ -12,8 +12,8 @@ module.exports = {
type: 'problem',
docs: {
description: 'require valid attribute names',
categories: undefined,
url: 'https://eslint.vuejs.org/rules/no-invalid-attribute-name.html'
categories: ['vue3-essential', 'essential'],
url: 'https://eslint.vuejs.org/rules/valid-attribute-name.html'
},
fixable: null,
schema: [],
Expand Down
@@ -1,11 +1,11 @@
/**
* @author *****your name*****
* @author Doug Wade <douglas.b.wade@gmail.com>
* See LICENSE file in root directory for full license.
*/
'use strict'

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

const tester = new RuleTester({
parser: require.resolve('vue-eslint-parser'),
Expand All @@ -15,7 +15,7 @@ const tester = new RuleTester({
}
})

tester.run('no-invalid-attribute-name', rule, {
tester.run('valid-attribute-name', rule, {
valid: [
{
filename: 'test.vue',
Expand Down