Add components
This commit is contained in:
30
slider/node_modules/eslint-plugin-vue/lib/utils/scope.js
generated
vendored
Normal file
30
slider/node_modules/eslint-plugin-vue/lib/utils/scope.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
module.exports = {
|
||||
getScope
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scope for the current node
|
||||
* @param {RuleContext} context The rule context
|
||||
* @param {ESNode} currentNode The node to get the scope of
|
||||
* @returns { import('eslint').Scope.Scope } The scope information for this node
|
||||
*/
|
||||
function getScope(context, currentNode) {
|
||||
// On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope.
|
||||
const inner = currentNode.type !== 'Program'
|
||||
const scopeManager = context.getSourceCode().scopeManager
|
||||
|
||||
/** @type {ESNode | null} */
|
||||
let node = currentNode
|
||||
for (; node; node = /** @type {ESNode | null} */ (node.parent)) {
|
||||
const scope = scopeManager.acquire(node, inner)
|
||||
|
||||
if (scope) {
|
||||
if (scope.type === 'function-expression-name') {
|
||||
return scope.childScopes[0]
|
||||
}
|
||||
return scope
|
||||
}
|
||||
}
|
||||
|
||||
return scopeManager.scopes[0]
|
||||
}
|
Reference in New Issue
Block a user