UNPKG

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