diff --git a/README.md b/README.md index 871384de1..f3f64a05b 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,13 @@ Enforce all the rules in this category, as well as all higher priority rules, wi | | [order-in-components](./docs/rules/order-in-components.md) | enforce order of properties in components | | | [this-in-template](./docs/rules/this-in-template.md) | enforce usage of `this` in template | + +### Uncategorized + +| | Rule ID | Description | +|:---|:--------|:------------| +| :wrench: | [html-closing-bracket-newline](./docs/rules/html-closing-bracket-newline.md) | require or disallow a line break before tag's closing brackets | + ## :couple: FAQ diff --git a/docs/rules/html-closing-bracket-newline.md b/docs/rules/html-closing-bracket-newline.md new file mode 100644 index 000000000..f1c5327db --- /dev/null +++ b/docs/rules/html-closing-bracket-newline.md @@ -0,0 +1,95 @@ +# require or disallow a line break before tag's closing brackets (html-closing-bracket-newline) + +- :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. + +People have own preference about the location of closing brackets. +This rule enforces a line break (or no line break) before tag's closing brackets. + +```html +
+ + +``` + +## Rule Details + +```json +{ + "html-closing-bracket-newline": ["error", { + "singleline": "never", + "multiline": "never" + }] +} +``` + +- `singleline` ... the configuration for single-line elements. It's a single-line element if the element does not have attributes or the last attribute is on the same line as the opening bracket. + - `"never"` ... disallow line breaks before the closing bracket. This is the default. + - `"always"` ... require one line break before the closing bracket. +- `multiline` ... the configuration for multiline elements. It's a multiline element if the last attribute is not on the same line of the opening bracket. + - `"never"` ... disallow line breaks before the closing bracket. This is the default. + - `"always"` ... require one line break before the closing bracket. + +Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-level of the closing brackets. + +:-1: Examples of **incorrect** code for this rule: + +```html +/*eslint html-closing-bracket-newline: "error"*/ + +