import type { Rule } from 'eslint' import { ESCAPE_MESSAGES, isEscaped } from './escape' import { bindingOfTag, partsOfFile, type Node, type Parser, type PartBinding } from './no-restyled-part' /** * The parts whose `title` is their own: the words of a heading or a dialog, * drawn on the page. Every other part hands a `title` on to its element, and * the browser shows it as its tooltip. `no-native-title.test.ts` holds this * list to the catalogue: a part that gains a `title` of its own joins it. */ export const PARTS_WITH_A_TITLE = ['CollapsibleSection', 'ConfirmDialog', 'ContainerHeader', 'DialogShell', 'ListColumn', 'NavTree', 'NavTreeSection', 'Panel', 'SectionHeader'] as const const child = (node: Node, key: string) => node[key] as Node | null | undefined const nameOf = (node: Node | null | undefined): string | undefined => node?.type === 'JSXIdentifier' || node?.type === 'Identifier' ? (node.name as string) : undefined /** * UIG-24: the browser's tooltip where ours belongs. * * A `title` on an element is the browser's hover box: grey, in the system's * font, after a delay nobody chose, and never on a touch screen. The package's * `WithTooltip` is the tooltip here (and `IconButton`'s `tooltip`, which draws * it). The rule reads the attribute, never the page: a tooltip's words are not * on the page until it opens. * * Judged: a `title` on a plain element, and on a part of the package (or an * app's wrapper that hands all its props on to one) whose `title` is not its * own — `