index.d.ts 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465
  1. export class VFile {
  2. /**
  3. * Create a new virtual file.
  4. *
  5. * `options` is treated as:
  6. *
  7. * * `string` or `Uint8Array` — `{value: options}`
  8. * * `URL` — `{path: options}`
  9. * * `VFile` — shallow copies its data over to the new file
  10. * * `object` — all fields are shallow copied over to the new file
  11. *
  12. * Path related fields are set in the following order (least specific to
  13. * most specific): `history`, `path`, `basename`, `stem`, `extname`,
  14. * `dirname`.
  15. *
  16. * You cannot set `dirname` or `extname` without setting either `history`,
  17. * `path`, `basename`, or `stem` too.
  18. *
  19. * @param {Compatible | null | undefined} [value]
  20. * File value.
  21. * @returns
  22. * New instance.
  23. */
  24. constructor(value?: Compatible | null | undefined);
  25. /**
  26. * Base of `path` (default: `process.cwd()` or `'/'` in browsers).
  27. *
  28. * @type {string}
  29. */
  30. cwd: string;
  31. /**
  32. * Place to store custom info (default: `{}`).
  33. *
  34. * It’s OK to store custom data directly on the file but moving it to
  35. * `data` is recommended.
  36. *
  37. * @type {Data}
  38. */
  39. data: Data;
  40. /**
  41. * List of file paths the file moved between.
  42. *
  43. * The first is the original path and the last is the current path.
  44. *
  45. * @type {Array<string>}
  46. */
  47. history: Array<string>;
  48. /**
  49. * List of messages associated with the file.
  50. *
  51. * @type {Array<VFileMessage>}
  52. */
  53. messages: Array<VFileMessage>;
  54. /**
  55. * Raw value.
  56. *
  57. * @type {Value}
  58. */
  59. value: Value;
  60. /**
  61. * Source map.
  62. *
  63. * This type is equivalent to the `RawSourceMap` type from the `source-map`
  64. * module.
  65. *
  66. * @type {Map | null | undefined}
  67. */
  68. map: Map | null | undefined;
  69. /**
  70. * Custom, non-string, compiled, representation.
  71. *
  72. * This is used by unified to store non-string results.
  73. * One example is when turning markdown into React nodes.
  74. *
  75. * @type {unknown}
  76. */
  77. result: unknown;
  78. /**
  79. * Whether a file was saved to disk.
  80. *
  81. * This is used by vfile reporters.
  82. *
  83. * @type {boolean}
  84. */
  85. stored: boolean;
  86. /**
  87. * Set basename (including extname) (`'index.min.js'`).
  88. *
  89. * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
  90. * on windows).
  91. * Cannot be nullified (use `file.path = file.dirname` instead).
  92. *
  93. * @param {string} basename
  94. * Basename.
  95. * @returns {undefined}
  96. * Nothing.
  97. */
  98. set basename(basename: string);
  99. /**
  100. * Get the basename (including extname) (example: `'index.min.js'`).
  101. *
  102. * @returns {string | undefined}
  103. * Basename.
  104. */
  105. get basename(): string | undefined;
  106. /**
  107. * Set the full path (example: `'~/index.min.js'`).
  108. *
  109. * Cannot be nullified.
  110. * You can set a file URL (a `URL` object with a `file:` protocol) which will
  111. * be turned into a path with `url.fileURLToPath`.
  112. *
  113. * @param {URL | string} path
  114. * Path.
  115. * @returns {undefined}
  116. * Nothing.
  117. */
  118. set path(path: string | URL);
  119. /**
  120. * Get the full path (example: `'~/index.min.js'`).
  121. *
  122. * @returns {string}
  123. * Path.
  124. */
  125. get path(): string;
  126. /**
  127. * Set the parent path (example: `'~'`).
  128. *
  129. * Cannot be set if there’s no `path` yet.
  130. *
  131. * @param {string | undefined} dirname
  132. * Dirname.
  133. * @returns {undefined}
  134. * Nothing.
  135. */
  136. set dirname(dirname: string | undefined);
  137. /**
  138. * Get the parent path (example: `'~'`).
  139. *
  140. * @returns {string | undefined}
  141. * Dirname.
  142. */
  143. get dirname(): string | undefined;
  144. /**
  145. * Set the extname (including dot) (example: `'.js'`).
  146. *
  147. * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
  148. * on windows).
  149. * Cannot be set if there’s no `path` yet.
  150. *
  151. * @param {string | undefined} extname
  152. * Extname.
  153. * @returns {undefined}
  154. * Nothing.
  155. */
  156. set extname(extname: string | undefined);
  157. /**
  158. * Get the extname (including dot) (example: `'.js'`).
  159. *
  160. * @returns {string | undefined}
  161. * Extname.
  162. */
  163. get extname(): string | undefined;
  164. /**
  165. * Set the stem (basename w/o extname) (example: `'index.min'`).
  166. *
  167. * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
  168. * on windows).
  169. * Cannot be nullified (use `file.path = file.dirname` instead).
  170. *
  171. * @param {string} stem
  172. * Stem.
  173. * @returns {undefined}
  174. * Nothing.
  175. */
  176. set stem(stem: string);
  177. /**
  178. * Get the stem (basename w/o extname) (example: `'index.min'`).
  179. *
  180. * @returns {string | undefined}
  181. * Stem.
  182. */
  183. get stem(): string | undefined;
  184. /**
  185. * Create a fatal message for `reason` associated with the file.
  186. *
  187. * The `fatal` field of the message is set to `true` (error; file not usable)
  188. * and the `file` field is set to the current file path.
  189. * The message is added to the `messages` field on `file`.
  190. *
  191. * > 🪦 **Note**: also has obsolete signatures.
  192. *
  193. * @overload
  194. * @param {string} reason
  195. * @param {MessageOptions | null | undefined} [options]
  196. * @returns {never}
  197. *
  198. * @overload
  199. * @param {string} reason
  200. * @param {Node | NodeLike | null | undefined} parent
  201. * @param {string | null | undefined} [origin]
  202. * @returns {never}
  203. *
  204. * @overload
  205. * @param {string} reason
  206. * @param {Point | Position | null | undefined} place
  207. * @param {string | null | undefined} [origin]
  208. * @returns {never}
  209. *
  210. * @overload
  211. * @param {string} reason
  212. * @param {string | null | undefined} [origin]
  213. * @returns {never}
  214. *
  215. * @overload
  216. * @param {Error | VFileMessage} cause
  217. * @param {Node | NodeLike | null | undefined} parent
  218. * @param {string | null | undefined} [origin]
  219. * @returns {never}
  220. *
  221. * @overload
  222. * @param {Error | VFileMessage} cause
  223. * @param {Point | Position | null | undefined} place
  224. * @param {string | null | undefined} [origin]
  225. * @returns {never}
  226. *
  227. * @overload
  228. * @param {Error | VFileMessage} cause
  229. * @param {string | null | undefined} [origin]
  230. * @returns {never}
  231. *
  232. * @param {Error | VFileMessage | string} causeOrReason
  233. * Reason for message, should use markdown.
  234. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  235. * Configuration (optional).
  236. * @param {string | null | undefined} [origin]
  237. * Place in code where the message originates (example:
  238. * `'my-package:my-rule'` or `'my-rule'`).
  239. * @returns {never}
  240. * Never.
  241. * @throws {VFileMessage}
  242. * Message.
  243. */
  244. fail(reason: string, options?: MessageOptions | null | undefined): never;
  245. /**
  246. * Create a fatal message for `reason` associated with the file.
  247. *
  248. * The `fatal` field of the message is set to `true` (error; file not usable)
  249. * and the `file` field is set to the current file path.
  250. * The message is added to the `messages` field on `file`.
  251. *
  252. * > 🪦 **Note**: also has obsolete signatures.
  253. *
  254. * @overload
  255. * @param {string} reason
  256. * @param {MessageOptions | null | undefined} [options]
  257. * @returns {never}
  258. *
  259. * @overload
  260. * @param {string} reason
  261. * @param {Node | NodeLike | null | undefined} parent
  262. * @param {string | null | undefined} [origin]
  263. * @returns {never}
  264. *
  265. * @overload
  266. * @param {string} reason
  267. * @param {Point | Position | null | undefined} place
  268. * @param {string | null | undefined} [origin]
  269. * @returns {never}
  270. *
  271. * @overload
  272. * @param {string} reason
  273. * @param {string | null | undefined} [origin]
  274. * @returns {never}
  275. *
  276. * @overload
  277. * @param {Error | VFileMessage} cause
  278. * @param {Node | NodeLike | null | undefined} parent
  279. * @param {string | null | undefined} [origin]
  280. * @returns {never}
  281. *
  282. * @overload
  283. * @param {Error | VFileMessage} cause
  284. * @param {Point | Position | null | undefined} place
  285. * @param {string | null | undefined} [origin]
  286. * @returns {never}
  287. *
  288. * @overload
  289. * @param {Error | VFileMessage} cause
  290. * @param {string | null | undefined} [origin]
  291. * @returns {never}
  292. *
  293. * @param {Error | VFileMessage | string} causeOrReason
  294. * Reason for message, should use markdown.
  295. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  296. * Configuration (optional).
  297. * @param {string | null | undefined} [origin]
  298. * Place in code where the message originates (example:
  299. * `'my-package:my-rule'` or `'my-rule'`).
  300. * @returns {never}
  301. * Never.
  302. * @throws {VFileMessage}
  303. * Message.
  304. */
  305. fail(reason: string, parent: Node | NodeLike | null | undefined, origin?: string | null | undefined): never;
  306. /**
  307. * Create a fatal message for `reason` associated with the file.
  308. *
  309. * The `fatal` field of the message is set to `true` (error; file not usable)
  310. * and the `file` field is set to the current file path.
  311. * The message is added to the `messages` field on `file`.
  312. *
  313. * > 🪦 **Note**: also has obsolete signatures.
  314. *
  315. * @overload
  316. * @param {string} reason
  317. * @param {MessageOptions | null | undefined} [options]
  318. * @returns {never}
  319. *
  320. * @overload
  321. * @param {string} reason
  322. * @param {Node | NodeLike | null | undefined} parent
  323. * @param {string | null | undefined} [origin]
  324. * @returns {never}
  325. *
  326. * @overload
  327. * @param {string} reason
  328. * @param {Point | Position | null | undefined} place
  329. * @param {string | null | undefined} [origin]
  330. * @returns {never}
  331. *
  332. * @overload
  333. * @param {string} reason
  334. * @param {string | null | undefined} [origin]
  335. * @returns {never}
  336. *
  337. * @overload
  338. * @param {Error | VFileMessage} cause
  339. * @param {Node | NodeLike | null | undefined} parent
  340. * @param {string | null | undefined} [origin]
  341. * @returns {never}
  342. *
  343. * @overload
  344. * @param {Error | VFileMessage} cause
  345. * @param {Point | Position | null | undefined} place
  346. * @param {string | null | undefined} [origin]
  347. * @returns {never}
  348. *
  349. * @overload
  350. * @param {Error | VFileMessage} cause
  351. * @param {string | null | undefined} [origin]
  352. * @returns {never}
  353. *
  354. * @param {Error | VFileMessage | string} causeOrReason
  355. * Reason for message, should use markdown.
  356. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  357. * Configuration (optional).
  358. * @param {string | null | undefined} [origin]
  359. * Place in code where the message originates (example:
  360. * `'my-package:my-rule'` or `'my-rule'`).
  361. * @returns {never}
  362. * Never.
  363. * @throws {VFileMessage}
  364. * Message.
  365. */
  366. fail(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined): never;
  367. /**
  368. * Create a fatal message for `reason` associated with the file.
  369. *
  370. * The `fatal` field of the message is set to `true` (error; file not usable)
  371. * and the `file` field is set to the current file path.
  372. * The message is added to the `messages` field on `file`.
  373. *
  374. * > 🪦 **Note**: also has obsolete signatures.
  375. *
  376. * @overload
  377. * @param {string} reason
  378. * @param {MessageOptions | null | undefined} [options]
  379. * @returns {never}
  380. *
  381. * @overload
  382. * @param {string} reason
  383. * @param {Node | NodeLike | null | undefined} parent
  384. * @param {string | null | undefined} [origin]
  385. * @returns {never}
  386. *
  387. * @overload
  388. * @param {string} reason
  389. * @param {Point | Position | null | undefined} place
  390. * @param {string | null | undefined} [origin]
  391. * @returns {never}
  392. *
  393. * @overload
  394. * @param {string} reason
  395. * @param {string | null | undefined} [origin]
  396. * @returns {never}
  397. *
  398. * @overload
  399. * @param {Error | VFileMessage} cause
  400. * @param {Node | NodeLike | null | undefined} parent
  401. * @param {string | null | undefined} [origin]
  402. * @returns {never}
  403. *
  404. * @overload
  405. * @param {Error | VFileMessage} cause
  406. * @param {Point | Position | null | undefined} place
  407. * @param {string | null | undefined} [origin]
  408. * @returns {never}
  409. *
  410. * @overload
  411. * @param {Error | VFileMessage} cause
  412. * @param {string | null | undefined} [origin]
  413. * @returns {never}
  414. *
  415. * @param {Error | VFileMessage | string} causeOrReason
  416. * Reason for message, should use markdown.
  417. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  418. * Configuration (optional).
  419. * @param {string | null | undefined} [origin]
  420. * Place in code where the message originates (example:
  421. * `'my-package:my-rule'` or `'my-rule'`).
  422. * @returns {never}
  423. * Never.
  424. * @throws {VFileMessage}
  425. * Message.
  426. */
  427. fail(reason: string, origin?: string | null | undefined): never;
  428. /**
  429. * Create a fatal message for `reason` associated with the file.
  430. *
  431. * The `fatal` field of the message is set to `true` (error; file not usable)
  432. * and the `file` field is set to the current file path.
  433. * The message is added to the `messages` field on `file`.
  434. *
  435. * > 🪦 **Note**: also has obsolete signatures.
  436. *
  437. * @overload
  438. * @param {string} reason
  439. * @param {MessageOptions | null | undefined} [options]
  440. * @returns {never}
  441. *
  442. * @overload
  443. * @param {string} reason
  444. * @param {Node | NodeLike | null | undefined} parent
  445. * @param {string | null | undefined} [origin]
  446. * @returns {never}
  447. *
  448. * @overload
  449. * @param {string} reason
  450. * @param {Point | Position | null | undefined} place
  451. * @param {string | null | undefined} [origin]
  452. * @returns {never}
  453. *
  454. * @overload
  455. * @param {string} reason
  456. * @param {string | null | undefined} [origin]
  457. * @returns {never}
  458. *
  459. * @overload
  460. * @param {Error | VFileMessage} cause
  461. * @param {Node | NodeLike | null | undefined} parent
  462. * @param {string | null | undefined} [origin]
  463. * @returns {never}
  464. *
  465. * @overload
  466. * @param {Error | VFileMessage} cause
  467. * @param {Point | Position | null | undefined} place
  468. * @param {string | null | undefined} [origin]
  469. * @returns {never}
  470. *
  471. * @overload
  472. * @param {Error | VFileMessage} cause
  473. * @param {string | null | undefined} [origin]
  474. * @returns {never}
  475. *
  476. * @param {Error | VFileMessage | string} causeOrReason
  477. * Reason for message, should use markdown.
  478. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  479. * Configuration (optional).
  480. * @param {string | null | undefined} [origin]
  481. * Place in code where the message originates (example:
  482. * `'my-package:my-rule'` or `'my-rule'`).
  483. * @returns {never}
  484. * Never.
  485. * @throws {VFileMessage}
  486. * Message.
  487. */
  488. fail(cause: Error | VFileMessage, parent: Node | NodeLike | null | undefined, origin?: string | null | undefined): never;
  489. /**
  490. * Create a fatal message for `reason` associated with the file.
  491. *
  492. * The `fatal` field of the message is set to `true` (error; file not usable)
  493. * and the `file` field is set to the current file path.
  494. * The message is added to the `messages` field on `file`.
  495. *
  496. * > 🪦 **Note**: also has obsolete signatures.
  497. *
  498. * @overload
  499. * @param {string} reason
  500. * @param {MessageOptions | null | undefined} [options]
  501. * @returns {never}
  502. *
  503. * @overload
  504. * @param {string} reason
  505. * @param {Node | NodeLike | null | undefined} parent
  506. * @param {string | null | undefined} [origin]
  507. * @returns {never}
  508. *
  509. * @overload
  510. * @param {string} reason
  511. * @param {Point | Position | null | undefined} place
  512. * @param {string | null | undefined} [origin]
  513. * @returns {never}
  514. *
  515. * @overload
  516. * @param {string} reason
  517. * @param {string | null | undefined} [origin]
  518. * @returns {never}
  519. *
  520. * @overload
  521. * @param {Error | VFileMessage} cause
  522. * @param {Node | NodeLike | null | undefined} parent
  523. * @param {string | null | undefined} [origin]
  524. * @returns {never}
  525. *
  526. * @overload
  527. * @param {Error | VFileMessage} cause
  528. * @param {Point | Position | null | undefined} place
  529. * @param {string | null | undefined} [origin]
  530. * @returns {never}
  531. *
  532. * @overload
  533. * @param {Error | VFileMessage} cause
  534. * @param {string | null | undefined} [origin]
  535. * @returns {never}
  536. *
  537. * @param {Error | VFileMessage | string} causeOrReason
  538. * Reason for message, should use markdown.
  539. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  540. * Configuration (optional).
  541. * @param {string | null | undefined} [origin]
  542. * Place in code where the message originates (example:
  543. * `'my-package:my-rule'` or `'my-rule'`).
  544. * @returns {never}
  545. * Never.
  546. * @throws {VFileMessage}
  547. * Message.
  548. */
  549. fail(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined): never;
  550. /**
  551. * Create a fatal message for `reason` associated with the file.
  552. *
  553. * The `fatal` field of the message is set to `true` (error; file not usable)
  554. * and the `file` field is set to the current file path.
  555. * The message is added to the `messages` field on `file`.
  556. *
  557. * > 🪦 **Note**: also has obsolete signatures.
  558. *
  559. * @overload
  560. * @param {string} reason
  561. * @param {MessageOptions | null | undefined} [options]
  562. * @returns {never}
  563. *
  564. * @overload
  565. * @param {string} reason
  566. * @param {Node | NodeLike | null | undefined} parent
  567. * @param {string | null | undefined} [origin]
  568. * @returns {never}
  569. *
  570. * @overload
  571. * @param {string} reason
  572. * @param {Point | Position | null | undefined} place
  573. * @param {string | null | undefined} [origin]
  574. * @returns {never}
  575. *
  576. * @overload
  577. * @param {string} reason
  578. * @param {string | null | undefined} [origin]
  579. * @returns {never}
  580. *
  581. * @overload
  582. * @param {Error | VFileMessage} cause
  583. * @param {Node | NodeLike | null | undefined} parent
  584. * @param {string | null | undefined} [origin]
  585. * @returns {never}
  586. *
  587. * @overload
  588. * @param {Error | VFileMessage} cause
  589. * @param {Point | Position | null | undefined} place
  590. * @param {string | null | undefined} [origin]
  591. * @returns {never}
  592. *
  593. * @overload
  594. * @param {Error | VFileMessage} cause
  595. * @param {string | null | undefined} [origin]
  596. * @returns {never}
  597. *
  598. * @param {Error | VFileMessage | string} causeOrReason
  599. * Reason for message, should use markdown.
  600. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  601. * Configuration (optional).
  602. * @param {string | null | undefined} [origin]
  603. * Place in code where the message originates (example:
  604. * `'my-package:my-rule'` or `'my-rule'`).
  605. * @returns {never}
  606. * Never.
  607. * @throws {VFileMessage}
  608. * Message.
  609. */
  610. fail(cause: Error | VFileMessage, origin?: string | null | undefined): never;
  611. /**
  612. * Create an info message for `reason` associated with the file.
  613. *
  614. * The `fatal` field of the message is set to `undefined` (info; change
  615. * likely not needed) and the `file` field is set to the current file path.
  616. * The message is added to the `messages` field on `file`.
  617. *
  618. * > 🪦 **Note**: also has obsolete signatures.
  619. *
  620. * @overload
  621. * @param {string} reason
  622. * @param {MessageOptions | null | undefined} [options]
  623. * @returns {VFileMessage}
  624. *
  625. * @overload
  626. * @param {string} reason
  627. * @param {Node | NodeLike | null | undefined} parent
  628. * @param {string | null | undefined} [origin]
  629. * @returns {VFileMessage}
  630. *
  631. * @overload
  632. * @param {string} reason
  633. * @param {Point | Position | null | undefined} place
  634. * @param {string | null | undefined} [origin]
  635. * @returns {VFileMessage}
  636. *
  637. * @overload
  638. * @param {string} reason
  639. * @param {string | null | undefined} [origin]
  640. * @returns {VFileMessage}
  641. *
  642. * @overload
  643. * @param {Error | VFileMessage} cause
  644. * @param {Node | NodeLike | null | undefined} parent
  645. * @param {string | null | undefined} [origin]
  646. * @returns {VFileMessage}
  647. *
  648. * @overload
  649. * @param {Error | VFileMessage} cause
  650. * @param {Point | Position | null | undefined} place
  651. * @param {string | null | undefined} [origin]
  652. * @returns {VFileMessage}
  653. *
  654. * @overload
  655. * @param {Error | VFileMessage} cause
  656. * @param {string | null | undefined} [origin]
  657. * @returns {VFileMessage}
  658. *
  659. * @param {Error | VFileMessage | string} causeOrReason
  660. * Reason for message, should use markdown.
  661. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  662. * Configuration (optional).
  663. * @param {string | null | undefined} [origin]
  664. * Place in code where the message originates (example:
  665. * `'my-package:my-rule'` or `'my-rule'`).
  666. * @returns {VFileMessage}
  667. * Message.
  668. */
  669. info(reason: string, options?: MessageOptions | null | undefined): VFileMessage;
  670. /**
  671. * Create an info message for `reason` associated with the file.
  672. *
  673. * The `fatal` field of the message is set to `undefined` (info; change
  674. * likely not needed) and the `file` field is set to the current file path.
  675. * The message is added to the `messages` field on `file`.
  676. *
  677. * > 🪦 **Note**: also has obsolete signatures.
  678. *
  679. * @overload
  680. * @param {string} reason
  681. * @param {MessageOptions | null | undefined} [options]
  682. * @returns {VFileMessage}
  683. *
  684. * @overload
  685. * @param {string} reason
  686. * @param {Node | NodeLike | null | undefined} parent
  687. * @param {string | null | undefined} [origin]
  688. * @returns {VFileMessage}
  689. *
  690. * @overload
  691. * @param {string} reason
  692. * @param {Point | Position | null | undefined} place
  693. * @param {string | null | undefined} [origin]
  694. * @returns {VFileMessage}
  695. *
  696. * @overload
  697. * @param {string} reason
  698. * @param {string | null | undefined} [origin]
  699. * @returns {VFileMessage}
  700. *
  701. * @overload
  702. * @param {Error | VFileMessage} cause
  703. * @param {Node | NodeLike | null | undefined} parent
  704. * @param {string | null | undefined} [origin]
  705. * @returns {VFileMessage}
  706. *
  707. * @overload
  708. * @param {Error | VFileMessage} cause
  709. * @param {Point | Position | null | undefined} place
  710. * @param {string | null | undefined} [origin]
  711. * @returns {VFileMessage}
  712. *
  713. * @overload
  714. * @param {Error | VFileMessage} cause
  715. * @param {string | null | undefined} [origin]
  716. * @returns {VFileMessage}
  717. *
  718. * @param {Error | VFileMessage | string} causeOrReason
  719. * Reason for message, should use markdown.
  720. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  721. * Configuration (optional).
  722. * @param {string | null | undefined} [origin]
  723. * Place in code where the message originates (example:
  724. * `'my-package:my-rule'` or `'my-rule'`).
  725. * @returns {VFileMessage}
  726. * Message.
  727. */
  728. info(reason: string, parent: Node | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
  729. /**
  730. * Create an info message for `reason` associated with the file.
  731. *
  732. * The `fatal` field of the message is set to `undefined` (info; change
  733. * likely not needed) and the `file` field is set to the current file path.
  734. * The message is added to the `messages` field on `file`.
  735. *
  736. * > 🪦 **Note**: also has obsolete signatures.
  737. *
  738. * @overload
  739. * @param {string} reason
  740. * @param {MessageOptions | null | undefined} [options]
  741. * @returns {VFileMessage}
  742. *
  743. * @overload
  744. * @param {string} reason
  745. * @param {Node | NodeLike | null | undefined} parent
  746. * @param {string | null | undefined} [origin]
  747. * @returns {VFileMessage}
  748. *
  749. * @overload
  750. * @param {string} reason
  751. * @param {Point | Position | null | undefined} place
  752. * @param {string | null | undefined} [origin]
  753. * @returns {VFileMessage}
  754. *
  755. * @overload
  756. * @param {string} reason
  757. * @param {string | null | undefined} [origin]
  758. * @returns {VFileMessage}
  759. *
  760. * @overload
  761. * @param {Error | VFileMessage} cause
  762. * @param {Node | NodeLike | null | undefined} parent
  763. * @param {string | null | undefined} [origin]
  764. * @returns {VFileMessage}
  765. *
  766. * @overload
  767. * @param {Error | VFileMessage} cause
  768. * @param {Point | Position | null | undefined} place
  769. * @param {string | null | undefined} [origin]
  770. * @returns {VFileMessage}
  771. *
  772. * @overload
  773. * @param {Error | VFileMessage} cause
  774. * @param {string | null | undefined} [origin]
  775. * @returns {VFileMessage}
  776. *
  777. * @param {Error | VFileMessage | string} causeOrReason
  778. * Reason for message, should use markdown.
  779. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  780. * Configuration (optional).
  781. * @param {string | null | undefined} [origin]
  782. * Place in code where the message originates (example:
  783. * `'my-package:my-rule'` or `'my-rule'`).
  784. * @returns {VFileMessage}
  785. * Message.
  786. */
  787. info(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
  788. /**
  789. * Create an info message for `reason` associated with the file.
  790. *
  791. * The `fatal` field of the message is set to `undefined` (info; change
  792. * likely not needed) and the `file` field is set to the current file path.
  793. * The message is added to the `messages` field on `file`.
  794. *
  795. * > 🪦 **Note**: also has obsolete signatures.
  796. *
  797. * @overload
  798. * @param {string} reason
  799. * @param {MessageOptions | null | undefined} [options]
  800. * @returns {VFileMessage}
  801. *
  802. * @overload
  803. * @param {string} reason
  804. * @param {Node | NodeLike | null | undefined} parent
  805. * @param {string | null | undefined} [origin]
  806. * @returns {VFileMessage}
  807. *
  808. * @overload
  809. * @param {string} reason
  810. * @param {Point | Position | null | undefined} place
  811. * @param {string | null | undefined} [origin]
  812. * @returns {VFileMessage}
  813. *
  814. * @overload
  815. * @param {string} reason
  816. * @param {string | null | undefined} [origin]
  817. * @returns {VFileMessage}
  818. *
  819. * @overload
  820. * @param {Error | VFileMessage} cause
  821. * @param {Node | NodeLike | null | undefined} parent
  822. * @param {string | null | undefined} [origin]
  823. * @returns {VFileMessage}
  824. *
  825. * @overload
  826. * @param {Error | VFileMessage} cause
  827. * @param {Point | Position | null | undefined} place
  828. * @param {string | null | undefined} [origin]
  829. * @returns {VFileMessage}
  830. *
  831. * @overload
  832. * @param {Error | VFileMessage} cause
  833. * @param {string | null | undefined} [origin]
  834. * @returns {VFileMessage}
  835. *
  836. * @param {Error | VFileMessage | string} causeOrReason
  837. * Reason for message, should use markdown.
  838. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  839. * Configuration (optional).
  840. * @param {string | null | undefined} [origin]
  841. * Place in code where the message originates (example:
  842. * `'my-package:my-rule'` or `'my-rule'`).
  843. * @returns {VFileMessage}
  844. * Message.
  845. */
  846. info(reason: string, origin?: string | null | undefined): VFileMessage;
  847. /**
  848. * Create an info message for `reason` associated with the file.
  849. *
  850. * The `fatal` field of the message is set to `undefined` (info; change
  851. * likely not needed) and the `file` field is set to the current file path.
  852. * The message is added to the `messages` field on `file`.
  853. *
  854. * > 🪦 **Note**: also has obsolete signatures.
  855. *
  856. * @overload
  857. * @param {string} reason
  858. * @param {MessageOptions | null | undefined} [options]
  859. * @returns {VFileMessage}
  860. *
  861. * @overload
  862. * @param {string} reason
  863. * @param {Node | NodeLike | null | undefined} parent
  864. * @param {string | null | undefined} [origin]
  865. * @returns {VFileMessage}
  866. *
  867. * @overload
  868. * @param {string} reason
  869. * @param {Point | Position | null | undefined} place
  870. * @param {string | null | undefined} [origin]
  871. * @returns {VFileMessage}
  872. *
  873. * @overload
  874. * @param {string} reason
  875. * @param {string | null | undefined} [origin]
  876. * @returns {VFileMessage}
  877. *
  878. * @overload
  879. * @param {Error | VFileMessage} cause
  880. * @param {Node | NodeLike | null | undefined} parent
  881. * @param {string | null | undefined} [origin]
  882. * @returns {VFileMessage}
  883. *
  884. * @overload
  885. * @param {Error | VFileMessage} cause
  886. * @param {Point | Position | null | undefined} place
  887. * @param {string | null | undefined} [origin]
  888. * @returns {VFileMessage}
  889. *
  890. * @overload
  891. * @param {Error | VFileMessage} cause
  892. * @param {string | null | undefined} [origin]
  893. * @returns {VFileMessage}
  894. *
  895. * @param {Error | VFileMessage | string} causeOrReason
  896. * Reason for message, should use markdown.
  897. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  898. * Configuration (optional).
  899. * @param {string | null | undefined} [origin]
  900. * Place in code where the message originates (example:
  901. * `'my-package:my-rule'` or `'my-rule'`).
  902. * @returns {VFileMessage}
  903. * Message.
  904. */
  905. info(cause: Error | VFileMessage, parent: Node | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
  906. /**
  907. * Create an info message for `reason` associated with the file.
  908. *
  909. * The `fatal` field of the message is set to `undefined` (info; change
  910. * likely not needed) and the `file` field is set to the current file path.
  911. * The message is added to the `messages` field on `file`.
  912. *
  913. * > 🪦 **Note**: also has obsolete signatures.
  914. *
  915. * @overload
  916. * @param {string} reason
  917. * @param {MessageOptions | null | undefined} [options]
  918. * @returns {VFileMessage}
  919. *
  920. * @overload
  921. * @param {string} reason
  922. * @param {Node | NodeLike | null | undefined} parent
  923. * @param {string | null | undefined} [origin]
  924. * @returns {VFileMessage}
  925. *
  926. * @overload
  927. * @param {string} reason
  928. * @param {Point | Position | null | undefined} place
  929. * @param {string | null | undefined} [origin]
  930. * @returns {VFileMessage}
  931. *
  932. * @overload
  933. * @param {string} reason
  934. * @param {string | null | undefined} [origin]
  935. * @returns {VFileMessage}
  936. *
  937. * @overload
  938. * @param {Error | VFileMessage} cause
  939. * @param {Node | NodeLike | null | undefined} parent
  940. * @param {string | null | undefined} [origin]
  941. * @returns {VFileMessage}
  942. *
  943. * @overload
  944. * @param {Error | VFileMessage} cause
  945. * @param {Point | Position | null | undefined} place
  946. * @param {string | null | undefined} [origin]
  947. * @returns {VFileMessage}
  948. *
  949. * @overload
  950. * @param {Error | VFileMessage} cause
  951. * @param {string | null | undefined} [origin]
  952. * @returns {VFileMessage}
  953. *
  954. * @param {Error | VFileMessage | string} causeOrReason
  955. * Reason for message, should use markdown.
  956. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  957. * Configuration (optional).
  958. * @param {string | null | undefined} [origin]
  959. * Place in code where the message originates (example:
  960. * `'my-package:my-rule'` or `'my-rule'`).
  961. * @returns {VFileMessage}
  962. * Message.
  963. */
  964. info(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
  965. /**
  966. * Create an info message for `reason` associated with the file.
  967. *
  968. * The `fatal` field of the message is set to `undefined` (info; change
  969. * likely not needed) and the `file` field is set to the current file path.
  970. * The message is added to the `messages` field on `file`.
  971. *
  972. * > 🪦 **Note**: also has obsolete signatures.
  973. *
  974. * @overload
  975. * @param {string} reason
  976. * @param {MessageOptions | null | undefined} [options]
  977. * @returns {VFileMessage}
  978. *
  979. * @overload
  980. * @param {string} reason
  981. * @param {Node | NodeLike | null | undefined} parent
  982. * @param {string | null | undefined} [origin]
  983. * @returns {VFileMessage}
  984. *
  985. * @overload
  986. * @param {string} reason
  987. * @param {Point | Position | null | undefined} place
  988. * @param {string | null | undefined} [origin]
  989. * @returns {VFileMessage}
  990. *
  991. * @overload
  992. * @param {string} reason
  993. * @param {string | null | undefined} [origin]
  994. * @returns {VFileMessage}
  995. *
  996. * @overload
  997. * @param {Error | VFileMessage} cause
  998. * @param {Node | NodeLike | null | undefined} parent
  999. * @param {string | null | undefined} [origin]
  1000. * @returns {VFileMessage}
  1001. *
  1002. * @overload
  1003. * @param {Error | VFileMessage} cause
  1004. * @param {Point | Position | null | undefined} place
  1005. * @param {string | null | undefined} [origin]
  1006. * @returns {VFileMessage}
  1007. *
  1008. * @overload
  1009. * @param {Error | VFileMessage} cause
  1010. * @param {string | null | undefined} [origin]
  1011. * @returns {VFileMessage}
  1012. *
  1013. * @param {Error | VFileMessage | string} causeOrReason
  1014. * Reason for message, should use markdown.
  1015. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1016. * Configuration (optional).
  1017. * @param {string | null | undefined} [origin]
  1018. * Place in code where the message originates (example:
  1019. * `'my-package:my-rule'` or `'my-rule'`).
  1020. * @returns {VFileMessage}
  1021. * Message.
  1022. */
  1023. info(cause: Error | VFileMessage, origin?: string | null | undefined): VFileMessage;
  1024. /**
  1025. * Create a message for `reason` associated with the file.
  1026. *
  1027. * The `fatal` field of the message is set to `false` (warning; change may be
  1028. * needed) and the `file` field is set to the current file path.
  1029. * The message is added to the `messages` field on `file`.
  1030. *
  1031. * > 🪦 **Note**: also has obsolete signatures.
  1032. *
  1033. * @overload
  1034. * @param {string} reason
  1035. * @param {MessageOptions | null | undefined} [options]
  1036. * @returns {VFileMessage}
  1037. *
  1038. * @overload
  1039. * @param {string} reason
  1040. * @param {Node | NodeLike | null | undefined} parent
  1041. * @param {string | null | undefined} [origin]
  1042. * @returns {VFileMessage}
  1043. *
  1044. * @overload
  1045. * @param {string} reason
  1046. * @param {Point | Position | null | undefined} place
  1047. * @param {string | null | undefined} [origin]
  1048. * @returns {VFileMessage}
  1049. *
  1050. * @overload
  1051. * @param {string} reason
  1052. * @param {string | null | undefined} [origin]
  1053. * @returns {VFileMessage}
  1054. *
  1055. * @overload
  1056. * @param {Error | VFileMessage} cause
  1057. * @param {Node | NodeLike | null | undefined} parent
  1058. * @param {string | null | undefined} [origin]
  1059. * @returns {VFileMessage}
  1060. *
  1061. * @overload
  1062. * @param {Error | VFileMessage} cause
  1063. * @param {Point | Position | null | undefined} place
  1064. * @param {string | null | undefined} [origin]
  1065. * @returns {VFileMessage}
  1066. *
  1067. * @overload
  1068. * @param {Error | VFileMessage} cause
  1069. * @param {string | null | undefined} [origin]
  1070. * @returns {VFileMessage}
  1071. *
  1072. * @param {Error | VFileMessage | string} causeOrReason
  1073. * Reason for message, should use markdown.
  1074. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1075. * Configuration (optional).
  1076. * @param {string | null | undefined} [origin]
  1077. * Place in code where the message originates (example:
  1078. * `'my-package:my-rule'` or `'my-rule'`).
  1079. * @returns {VFileMessage}
  1080. * Message.
  1081. */
  1082. message(reason: string, options?: MessageOptions | null | undefined): VFileMessage;
  1083. /**
  1084. * Create a message for `reason` associated with the file.
  1085. *
  1086. * The `fatal` field of the message is set to `false` (warning; change may be
  1087. * needed) and the `file` field is set to the current file path.
  1088. * The message is added to the `messages` field on `file`.
  1089. *
  1090. * > 🪦 **Note**: also has obsolete signatures.
  1091. *
  1092. * @overload
  1093. * @param {string} reason
  1094. * @param {MessageOptions | null | undefined} [options]
  1095. * @returns {VFileMessage}
  1096. *
  1097. * @overload
  1098. * @param {string} reason
  1099. * @param {Node | NodeLike | null | undefined} parent
  1100. * @param {string | null | undefined} [origin]
  1101. * @returns {VFileMessage}
  1102. *
  1103. * @overload
  1104. * @param {string} reason
  1105. * @param {Point | Position | null | undefined} place
  1106. * @param {string | null | undefined} [origin]
  1107. * @returns {VFileMessage}
  1108. *
  1109. * @overload
  1110. * @param {string} reason
  1111. * @param {string | null | undefined} [origin]
  1112. * @returns {VFileMessage}
  1113. *
  1114. * @overload
  1115. * @param {Error | VFileMessage} cause
  1116. * @param {Node | NodeLike | null | undefined} parent
  1117. * @param {string | null | undefined} [origin]
  1118. * @returns {VFileMessage}
  1119. *
  1120. * @overload
  1121. * @param {Error | VFileMessage} cause
  1122. * @param {Point | Position | null | undefined} place
  1123. * @param {string | null | undefined} [origin]
  1124. * @returns {VFileMessage}
  1125. *
  1126. * @overload
  1127. * @param {Error | VFileMessage} cause
  1128. * @param {string | null | undefined} [origin]
  1129. * @returns {VFileMessage}
  1130. *
  1131. * @param {Error | VFileMessage | string} causeOrReason
  1132. * Reason for message, should use markdown.
  1133. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1134. * Configuration (optional).
  1135. * @param {string | null | undefined} [origin]
  1136. * Place in code where the message originates (example:
  1137. * `'my-package:my-rule'` or `'my-rule'`).
  1138. * @returns {VFileMessage}
  1139. * Message.
  1140. */
  1141. message(reason: string, parent: Node | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
  1142. /**
  1143. * Create a message for `reason` associated with the file.
  1144. *
  1145. * The `fatal` field of the message is set to `false` (warning; change may be
  1146. * needed) and the `file` field is set to the current file path.
  1147. * The message is added to the `messages` field on `file`.
  1148. *
  1149. * > 🪦 **Note**: also has obsolete signatures.
  1150. *
  1151. * @overload
  1152. * @param {string} reason
  1153. * @param {MessageOptions | null | undefined} [options]
  1154. * @returns {VFileMessage}
  1155. *
  1156. * @overload
  1157. * @param {string} reason
  1158. * @param {Node | NodeLike | null | undefined} parent
  1159. * @param {string | null | undefined} [origin]
  1160. * @returns {VFileMessage}
  1161. *
  1162. * @overload
  1163. * @param {string} reason
  1164. * @param {Point | Position | null | undefined} place
  1165. * @param {string | null | undefined} [origin]
  1166. * @returns {VFileMessage}
  1167. *
  1168. * @overload
  1169. * @param {string} reason
  1170. * @param {string | null | undefined} [origin]
  1171. * @returns {VFileMessage}
  1172. *
  1173. * @overload
  1174. * @param {Error | VFileMessage} cause
  1175. * @param {Node | NodeLike | null | undefined} parent
  1176. * @param {string | null | undefined} [origin]
  1177. * @returns {VFileMessage}
  1178. *
  1179. * @overload
  1180. * @param {Error | VFileMessage} cause
  1181. * @param {Point | Position | null | undefined} place
  1182. * @param {string | null | undefined} [origin]
  1183. * @returns {VFileMessage}
  1184. *
  1185. * @overload
  1186. * @param {Error | VFileMessage} cause
  1187. * @param {string | null | undefined} [origin]
  1188. * @returns {VFileMessage}
  1189. *
  1190. * @param {Error | VFileMessage | string} causeOrReason
  1191. * Reason for message, should use markdown.
  1192. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1193. * Configuration (optional).
  1194. * @param {string | null | undefined} [origin]
  1195. * Place in code where the message originates (example:
  1196. * `'my-package:my-rule'` or `'my-rule'`).
  1197. * @returns {VFileMessage}
  1198. * Message.
  1199. */
  1200. message(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
  1201. /**
  1202. * Create a message for `reason` associated with the file.
  1203. *
  1204. * The `fatal` field of the message is set to `false` (warning; change may be
  1205. * needed) and the `file` field is set to the current file path.
  1206. * The message is added to the `messages` field on `file`.
  1207. *
  1208. * > 🪦 **Note**: also has obsolete signatures.
  1209. *
  1210. * @overload
  1211. * @param {string} reason
  1212. * @param {MessageOptions | null | undefined} [options]
  1213. * @returns {VFileMessage}
  1214. *
  1215. * @overload
  1216. * @param {string} reason
  1217. * @param {Node | NodeLike | null | undefined} parent
  1218. * @param {string | null | undefined} [origin]
  1219. * @returns {VFileMessage}
  1220. *
  1221. * @overload
  1222. * @param {string} reason
  1223. * @param {Point | Position | null | undefined} place
  1224. * @param {string | null | undefined} [origin]
  1225. * @returns {VFileMessage}
  1226. *
  1227. * @overload
  1228. * @param {string} reason
  1229. * @param {string | null | undefined} [origin]
  1230. * @returns {VFileMessage}
  1231. *
  1232. * @overload
  1233. * @param {Error | VFileMessage} cause
  1234. * @param {Node | NodeLike | null | undefined} parent
  1235. * @param {string | null | undefined} [origin]
  1236. * @returns {VFileMessage}
  1237. *
  1238. * @overload
  1239. * @param {Error | VFileMessage} cause
  1240. * @param {Point | Position | null | undefined} place
  1241. * @param {string | null | undefined} [origin]
  1242. * @returns {VFileMessage}
  1243. *
  1244. * @overload
  1245. * @param {Error | VFileMessage} cause
  1246. * @param {string | null | undefined} [origin]
  1247. * @returns {VFileMessage}
  1248. *
  1249. * @param {Error | VFileMessage | string} causeOrReason
  1250. * Reason for message, should use markdown.
  1251. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1252. * Configuration (optional).
  1253. * @param {string | null | undefined} [origin]
  1254. * Place in code where the message originates (example:
  1255. * `'my-package:my-rule'` or `'my-rule'`).
  1256. * @returns {VFileMessage}
  1257. * Message.
  1258. */
  1259. message(reason: string, origin?: string | null | undefined): VFileMessage;
  1260. /**
  1261. * Create a message for `reason` associated with the file.
  1262. *
  1263. * The `fatal` field of the message is set to `false` (warning; change may be
  1264. * needed) and the `file` field is set to the current file path.
  1265. * The message is added to the `messages` field on `file`.
  1266. *
  1267. * > 🪦 **Note**: also has obsolete signatures.
  1268. *
  1269. * @overload
  1270. * @param {string} reason
  1271. * @param {MessageOptions | null | undefined} [options]
  1272. * @returns {VFileMessage}
  1273. *
  1274. * @overload
  1275. * @param {string} reason
  1276. * @param {Node | NodeLike | null | undefined} parent
  1277. * @param {string | null | undefined} [origin]
  1278. * @returns {VFileMessage}
  1279. *
  1280. * @overload
  1281. * @param {string} reason
  1282. * @param {Point | Position | null | undefined} place
  1283. * @param {string | null | undefined} [origin]
  1284. * @returns {VFileMessage}
  1285. *
  1286. * @overload
  1287. * @param {string} reason
  1288. * @param {string | null | undefined} [origin]
  1289. * @returns {VFileMessage}
  1290. *
  1291. * @overload
  1292. * @param {Error | VFileMessage} cause
  1293. * @param {Node | NodeLike | null | undefined} parent
  1294. * @param {string | null | undefined} [origin]
  1295. * @returns {VFileMessage}
  1296. *
  1297. * @overload
  1298. * @param {Error | VFileMessage} cause
  1299. * @param {Point | Position | null | undefined} place
  1300. * @param {string | null | undefined} [origin]
  1301. * @returns {VFileMessage}
  1302. *
  1303. * @overload
  1304. * @param {Error | VFileMessage} cause
  1305. * @param {string | null | undefined} [origin]
  1306. * @returns {VFileMessage}
  1307. *
  1308. * @param {Error | VFileMessage | string} causeOrReason
  1309. * Reason for message, should use markdown.
  1310. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1311. * Configuration (optional).
  1312. * @param {string | null | undefined} [origin]
  1313. * Place in code where the message originates (example:
  1314. * `'my-package:my-rule'` or `'my-rule'`).
  1315. * @returns {VFileMessage}
  1316. * Message.
  1317. */
  1318. message(cause: Error | VFileMessage, parent: Node | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
  1319. /**
  1320. * Create a message for `reason` associated with the file.
  1321. *
  1322. * The `fatal` field of the message is set to `false` (warning; change may be
  1323. * needed) and the `file` field is set to the current file path.
  1324. * The message is added to the `messages` field on `file`.
  1325. *
  1326. * > 🪦 **Note**: also has obsolete signatures.
  1327. *
  1328. * @overload
  1329. * @param {string} reason
  1330. * @param {MessageOptions | null | undefined} [options]
  1331. * @returns {VFileMessage}
  1332. *
  1333. * @overload
  1334. * @param {string} reason
  1335. * @param {Node | NodeLike | null | undefined} parent
  1336. * @param {string | null | undefined} [origin]
  1337. * @returns {VFileMessage}
  1338. *
  1339. * @overload
  1340. * @param {string} reason
  1341. * @param {Point | Position | null | undefined} place
  1342. * @param {string | null | undefined} [origin]
  1343. * @returns {VFileMessage}
  1344. *
  1345. * @overload
  1346. * @param {string} reason
  1347. * @param {string | null | undefined} [origin]
  1348. * @returns {VFileMessage}
  1349. *
  1350. * @overload
  1351. * @param {Error | VFileMessage} cause
  1352. * @param {Node | NodeLike | null | undefined} parent
  1353. * @param {string | null | undefined} [origin]
  1354. * @returns {VFileMessage}
  1355. *
  1356. * @overload
  1357. * @param {Error | VFileMessage} cause
  1358. * @param {Point | Position | null | undefined} place
  1359. * @param {string | null | undefined} [origin]
  1360. * @returns {VFileMessage}
  1361. *
  1362. * @overload
  1363. * @param {Error | VFileMessage} cause
  1364. * @param {string | null | undefined} [origin]
  1365. * @returns {VFileMessage}
  1366. *
  1367. * @param {Error | VFileMessage | string} causeOrReason
  1368. * Reason for message, should use markdown.
  1369. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1370. * Configuration (optional).
  1371. * @param {string | null | undefined} [origin]
  1372. * Place in code where the message originates (example:
  1373. * `'my-package:my-rule'` or `'my-rule'`).
  1374. * @returns {VFileMessage}
  1375. * Message.
  1376. */
  1377. message(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
  1378. /**
  1379. * Create a message for `reason` associated with the file.
  1380. *
  1381. * The `fatal` field of the message is set to `false` (warning; change may be
  1382. * needed) and the `file` field is set to the current file path.
  1383. * The message is added to the `messages` field on `file`.
  1384. *
  1385. * > 🪦 **Note**: also has obsolete signatures.
  1386. *
  1387. * @overload
  1388. * @param {string} reason
  1389. * @param {MessageOptions | null | undefined} [options]
  1390. * @returns {VFileMessage}
  1391. *
  1392. * @overload
  1393. * @param {string} reason
  1394. * @param {Node | NodeLike | null | undefined} parent
  1395. * @param {string | null | undefined} [origin]
  1396. * @returns {VFileMessage}
  1397. *
  1398. * @overload
  1399. * @param {string} reason
  1400. * @param {Point | Position | null | undefined} place
  1401. * @param {string | null | undefined} [origin]
  1402. * @returns {VFileMessage}
  1403. *
  1404. * @overload
  1405. * @param {string} reason
  1406. * @param {string | null | undefined} [origin]
  1407. * @returns {VFileMessage}
  1408. *
  1409. * @overload
  1410. * @param {Error | VFileMessage} cause
  1411. * @param {Node | NodeLike | null | undefined} parent
  1412. * @param {string | null | undefined} [origin]
  1413. * @returns {VFileMessage}
  1414. *
  1415. * @overload
  1416. * @param {Error | VFileMessage} cause
  1417. * @param {Point | Position | null | undefined} place
  1418. * @param {string | null | undefined} [origin]
  1419. * @returns {VFileMessage}
  1420. *
  1421. * @overload
  1422. * @param {Error | VFileMessage} cause
  1423. * @param {string | null | undefined} [origin]
  1424. * @returns {VFileMessage}
  1425. *
  1426. * @param {Error | VFileMessage | string} causeOrReason
  1427. * Reason for message, should use markdown.
  1428. * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
  1429. * Configuration (optional).
  1430. * @param {string | null | undefined} [origin]
  1431. * Place in code where the message originates (example:
  1432. * `'my-package:my-rule'` or `'my-rule'`).
  1433. * @returns {VFileMessage}
  1434. * Message.
  1435. */
  1436. message(cause: Error | VFileMessage, origin?: string | null | undefined): VFileMessage;
  1437. /**
  1438. * Serialize the file.
  1439. *
  1440. * > **Note**: which encodings are supported depends on the engine.
  1441. * > For info on Node.js, see:
  1442. * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
  1443. *
  1444. * @param {string | null | undefined} [encoding='utf8']
  1445. * Character encoding to understand `value` as when it’s a `Uint8Array`
  1446. * (default: `'utf-8'`).
  1447. * @returns {string}
  1448. * Serialized file.
  1449. */
  1450. toString(encoding?: string | null | undefined): string;
  1451. }
  1452. export type NodeLike = object & {
  1453. type: string;
  1454. position?: Position | undefined;
  1455. };
  1456. import type { Data } from 'vfile';
  1457. import { VFileMessage } from 'vfile-message';
  1458. import type { Value } from 'vfile';
  1459. import type { Map } from 'vfile';
  1460. import type { Options as MessageOptions } from 'vfile-message';
  1461. import type { Node } from 'unist';
  1462. import type { Point } from 'unist';
  1463. import type { Position } from 'unist';
  1464. import type { Compatible } from 'vfile';
  1465. //# sourceMappingURL=index.d.ts.map