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

Change document style for new rules added & Fixed new rule test cases to work with eslint v6 #1011

Merged
merged 1 commit into from
Dec 26, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ For example:
| [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: |
| [vue/no-deprecated-scope-attribute](./no-deprecated-scope-attribute.md) | disallow deprecated `scope` attribute (in Vue.js 2.5.0+) | :wrench: |
| [vue/no-empty-pattern](./no-empty-pattern.md) | disallow empty destructuring patterns | |
| [vue/no-reserved-component-names](./no-reserved-component-names.md) | disallow the use of reserved names in component definitions | |
| [vue/no-restricted-syntax](./no-restricted-syntax.md) | disallow specified syntax | |
| [vue/object-curly-spacing](./object-curly-spacing.md) | enforce consistent spacing inside braces | :wrench: |
| [vue/require-direct-export](./require-direct-export.md) | require the component to be directly exported | |
| [vue/require-name-property](./require-name-property.md) | require a name property in Vue components | |
| [vue/script-indent](./script-indent.md) | enforce consistent indentation in `<script>` | :wrench: |
| [vue/space-infix-ops](./space-infix-ops.md) | require spacing around infix operators | :wrench: |
| [vue/space-unary-ops](./space-unary-ops.md) | enforce consistent spacing before or after unary operators | :wrench: |
Expand Down
15 changes: 12 additions & 3 deletions docs/rules/no-reserved-component-names.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
pageClass: rule-details
sidebarDepth: 0
title: vue/no-reserved-component-names
description: disallow the use of reserved names in component definitions
---
# vue/no-reserved-component-names
> disallow the use of reserved names in component definitions

- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/recommended"`, and `"plugin:vue/strongly-recommended"`.

## :book: Rule Details

This rule prevents name collisions between vue components and standard html elements.
Expand All @@ -25,4 +29,9 @@ export default {
- [List of html elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element)
- [List of SVG elements](https://developer.mozilla.org/en-US/docs/Web/SVG/Element)
- [Kebab case elements](https://stackoverflow.com/questions/22545621/do-custom-elements-require-a-dash-in-their-name/22545622#22545622)
- [Valid custom element name](https://w3c.github.io/webcomponents/spec/custom/#valid-custom-element-name)
- [Valid custom element name](https://w3c.github.io/webcomponents/spec/custom/#valid-custom-element-name)

## :mag: Implementation

- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-reserved-component-names.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-reserved-component-names.js)
20 changes: 18 additions & 2 deletions docs/rules/require-name-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/require-name-property
description: require a component name property
description: require a name property in Vue components
---
# vue/require-name-property
> require a component name property
> require a name property in Vue components

## :book: Rule Details

Expand All @@ -19,11 +19,27 @@ This rule requires a `name` property to be set on components.
export default {
name: 'OurButton'
}
</script>
```

</eslint-code-block>

<eslint-code-block :rules="{'vue/require-name-property': ['error']}">

```vue
<script>
/* ✗ BAD */
export default {
}
</script>
```

</eslint-code-block>

<eslint-code-block :rules="{'vue/require-name-property': ['error']}">

```vue
<script>
/* ✗ BAD */
export default {
notName: 'OurButton'
Expand Down
10 changes: 5 additions & 5 deletions docs/rules/static-class-names-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ description: enforce static class names order

- :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.

### Example
## :book: Rule Details

This rule aims to enforce the order of static class names.

<eslint-code-block fix :rules="{'vue/static-class-names-order': ['error']}">

Expand All @@ -25,11 +27,9 @@ description: enforce static class names order

</eslint-code-block>

## :books: Further reading

- [static-class-names-order]
## :wrench: Options

[static-class-names-order]: https://eslint.org/docs/rules/static-class-names-order
Nothing.

## :mag: Implementation

Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = {
'no-empty-pattern': require('./rules/no-empty-pattern'),
'no-multi-spaces': require('./rules/no-multi-spaces'),
'no-parsing-error': require('./rules/no-parsing-error'),
'no-reserved-component-names': require('./rules/no-reserved-component-names'),
'no-reserved-keys': require('./rules/no-reserved-keys'),
'no-restricted-syntax': require('./rules/no-restricted-syntax'),
'no-shared-component-data': require('./rules/no-shared-component-data'),
Expand All @@ -60,6 +61,7 @@ module.exports = {
'require-component-is': require('./rules/require-component-is'),
'require-default-prop': require('./rules/require-default-prop'),
'require-direct-export': require('./rules/require-direct-export'),
'require-name-property': require('./rules/require-name-property'),
'require-prop-type-constructor': require('./rules/require-prop-type-constructor'),
'require-prop-types': require('./rules/require-prop-types'),
'require-render-return': require('./rules/require-render-return'),
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/no-reserved-component-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ ruleTester.run('no-reserved-component-names', rule, {
}
</script>
`,
parser: 'vue-eslint-parser',
parser: require.resolve('vue-eslint-parser'),
parserOptions
},
{
Expand All @@ -309,7 +309,7 @@ ruleTester.run('no-reserved-component-names', rule, {
}
</script>
`,
parser: 'vue-eslint-parser',
parser: require.resolve('vue-eslint-parser'),
parserOptions
}
],
Expand Down