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.

normalizeAllRuleSettings.js 1011B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. const _ = require('lodash');
  3. const normalizeRuleSettings = require('./normalizeRuleSettings');
  4. const rules = require('./rules');
  5. /** @typedef {import('stylelint').StylelintConfigRules} StylelintConfigRules */
  6. /** @typedef {import('stylelint').StylelintConfig} StylelintConfig */
  7. /**
  8. * @param {StylelintConfig} config
  9. * @return {StylelintConfig}
  10. */
  11. function normalizeAllRuleSettings(config) {
  12. /** @type {StylelintConfigRules} */
  13. const normalizedRules = {};
  14. if (!config.rules) return config;
  15. Object.keys(config.rules).forEach((ruleName) => {
  16. const rawRuleSettings = _.get(config, ['rules', ruleName]);
  17. const rule = rules[ruleName] || _.get(config, ['pluginFunctions', ruleName]);
  18. if (!rule) {
  19. normalizedRules[ruleName] = [];
  20. } else {
  21. normalizedRules[ruleName] = normalizeRuleSettings(
  22. rawRuleSettings,
  23. ruleName,
  24. _.get(rule, 'primaryOptionArray'),
  25. );
  26. }
  27. });
  28. config.rules = normalizedRules;
  29. return config;
  30. }
  31. module.exports = normalizeAllRuleSettings;