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.

createStylelintResult.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. const createPartialStylelintResult = require('./createPartialStylelintResult');
  3. /** @typedef {import('stylelint').PostcssResult} PostcssResult */
  4. /** @typedef {import('postcss').NodeSource} NodeSource */
  5. /** @typedef {import('stylelint').StylelintResult} StylelintResult */
  6. /**
  7. * @param {import('stylelint').StylelintInternalApi} stylelint
  8. * @param {PostcssResult} [postcssResult]
  9. * @param {string} [filePath]
  10. * @param {import('stylelint').StylelintCssSyntaxError} [cssSyntaxError]
  11. * @return {Promise<StylelintResult>}
  12. */
  13. module.exports = function (stylelint, postcssResult, filePath, cssSyntaxError) {
  14. let stylelintResult = createPartialStylelintResult(postcssResult, cssSyntaxError);
  15. return stylelint.getConfigForFile(filePath).then((configForFile) => {
  16. // TODO TYPES handle possible null here
  17. const config = /** @type {{ config: import('stylelint').StylelintConfig, filepath: string }} */ (configForFile)
  18. .config;
  19. const file = stylelintResult.source || (cssSyntaxError && cssSyntaxError.file);
  20. if (config.resultProcessors) {
  21. config.resultProcessors.forEach((resultProcessor) => {
  22. // Result processors might just mutate the result object,
  23. // or might return a new one
  24. const returned = resultProcessor(stylelintResult, file);
  25. if (returned) {
  26. stylelintResult = returned;
  27. }
  28. });
  29. }
  30. return stylelintResult;
  31. });
  32. };