options.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /** @typedef {import("eslint").ESLint.Options} ESLintOptions */
  2. /** @typedef {import('eslint').ESLint.LintResult} LintResult */
  3. /** @typedef {import('eslint').ESLint.LintResultData} LintResultData */
  4. /**
  5. * @callback FormatterFunction
  6. * @param {LintResult[]} results
  7. * @param {LintResultData=} data
  8. * @returns {string}
  9. */
  10. /**
  11. * @typedef {Object} OutputReport
  12. * @property {string=} filePath
  13. * @property {string|FormatterFunction=} formatter
  14. */
  15. /**
  16. * @typedef {Object} PluginOptions
  17. * @property {string=} context
  18. * @property {boolean=} emitError
  19. * @property {boolean=} emitWarning
  20. * @property {string=} eslintPath
  21. * @property {string|string[]=} exclude
  22. * @property {string|string[]=} extensions
  23. * @property {boolean=} failOnError
  24. * @property {boolean=} failOnWarning
  25. * @property {string|string[]=} files
  26. * @property {boolean=} fix
  27. * @property {string|FormatterFunction=} formatter
  28. * @property {boolean=} lintDirtyModulesOnly
  29. * @property {boolean=} quiet
  30. * @property {OutputReport=} outputReport
  31. * @property {number|boolean=} threads
  32. */
  33. /** @typedef {PluginOptions & ESLintOptions} Options */
  34. /**
  35. * @param {Options} pluginOptions
  36. * @returns {PluginOptions}
  37. */
  38. export function getOptions(pluginOptions: Options): PluginOptions;
  39. /**
  40. * @param {Options} loaderOptions
  41. * @returns {ESLintOptions}
  42. */
  43. export function getESLintOptions(loaderOptions: Options): ESLintOptions;
  44. export type ESLintOptions = import('eslint').ESLint.Options;
  45. export type LintResult = import('eslint').ESLint.LintResult;
  46. export type LintResultData = import('eslint').ESLint.LintResultData;
  47. export type FormatterFunction = (
  48. results: LintResult[],
  49. data?: LintResultData | undefined
  50. ) => string;
  51. export type OutputReport = {
  52. filePath?: string | undefined;
  53. formatter?: (string | FormatterFunction) | undefined;
  54. };
  55. export type PluginOptions = {
  56. context?: string | undefined;
  57. emitError?: boolean | undefined;
  58. emitWarning?: boolean | undefined;
  59. eslintPath?: string | undefined;
  60. exclude?: (string | string[]) | undefined;
  61. extensions?: (string | string[]) | undefined;
  62. failOnError?: boolean | undefined;
  63. failOnWarning?: boolean | undefined;
  64. files?: (string | string[]) | undefined;
  65. fix?: boolean | undefined;
  66. formatter?: (string | FormatterFunction) | undefined;
  67. lintDirtyModulesOnly?: boolean | undefined;
  68. quiet?: boolean | undefined;
  69. outputReport?: OutputReport | undefined;
  70. threads?: (number | boolean) | undefined;
  71. };
  72. export type Options = PluginOptions & import('eslint').ESLint.Options;