warnings.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.unknownOptionWarning = undefined;
  6. var _chalk;
  7. function _load_chalk() {
  8. return (_chalk = _interopRequireDefault(require('chalk')));
  9. }
  10. var _utils;
  11. function _load_utils() {
  12. return (_utils = require('./utils'));
  13. }
  14. function _interopRequireDefault(obj) {
  15. return obj && obj.__esModule ? obj : {default: obj};
  16. }
  17. const unknownOptionWarning = (exports.unknownOptionWarning = (
  18. config,
  19. exampleConfig,
  20. option,
  21. options,
  22. path
  23. ) => {
  24. const didYouMean = (0, (_utils || _load_utils()).createDidYouMeanMessage)(
  25. option,
  26. Object.keys(exampleConfig)
  27. );
  28. const message =
  29. ` Unknown option ${(_chalk || _load_chalk()).default.bold(
  30. `"${path && path.length > 0 ? path.join('.') + '.' : ''}${option}"`
  31. )} with value ${(_chalk || _load_chalk()).default.bold(
  32. (0, (_utils || _load_utils()).format)(config[option])
  33. )} was found.` +
  34. (didYouMean && ` ${didYouMean}`) +
  35. `\n This is probably a typing mistake. Fixing it will remove this message.`;
  36. const comment = options.comment;
  37. const name =
  38. (options.title && options.title.warning) ||
  39. (_utils || _load_utils()).WARNING;
  40. (0, (_utils || _load_utils()).logValidationWarning)(name, message, comment);
  41. });
  42. /**
  43. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  44. *
  45. * This source code is licensed under the MIT license found in the
  46. * LICENSE file in the root directory of this source tree.
  47. *
  48. *
  49. */