Skip to content

Commit

Permalink
update docs and fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Dec 16, 2020
1 parent 110b236 commit 96425c6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
16 changes: 9 additions & 7 deletions docs/rules/new-line-between-multi-line-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ description: enforce new lines between multi-line properties in Vue components

This rule aims at enforcing new lines between multi-line properties in Vue components to help readability

Examples of **incorrect** code for this rule:

<eslint-code-block fix :rules="{'vue/new-line-between-multi-line-property': ['error']}">

```vue
<script>
/* ✗ BAD */
export default {
props: {
value: {
Expand All @@ -43,13 +42,11 @@ export default {

</eslint-code-block>


Examples of **correct** code for this rule:

<eslint-code-block fix :rules="{'vue/new-line-between-multi-line-property': ['error']}">

```vue
<script>
/* ✓ GOOD */
export default {
props: {
value: {
Expand Down Expand Up @@ -77,16 +74,21 @@ export default {
</eslint-code-block>

## :wrench: Option

```json
{
"vue/new-line-between-multiline-property": ["error", {
"minLineOfMultilineProperty": 2
}]
}
```
- `minLineOfMultilineProperty` ... `type: number`, Define the minimum number of rows for a multi-line property .`type:` number, `default:` 2 , `min:`: 2

- `minLineOfMultilineProperty` ... Define the minimum number of rows for a multi-line property. default `2`

## :books: Further Reading
Nothing here

- [Style guide - Empty lines in component/instance options](https://v3.vuejs.org/style-guide/#empty-lines-in-component-instance-options-recommended)

## :mag: Implementation

- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/new-line-between-multi-line-property.js)
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/new-line-between-multi-line-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const utils = require('../utils')
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
// @ts-ignore
module.exports = {
meta: {
type: 'layout',
Expand Down Expand Up @@ -48,7 +47,7 @@ module.exports = {
minLineOfMultilineProperty = context.options[0].minLineOfMultilineProperty
}

/** @type {any[]} */
/** @type {CallExpression[]} */
const callStack = []
const sourceCode = context.getSourceCode()
return Object.assign(
Expand Down Expand Up @@ -92,7 +91,6 @@ module.exports = {
loc: pre.loc,
message:
'Enforce new lines between multi-line properties in Vue components.',
// @ts-ignore
fix(fixer) {
let firstPositionOfLine = cur.range[0] - cur.loc.start.column
if (leadingComments.length) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-restricted-custom-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const regexp = require('../utils/regexp')
/**
* @typedef {object} ParsedOption
* @property { (name: string) => boolean } test
* @property {string} [message]
* @property {string} [suggest]
* @property {string|undefined} [message]
* @property {string|undefined} [suggest]
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-restricted-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const regexp = require('../utils/regexp')
/**
* @typedef {object} ParsedOption
* @property { (name: string) => boolean } test
* @property {string} [message]
* @property {string} [suggest]
* @property {string|undefined} [message]
* @property {string|undefined} [suggest]
*/

/**
Expand Down

0 comments on commit 96425c6

Please sign in to comment.