eslint-plugin-vue
Advanced tools
Comparing version 4.0.0-beta.4 to 4.0.0-beta.5
@@ -37,2 +37,3 @@ /** | ||
switchCase: 0, | ||
alignAttributesVertically: true, | ||
ignores: [] | ||
@@ -57,2 +58,5 @@ } | ||
} | ||
if (options.alignAttributesVertically != null) { | ||
ret.alignAttributesVertically = options.alignAttributesVertically | ||
} | ||
if (options.ignores != null) { | ||
@@ -309,4 +313,5 @@ ret.ignores = options.ignores | ||
*/ | ||
function processNodeList (nodeList, leftToken, rightToken, offset) { | ||
function processNodeList (nodeList, leftToken, rightToken, offset, alignVertically) { | ||
let t | ||
alignVertically = alignVertically != null ? alignVertically : true | ||
@@ -355,7 +360,16 @@ if (nodeList.length >= 1) { | ||
// Align the rest tokens to the first token. | ||
// Set baseline | ||
if (nodeList.some(isBeginningOfLine)) { | ||
setBaseline(baseToken) | ||
} | ||
setOffset(alignTokens, 0, baseToken) | ||
if (alignVertically) { | ||
// Align the rest tokens to the first token. | ||
setOffset(alignTokens, 0, baseToken) | ||
} else { | ||
// Align tokens relatively to passed root node | ||
// So it's possible to force proper position for VAttributes | ||
const rootNode = nodeList && nodeList[0].parent | ||
setOffset(alignTokens, offset, template.getFirstToken(rootNode)) | ||
} | ||
} | ||
@@ -767,3 +781,3 @@ } | ||
processNodeList(node.attributes, openToken, null, options.attribute) | ||
processNodeList(node.attributes, openToken, null, options.attribute, options.alignAttributesVertically) | ||
if (closeToken != null && closeToken.type.endsWith('TagClose')) { | ||
@@ -1302,2 +1316,3 @@ setOffset(closeToken, options.closeBracket, openToken) | ||
'switchCase': { type: 'integer', minimum: 0 }, | ||
'alignAttributesVertically': { type: 'boolean' }, | ||
'ignores': { | ||
@@ -1304,0 +1319,0 @@ type: 'array', |
@@ -30,3 +30,3 @@ /** | ||
const code = context.getSourceCode().getText(node) | ||
const MUTATION_REGEX = /(this.)((?!(concat|slice|map|filter)\().)*((push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)\()/g | ||
const MUTATION_REGEX = /(this.)((?!(concat|slice|map|filter)\().)[^\)]*((push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)\()/g | ||
@@ -33,0 +33,0 @@ if (MUTATION_REGEX.test(code)) { |
@@ -18,11 +18,16 @@ /** | ||
VElement (node) { | ||
for (const variable of node.variables) { | ||
if (variable.references.length === 0) { | ||
context.report({ | ||
node: variable.id, | ||
loc: variable.id.loc, | ||
message: `'{{name}}' is defined but never used.`, | ||
data: variable.id | ||
}) | ||
} | ||
const variables = node.variables | ||
for ( | ||
let i = variables.length - 1; | ||
i >= 0 && !variables[i].references.length; | ||
i-- | ||
) { | ||
const variable = variables[i] | ||
context.report({ | ||
node: variable.id, | ||
loc: variable.id.loc, | ||
message: `'{{name}}' is defined but never used.`, | ||
data: variable.id | ||
}) | ||
} | ||
@@ -29,0 +34,0 @@ } |
{ | ||
"name": "eslint-plugin-vue", | ||
"version": "4.0.0-beta.4", | ||
"version": "4.0.0-beta.5", | ||
"description": "Official ESLint plugin for Vue.js", | ||
@@ -47,3 +47,3 @@ "main": "lib/index.js", | ||
"require-all": "^2.2.0", | ||
"vue-eslint-parser": "^2.0.1-beta.1" | ||
"vue-eslint-parser": "^2.0.1" | ||
}, | ||
@@ -50,0 +50,0 @@ "devDependencies": { |
@@ -124,3 +124,3 @@ # eslint-plugin-vue | ||
| | [no-reserved-keys](./docs/rules/no-reserved-keys.md) | disallow overwriting reserved keys | | ||
| | [no-shared-component-data](./docs/rules/no-shared-component-data.md) | enforce component's data property to be a function | | ||
| :wrench: | [no-shared-component-data](./docs/rules/no-shared-component-data.md) | enforce component's data property to be a function | | ||
| | [no-side-effects-in-computed-properties](./docs/rules/no-side-effects-in-computed-properties.md) | disallow side effects in computed properties | | ||
@@ -185,3 +185,3 @@ | | [no-template-key](./docs/rules/no-template-key.md) | disallow `key` attribute on `<template>` | | ||
|:---|:--------|:------------| | ||
| | [html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes | | ||
| :wrench: | [html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes | | ||
| | [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 | | ||
@@ -188,0 +188,0 @@ | | [order-in-components](./docs/rules/order-in-components.md) | enforce order of properties in components | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
201426
5520
Updatedvue-eslint-parser@^2.0.1