index.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. interface InformativeDocsOptions {
  2. /**
  3. * Words that can be considered synonyms (aliases) of each other.
  4. *
  5. * @default
  6. * ```json
  7. * {
  8. * "a": ["an", "our"]
  9. * }
  10. * ```
  11. *
  12. * @example
  13. * With `{ aliases: { emoji: ["smiley", "winkey"] } }`,
  14. * the following comment would be considered uninformative:
  15. * ```js
  16. * /** Default smiley/winkey. *\/
  17. * export const defaultSmiley = "🙂";
  18. * ```
  19. */
  20. aliases?: Record<string, string[]>;
  21. /**
  22. * Words that are ignored when searching for one that adds meaning.
  23. *
  24. * @default
  25. * ```json
  26. * ["a", "an", "i", "in", "of", "s", "the"]
  27. * ```
  28. *
  29. * @example
  30. * With `{ uselessWords: ["our"] }`, the following comment would
  31. * be considered uninformative:
  32. * ```js
  33. * /** Our text. *\/
  34. * export const text = ":)";
  35. * ```
  36. */
  37. uselessWords?: string[];
  38. }
  39. /**
  40. * @param docs - Any amount of docs text, such as from a JSDoc description.
  41. * @param name - Name of the entity the docs text is describing.
  42. * @param options - Additional options to customize informativity checking.
  43. * @returns Whether the docs include at least one word with new information.
  44. *
  45. * @example
  46. * ```js
  47. * areDocsInformative("The user id.", "userId"); // false
  48. * ```
  49. * @example
  50. * ```js
  51. * areDocsInformative("Retrieved user id.", "userId"); // true
  52. * ```
  53. */
  54. declare function areDocsInformative(docs: string | string[], name: string | string[], { aliases, uselessWords, }?: InformativeDocsOptions): boolean;
  55. export { InformativeDocsOptions, areDocsInformative };