warnings.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. const unknownOptionWarning = exports.unknownOptionWarning = (config, exampleConfig, option, options) => {
  16. const didYouMean = (0, (_utils || _load_utils()).createDidYouMeanMessage)(option, Object.keys(exampleConfig));
  17. const message = ` Unknown option ${(_chalk || _load_chalk()).default.bold(`"${option}"`)} with value ${(_chalk || _load_chalk()).default.bold((0, (_utils || _load_utils()).format)(config[option]))} was found.` + (didYouMean && ` ${didYouMean}`) + `\n This is probably a typing mistake. Fixing it will remove this message.`;
  18. const comment = options.comment;
  19. const name = options.title && options.title.warning || (_utils || _load_utils()).WARNING;
  20. (0, (_utils || _load_utils()).logValidationWarning)(name, message, comment);
  21. }; /**
  22. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  23. *
  24. * This source code is licensed under the MIT license found in the
  25. * LICENSE file in the root directory of this source tree.
  26. *
  27. *
  28. */