-
-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change document style for new rules added & Fixed new rule test cases…
…to work with eslint v6 (#1012) * Change document style for new rules added & Fixed new rule test cases to work with eslint v6 * Fixed valid-v-bind-sync * Run update script * Fixed test cases
- Loading branch information
Showing
21 changed files
with
123 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,124 @@ | ||
# enforce specific casing for component definition name (vue/component-definition-name-casing) | ||
--- | ||
pageClass: rule-details | ||
sidebarDepth: 0 | ||
title: vue/component-definition-name-casing | ||
description: enforce specific casing for component definition name | ||
--- | ||
# vue/component-definition-name-casing | ||
> enforce specific casing for component definition name | ||
- :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. | ||
|
||
## :book: Rule Details | ||
|
||
Define a style for component definition name casing for consistency purposes. | ||
|
||
## :book: Rule Details | ||
## :wrench: Options | ||
|
||
:+1: Examples of **correct** code for `PascalCase`: | ||
Default casing is set to `PascalCase`. | ||
|
||
```js | ||
```json | ||
{ | ||
"vue/component-definition-name-casing": ["error", "PascalCase" | "kebab-case"] | ||
} | ||
``` | ||
|
||
- `"PascalCase"` (default) ... enforce component definition names to pascal case. | ||
- `"kebab-case"` ... enforce component definition names to kebab case. | ||
|
||
### `"PascalCase" (default) | ||
|
||
<eslint-code-block fix :rules="{'vue/component-definition-name-casing': ['error']}"> | ||
|
||
```vue | ||
<script> | ||
export default { | ||
/* ✓ GOOD */ | ||
name: 'MyComponent' | ||
} | ||
</script> | ||
``` | ||
|
||
</eslint-code-block> | ||
|
||
<eslint-code-block fix :rules="{'vue/component-definition-name-casing': ['error']}"> | ||
|
||
```vue | ||
<script> | ||
export default { | ||
/* ✗ BAD */ | ||
name: 'my-component' | ||
} | ||
</script> | ||
``` | ||
|
||
</eslint-code-block> | ||
|
||
<eslint-code-block fix language="javascript" filename="src/MyComponent.js" :rules="{'vue/component-definition-name-casing': ['error']}"> | ||
|
||
```js | ||
/* ✓ GOOD */ | ||
Vue.component('MyComponent', { | ||
|
||
}) | ||
|
||
/* ✗ BAD */ | ||
Vue.component('my-component', { | ||
|
||
}) | ||
``` | ||
|
||
:+1: Examples of **correct** code for `kebab-case`: | ||
</eslint-code-block> | ||
|
||
```js | ||
### `"kebab-case" | ||
|
||
<eslint-code-block fix :rules="{'vue/component-definition-name-casing': ['error', 'kebab-case']}"> | ||
|
||
```vue | ||
<script> | ||
export default { | ||
/* ✓ GOOD */ | ||
name: 'my-component' | ||
} | ||
</script> | ||
``` | ||
|
||
</eslint-code-block> | ||
|
||
<eslint-code-block fix :rules="{'vue/component-definition-name-casing': ['error', 'kebab-case']}"> | ||
|
||
```vue | ||
<script> | ||
export default { | ||
/* ✗ BAD */ | ||
name: 'MyComponent' | ||
} | ||
</script> | ||
``` | ||
|
||
</eslint-code-block> | ||
|
||
<eslint-code-block fix language="javascript" filename="src/MyComponent.js" :rules="{'vue/component-definition-name-casing': ['error', 'kebab-case']}"> | ||
|
||
```js | ||
/* ✓ GOOD */ | ||
Vue.component('my-component', { | ||
|
||
}) | ||
|
||
/* ✗ BAD */ | ||
Vue.component('MyComponent', { | ||
|
||
}) | ||
``` | ||
|
||
## :wrench: Options | ||
</eslint-code-block> | ||
|
||
Default casing is set to `PascalCase`. | ||
## :books: Further reading | ||
|
||
```json | ||
{ | ||
"vue/component-definition-name-casing": ["error", "PascalCase|kebab-case"] | ||
} | ||
``` | ||
- [Style guide - Component name casing in JS/JSX](https://vuejs.org/v2/style-guide/#Component-name-casing-in-JS-JSX-strongly-recommended) | ||
|
||
## Related links | ||
## :mag: Implementation | ||
|
||
- [Style guide - Component name casing in JS/JSX](https://vuejs.org/v2/style-guide/#Component-name-casing-in-JS-JSX-strongly-recommended) | ||
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/component-definition-name-casing.js) | ||
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/component-definition-name-casing.js) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters