eslint-plugin-vue
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -76,3 +76,3 @@ /** | ||
const forbiddenNodes = [] | ||
const allowedScopes = [] | ||
let scopeStack = { upper: null, body: null } | ||
@@ -91,17 +91,18 @@ const expressionTypes = { | ||
node: node, | ||
type: 'async' | ||
type: 'async', | ||
targetBody: node.body | ||
}) | ||
} else if (node.parent.type === 'ReturnStatement') { | ||
allowedScopes.push(node) | ||
} | ||
scopeStack = { upper: scopeStack, body: node.body } | ||
} | ||
function onFunctionExit () { | ||
scopeStack = scopeStack.upper | ||
} | ||
return Object.assign({}, | ||
{ | ||
FunctionDeclaration: onFunctionEnter, | ||
':function': onFunctionEnter, | ||
':function:exit': onFunctionExit, | ||
FunctionExpression: onFunctionEnter, | ||
ArrowFunctionExpression: onFunctionEnter, | ||
NewExpression (node) { | ||
@@ -111,6 +112,5 @@ if (node.callee.name === 'Promise') { | ||
node: node, | ||
type: 'new' | ||
type: 'new', | ||
targetBody: scopeStack.body | ||
}) | ||
} else if (node.parent.type === 'ReturnStatement') { | ||
allowedScopes.push(node) | ||
} | ||
@@ -123,3 +123,4 @@ }, | ||
node: node, | ||
type: 'promise' | ||
type: 'promise', | ||
targetBody: scopeStack.body | ||
}) | ||
@@ -129,6 +130,5 @@ } else if (isTimedFunction(node)) { | ||
node: node, | ||
type: 'timed' | ||
type: 'timed', | ||
targetBody: scopeStack.body | ||
}) | ||
} else if (node.parent.type === 'ReturnStatement') { | ||
allowedScopes.push(node) | ||
} | ||
@@ -140,16 +140,5 @@ }, | ||
node: node, | ||
type: 'await' | ||
type: 'await', | ||
targetBody: scopeStack.body | ||
}) | ||
}, | ||
'ReturnStatement' (node) { | ||
if ( | ||
node.argument && | ||
( | ||
node.argument.type === 'ObjectExpression' || | ||
node.argument.type === 'ArrayExpression' | ||
) | ||
) { | ||
allowedScopes.push(node.argument) | ||
} | ||
} | ||
@@ -166,6 +155,3 @@ }, | ||
el.node.loc.end.line <= cp.value.loc.end.line && | ||
!allowedScopes.some(scope => | ||
scope.range[0] < el.node.range[0] && | ||
scope.range[1] > el.node.range[1] | ||
) | ||
el.targetBody === cp.value | ||
) { | ||
@@ -172,0 +158,0 @@ context.report({ |
@@ -49,3 +49,3 @@ /** | ||
loc: { line: 1, column: 0 }, | ||
message: 'Use the latest vue-eslint-parser. See also https://vuejs.github.io/eslint-plugin-vue/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error.' | ||
message: 'Use the latest vue-eslint-parser. See also https://eslint.vuejs.org/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error.' | ||
}) | ||
@@ -52,0 +52,0 @@ return |
@@ -38,4 +38,8 @@ /** | ||
const fix = node => fixer => { | ||
let newText | ||
if (node.type === 'Literal') { | ||
return fixer.replaceText(node, node.value) | ||
if (typeof node.value !== 'string') { | ||
return undefined | ||
} | ||
newText = node.value | ||
} else if ( | ||
@@ -46,4 +50,9 @@ node.type === 'TemplateLiteral' && | ||
) { | ||
return fixer.replaceText(node, node.quasis[0].value.cooked) | ||
newText = node.quasis[0].value.cooked | ||
} else { | ||
return undefined | ||
} | ||
if (newText) { | ||
return fixer.replaceText(node, newText) | ||
} | ||
} | ||
@@ -63,3 +72,3 @@ | ||
node.elements | ||
.filter(prop => isForbiddenType(prop)) | ||
.filter(prop => prop && isForbiddenType(prop)) | ||
.forEach(prop => context.report({ | ||
@@ -66,0 +75,0 @@ node: prop, |
@@ -58,3 +58,3 @@ /** | ||
loc: { line: 1, column: 0 }, | ||
message: 'Use the latest vue-eslint-parser. See also https://vuejs.github.io/eslint-plugin-vue/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error' | ||
message: 'Use the latest vue-eslint-parser. See also https://eslint.vuejs.org/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error' | ||
}) | ||
@@ -119,3 +119,3 @@ return {} | ||
category, | ||
url: `https://vuejs.github.io/eslint-plugin-vue/rules/${path.basename(coreRule.meta.docs.url || '')}.html` | ||
url: `https://eslint.vuejs.org/rules/${path.basename(coreRule.meta.docs.url || '')}.html` | ||
}) | ||
@@ -458,2 +458,3 @@ }) | ||
props = propsNode.value.elements | ||
.filter(prop => prop) | ||
.map(prop => { | ||
@@ -460,0 +461,0 @@ const key = prop.type === 'Literal' && typeof prop.value === 'string' ? prop : null |
{ | ||
"name": "eslint-plugin-vue", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Official ESLint plugin for Vue.js", | ||
@@ -59,4 +59,5 @@ "main": "lib/index.js", | ||
"eslint-plugin-eslint-plugin": "^2.0.1", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-vue": "file:.", | ||
"eslint-plugin-vue-libs": "^4.0.0", | ||
"eslint-plugin-vue": "file:.", | ||
"eslint4b": "^6.6.0", | ||
@@ -63,0 +64,0 @@ "lodash": "^4.17.4", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
325212
107
18
8910
1