| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/eslint-plugin-nuxt/lib/utils/ |
Upload File : |
const utils = require('eslint-plugin-vue/lib/utils')
module.exports = Object.assign(
{
getProperty (node, name, condition) {
return node.properties.find(
p => p.type === 'Property' && name === utils.getStaticPropertyName(p) && condition(p)
)
},
getProperties (node, names) {
return node.properties.filter(
p => p.type === 'Property' && (!names.size || names.has(utils.getStaticPropertyName(p)))
)
},
getFunctionWithName (rootNode, name) {
return this.getProperty(
rootNode,
name,
item => item.value.type === 'ArrowFunctionExpression' || item.value.type === 'FunctionExpression'
)
},
isInFunction (func, child) {
if (func.value.type === 'FunctionExpression') {
if (
child &&
child.loc.start.line >= func.value.loc.start.line &&
child.loc.end.line <= func.value.loc.end.line
) {
return true
}
}
},
* getFunctionWithChild (rootNode, funcNames, childNodes) {
const funcNodes = this.getProperties(rootNode, funcNames)
for (const func of funcNodes) {
for (const { name, node: child } of childNodes) {
const funcName = utils.getStaticPropertyName(func)
if (!funcName) continue
if (this.isInFunction(func, child)) {
yield { name, node: child, func, funcName }
}
}
}
},
isOpenParen (token) {
return token.type === 'Punctuator' && token.value === '('
},
isCloseParen (token) {
return token.type === 'Punctuator' && token.value === ')'
},
getFirstAndLastTokens (node, sourceCode) {
let first = sourceCode.getFirstToken(node)
let last = sourceCode.getLastToken(node)
// If the value enclosed by parentheses, update the 'first' and 'last' by the parentheses.
while (true) {
const prev = sourceCode.getTokenBefore(first)
const next = sourceCode.getTokenAfter(last)
if (this.isOpenParen(prev) && this.isCloseParen(next)) {
first = prev
last = next
} else {
return { first, last }
}
}
}
},
utils
)