Skip to content

Fix tsc error #1583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/rules/no-use-computed-property-like-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const utils = require('../utils')
/**
* @typedef {import('../utils').ComponentPropertyData} ComponentPropertyData
* @typedef {import('../utils').ComponentObjectPropertyData} ComponentObjectPropertyData
* @typedef {import('../utils').GroupName} GroupName
*
* @typedef {{[key: string]: ComponentPropertyData & { valueType: { type: string | null } }}} PropertyMap
*/
Expand Down Expand Up @@ -167,7 +168,7 @@ const getValueType = ({ property, propertyMap }) => {
}

/**
* @param {Set<string>} groups
* @param {Set<GroupName>} groups
* @param {ObjectExpression} vueNodeMap
* @param {PropertyMap} propertyMap
*/
Expand Down Expand Up @@ -198,18 +199,15 @@ module.exports = {
},
/** @param {RuleContext} context */
create(context) {
/** @type {GroupName[]} */
const GROUP_NAMES = ['data', 'props', 'computed', 'methods']
const groups = new Set(GROUP_NAMES)

/** @type PropertyMap */
const propertyMap = {}

/**@type ObjectExpression */
let vueNodeMap = {}
/** @type {PropertyMap} */
const propertyMap = Object.create(null)

return utils.defineVueVisitor(context, {
onVueObjectEnter(node) {
vueNodeMap = node
const properties = utils.iterateProperties(node, groups)

for (const property of properties) {
Expand All @@ -222,8 +220,11 @@ module.exports = {
},

/** @param {ThisExpression} node */
'CallExpression > MemberExpression > ThisExpression'(node) {
addPropertyMap(groups, vueNodeMap, propertyMap)
'CallExpression > MemberExpression > ThisExpression'(
node,
{ node: vueNode }
) {
addPropertyMap(groups, vueNode, propertyMap)

if (node.parent.type !== 'MemberExpression') return
if (node.parent.property.type !== 'Identifier') return
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/style-variables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class StyleVariablesContext {
}
}

/** @type {Map<VElement, StyleVariablesContext} */
/** @type {Map<VElement, StyleVariablesContext>} */
const cache = new Map()
/**
* Get the style vars context
Expand Down