import type { Rule } from '../../types' export const noReferenceAttributeRule: Rule = { code: 'no-reference attribute', level: 'warning', category: 'No References', visit: (report, args) => { if (args.nodeType !== 'component-attribute') { return } const { path, component, memo } = args const [_components, _component, _attributes, attributeKey] = path if (typeof attributeKey !== 'string') { return } const attrs = memo(`${component.name}-attrs`, () => { const attrs = new Set() for (const [, formula] of component.formulasInComponent()) { if (formula.type === 'path' && formula.path[0] === 'Attributes') { attrs.add(formula.path[1]) } } return attrs }) if (attrs.has(attributeKey)) { return } report(path) }, }