Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deprecation-warnings.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @fileoverview Provide the function that emits deprecation warnings.
  3. * @author Toru Nagashima <http://github.com/mysticatea>
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Requirements
  8. //------------------------------------------------------------------------------
  9. const path = require("path");
  10. //------------------------------------------------------------------------------
  11. // Private
  12. //------------------------------------------------------------------------------
  13. // Definitions for deprecation warnings.
  14. const deprecationWarningMessages = {
  15. ESLINT_LEGACY_ECMAFEATURES:
  16. "The 'ecmaFeatures' config file property is deprecated and has no effect.",
  17. ESLINT_PERSONAL_CONFIG_LOAD:
  18. "'~/.eslintrc.*' config files have been deprecated. " +
  19. "Please use a config file per project or the '--config' option.",
  20. ESLINT_PERSONAL_CONFIG_SUPPRESS:
  21. "'~/.eslintrc.*' config files have been deprecated. " +
  22. "Please remove it or add 'root:true' to the config files in your " +
  23. "projects in order to avoid loading '~/.eslintrc.*' accidentally."
  24. };
  25. const sourceFileErrorCache = new Set();
  26. /**
  27. * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
  28. * for each unique file path, but repeated invocations with the same file path have no effect.
  29. * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
  30. * @param {string} source The name of the configuration source to report the warning for.
  31. * @param {string} errorCode The warning message to show.
  32. * @returns {void}
  33. */
  34. function emitDeprecationWarning(source, errorCode) {
  35. const cacheKey = JSON.stringify({ source, errorCode });
  36. if (sourceFileErrorCache.has(cacheKey)) {
  37. return;
  38. }
  39. sourceFileErrorCache.add(cacheKey);
  40. const rel = path.relative(process.cwd(), source);
  41. const message = deprecationWarningMessages[errorCode];
  42. process.emitWarning(
  43. `${message} (found in "${rel}")`,
  44. "DeprecationWarning",
  45. errorCode
  46. );
  47. }
  48. //------------------------------------------------------------------------------
  49. // Public Interface
  50. //------------------------------------------------------------------------------
  51. module.exports = {
  52. emitDeprecationWarning
  53. };