errors.cjs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const constants = require('../constants.cjs');
  5. class ConfigurationError extends Error {
  6. name = 'ConfigurationError';
  7. code = constants.EXIT_CODE_INVALID_CONFIG;
  8. /**
  9. * @param {string} message
  10. */
  11. constructor(message) {
  12. super(message);
  13. }
  14. }
  15. class AllFilesIgnoredError extends Error {
  16. name = 'AllFilesIgnoredError';
  17. constructor() {
  18. super(
  19. 'All input files were ignored because of the ignore pattern. Either change your input, ignore pattern or use "--allow-empty-input" to allow no inputs',
  20. );
  21. }
  22. }
  23. class NoFilesFoundError extends Error {
  24. name = 'NoFilesFoundError';
  25. /**
  26. * @param {string|string[]} fileList
  27. */
  28. constructor(fileList) {
  29. super();
  30. if (typeof fileList === 'string') {
  31. fileList = [fileList];
  32. }
  33. const pattern = fileList.filter((i) => !i.startsWith('!')).join(', ');
  34. this.message = `No files matching the pattern "${pattern}" were found.`;
  35. }
  36. }
  37. class SuppressionFileNotFoundError extends Error {
  38. name = 'SuppressionFileNotFoundError';
  39. code = constants.EXIT_CODE_INVALID_USAGE;
  40. constructor() {
  41. super(
  42. 'The suppressions file does not exist. Please run the command with "--suppress" or "--suppress=<rule>" to create it.',
  43. );
  44. }
  45. }
  46. exports.AllFilesIgnoredError = AllFilesIgnoredError;
  47. exports.ConfigurationError = ConfigurationError;
  48. exports.NoFilesFoundError = NoFilesFoundError;
  49. exports.SuppressionFileNotFoundError = SuppressionFileNotFoundError;