import type { AST, Rule } from 'eslint'; /** * The escape marker (UIG-3, seam S4 in docs/GATES.md ยง16): one written reason * why one element stays as it is. * * A line comment directly above the element, naming the rule it keeps off, * * // @estiva-escape(no-raw-element): * * or, where the element is a JSX child, the JSX comment on the line above, * * {/* @estiva-escape(no-raw-element): *\/} * * with at least ten characters of reason, spaces not counted. It escapes only * the rules it names (Katerina's ruling B3, 25 September: one reason used to * switch off every rule on the element, so a raw button that also wrote a * dialog's role by hand passed under one reason). Two rules on one element are * named together, `@estiva-escape(no-raw-element, no-rebuilt-behaviour)`, each * on purpose. A marker that names no rule escapes nothing, and says which name * to write. * * Not `eslint-disable`. A directive switches a rule off without saying it was * meant, and the count of escapes (`.gates-count.json`) could not see it. A * marker written inside a directive that switches one of these rules off is * reported for that reason. * * The token lint's older notes (`eslint-disable-next-line -- @estiva-escape: * `, Katerina's ruling A2 of 15 September) are not read here: they * escape the token lint's rules, which are not this plugin's, and they stay as * they are (Katerina, 15 September). */ export declare const ESCAPE_MARKER = "@estiva-escape"; /** Characters of reason, spaces not counted. */ export declare const MIN_REASON = 10; /** The key under ESLint's `settings` this plugin reads. */ export declare const SETTINGS_KEY = "estiva"; /** * Every rule spreads these into its `meta.messages`, because `isEscaped` * reports through the rule that called it. */ export declare const ESCAPE_MESSAGES: { readonly escapeWithoutReason: "An escape needs its reason, at least 10 characters: `// @estiva-escape({{rule}}): `. An escape with no reason hides nothing."; readonly escapeInDirective: "Write the escape as its own comment on the line above: `// @estiva-escape({{rule}}): `. Inside an eslint-disable comment it switches the rule off instead of recording why."; readonly escapeWithoutRule: "Name the rule this escape keeps off: `@estiva-escape({{rule}}): `. An escape now keeps off only the rules it names."; readonly escaped: "Escaped: {{reason}}"; }; /** A rule's name as a marker writes it: `no-raw-element` for `estiva/no-raw-element`. */ export declare const shortRuleName: (id: string) => string; /** * What a marker says, read from a comment's text: the rules it names (none when * it names none) and its reason. Null when the comment carries no marker. */ export declare function readMarker(text: string): { rules: string[]; reason: string; } | null; export interface EstivaSettings { /** * Report every sanctioned escape as a message with the id `escaped`, so a * count can read them. Off in the lint anyone runs; on only in the count. */ reportEscapes?: boolean; } interface Located { loc?: AST.SourceLocation | null; range?: [number, number]; } /** * Whether the element at `node` carries a valid escape on the line above. * * Every rule of this plugin calls it before it reports. It reports, through * that rule, a marker with too short a reason and a marker inside an * eslint-disable directive for this rule; either way the element is not * escaped, so the rule reports it too. */ export declare function isEscaped(context: Rule.RuleContext, node: Located): boolean; export {}; //# sourceMappingURL=escape.d.ts.map