Skip to content

Commit b89a182

Browse files
authored
Merge branch 'master' into develop/attributes-order--fixable
2 parents 8a560ab + 4c25403 commit b89a182

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+85
-63
lines changed

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ You can try this plugin on the Web.
1515
## :grey_exclamation: Requirements
1616

1717
- [ESLint](http://eslint.org/) `>=3.18.0`.
18+
- `>=4.7.0` to use `eslint --fix`.
19+
- `>=4.14.0` to use with `babel-eslint`.
1820
- Node.js `>=4.0.0`
1921

2022
## :cd: Installation
@@ -174,7 +176,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
174176
| :wrench: | [vue/html-end-tags](./docs/rules/html-end-tags.md) | enforce end tag style |
175177
| :wrench: | [vue/html-indent](./docs/rules/html-indent.md) | enforce consistent indentation in `<template>` |
176178
| :wrench: | [vue/html-self-closing](./docs/rules/html-self-closing.md) | enforce self-closing style |
177-
| | [vue/max-attributes-per-line](./docs/rules/max-attributes-per-line.md) | enforce the maximum number of attributes per line |
179+
| :wrench: | [vue/max-attributes-per-line](./docs/rules/max-attributes-per-line.md) | enforce the maximum number of attributes per line |
178180
| :wrench: | [vue/mustache-interpolation-spacing](./docs/rules/mustache-interpolation-spacing.md) | enforce unified spacing in mustache interpolations |
179181
| :wrench: | [vue/name-property-casing](./docs/rules/name-property-casing.md) | enforce specific casing for the name property in Vue components |
180182
| :wrench: | [vue/no-multi-spaces](./docs/rules/no-multi-spaces.md) | disallow multiple spaces |
@@ -195,9 +197,10 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
195197

196198
| | Rule ID | Description |
197199
|:---|:--------|:------------|
200+
| | [vue/attributes-order](./docs/rules/attributes-order.md) | enforce order of attributes |
198201
| :wrench: | [vue/html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes |
199202
| | [vue/no-confusing-v-for-v-if](./docs/rules/no-confusing-v-for-v-if.md) | disallow confusing `v-for` and `v-if` on the same element |
200-
| | [vue/order-in-components](./docs/rules/order-in-components.md) | enforce order of properties in components |
203+
| :wrench: | [vue/order-in-components](./docs/rules/order-in-components.md) | enforce order of properties in components |
201204
| | [vue/this-in-template](./docs/rules/this-in-template.md) | enforce usage of `this` in template |
202205

203206
### Uncategorized
@@ -207,6 +210,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
207210
| | [vue/attributes-order](./docs/rules/attributes-order.md) | enforce order of attributes |
208211
| :wrench: | [vue/html-closing-bracket-newline](./docs/rules/html-closing-bracket-newline.md) | require or disallow a line break before tag's closing brackets |
209212
| :wrench: | [vue/html-closing-bracket-spacing](./docs/rules/html-closing-bracket-spacing.md) | require or disallow a space before tag's closing brackets |
213+
| | [vue/prop-name-casing](./docs/rules/prop-name-casing.md) | enforce specific casing for the Prop name in Vue components |
210214
| :wrench: | [vue/script-indent](./docs/rules/script-indent.md) | enforce consistent indentation in `<script>` |
211215

212216
<!--RULES_TABLE_END-->
@@ -235,14 +239,20 @@ If you already use other parser (e.g. `"parser": "babel-eslint"`), please move i
235239

236240
The `vue-eslint-parser` uses the parser which is set by `parserOptions.parser` to parse scripts.
237241

238-
### Can my javascript code have increased indentation?
242+
### Why doesn't it work on .vue file?
239243

240-
It depends on the version of eslint you're using.
244+
1. Make sure you don't have `eslint-plugin-html` in your config. The `eslint-plugin-html` extracts the content from `<script>` tags, but `eslint-vue-plugin` requires `<script>` tags and `<template>` tags in order to distinguish template and script in single file components.
241245

242-
[indent](https://eslint.org/docs/rules/indent) rule in `[email protected]` makes it possible, but if you use `[email protected]` be aware that this rule has been rewritten and is more strict now, thus it doesn't allow to have increased initial indentation.
246+
```diff
247+
"plugins": [
248+
"vue",
249+
- "html"
250+
]
251+
```
243252

244-
You can however use [indent-legacy](https://eslint.org/docs/rules/indent-legacy) rule instead.
245-
More informations [here](https://eslint.org/docs/user-guide/migrating-to-4.0.0#indent-rewrite).
253+
2. Make sure your tool is set to lint `.vue` files.
254+
- CLI targets only `.js` files by default. You have to specify additional extensions by `--ext` option or glob patterns. E.g. `eslint "src/**/*.{js,vue}"` or `eslint src --ext .vue`.
255+
- VSCode targets only JavaScript or HTML files by default. You have to add `{"autoFix": true, "language": "vue"}` into `eslint.validate` entry.
246256

247257
## :anchor: Semantic Versioning Policy
248258

docs/rules/attributes-order.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# enforce order of attributes (vue/attributes-order)
22

3+
- :gear: This rule is included in `"plugin:vue/recommended"`.
4+
35
## :book: Rule Details
46

57
This rule aims to enfore ordering of component attributes. The default order is specified in the [Vue styleguide](https://vuejs.org/v2/style-guide/#Element-attribute-order-recommended) and is:

docs/rules/max-attributes-per-line.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# enforce the maximum number of attributes per line (vue/max-attributes-per-line)
22

33
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
4+
- :wrench: The `--fix` option on the [command line](http://eslint.org/docs/user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.
45

56
Limits the maximum number of attributes/properties per line to improve readability.
67

docs/rules/order-in-components.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# enforce order of properties in components (vue/order-in-components)
22

33
- :gear: This rule is included in `"plugin:vue/recommended"`.
4+
- :wrench: The `--fix` option on the [command line](http://eslint.org/docs/user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.
45

56
This rule makes sure you keep declared order of properties in components.
67

docs/rules/prop-name-casing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# enforce specific casing for the Prop name in Vue components(prop-name-casing)
1+
# enforce specific casing for the Prop name in Vue components (vue/prop-name-casing)
22

33
This rule would enforce proper casing of props in vue components(camelCase).
44

lib/configs/recommended.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module.exports = {
77
extends: require.resolve('./strongly-recommended'),
88
rules: {
9+
'vue/attributes-order': 'error',
910
'vue/html-quotes': 'error',
1011
'vue/no-confusing-v-for-v-if': 'error',
1112
'vue/order-in-components': 'error',

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
'no-textarea-mustache': require('./rules/no-textarea-mustache'),
3434
'no-unused-vars': require('./rules/no-unused-vars'),
3535
'order-in-components': require('./rules/order-in-components'),
36+
'prop-name-casing': require('./rules/prop-name-casing'),
3637
'require-component-is': require('./rules/require-component-is'),
3738
'require-default-prop': require('./rules/require-default-prop'),
3839
'require-prop-types': require('./rules/require-prop-types'),

lib/rules/attribute-hyphenation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
docs: {
1717
description: 'enforce attribute naming style in template',
1818
category: 'strongly-recommended',
19-
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v4.2.2/docs/rules/attribute-hyphenation.md'
19+
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v4.3.0/docs/rules/attribute-hyphenation.md'
2020
},
2121
fixable: 'code',
2222
schema: [

lib/rules/comment-directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ module.exports = {
109109
docs: {
110110
description: 'support comment-directives in `<template>`',
111111
category: 'base',
112-
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v4.2.2/docs/rules/comment-directive.md'
112+
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v4.3.0/docs/rules/comment-directive.md'
113113
},
114114
schema: []
115115
},

lib/rules/html-closing-bracket-newline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
docs: {
3333
description: "require or disallow a line break before tag's closing brackets",
3434
category: undefined,
35-
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v4.2.2/docs/rules/html-closing-bracket-newline.md'
35+
url: 'https://github.com/vuejs/eslint-plugin-vue/blob/v4.3.0/docs/rules/html-closing-bracket-newline.md'
3636
},
3737
fixable: 'whitespace',
3838
schema: [{

0 commit comments

Comments
 (0)