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.

index.js 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. "use strict";
  2. var _fs = require("fs");
  3. var _path = require("path");
  4. var _globals = _interopRequireDefault(require("./globals.json"));
  5. var snapshotProcessor = _interopRequireWildcard(require("./processors/snapshot-processor"));
  6. function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  7. function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. // copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
  10. /* istanbul ignore next */
  11. const interopRequireDefault = obj => obj && obj.__esModule ? obj : {
  12. default: obj
  13. };
  14. const importDefault = moduleName => // eslint-disable-next-line @typescript-eslint/no-require-imports
  15. interopRequireDefault(require(moduleName)).default;
  16. const rulesDir = (0, _path.join)(__dirname, 'rules');
  17. const excludedFiles = ['__tests__', 'utils'];
  18. const rules = (0, _fs.readdirSync)(rulesDir).map(rule => (0, _path.parse)(rule).name).filter(rule => !excludedFiles.includes(rule)).reduce((acc, curr) => ({ ...acc,
  19. [curr]: importDefault((0, _path.join)(rulesDir, curr))
  20. }), {});
  21. const recommendedRules = Object.entries(rules).filter(([, rule]) => rule.meta.docs.recommended).reduce((acc, [name, rule]) => ({ ...acc,
  22. [`jest/${name}`]: rule.meta.docs.recommended
  23. }), {});
  24. const allRules = Object.entries(rules).filter(([, rule]) => !rule.meta.deprecated).reduce((acc, [name]) => ({ ...acc,
  25. [`jest/${name}`]: 'error'
  26. }), {});
  27. const createConfig = rules => ({
  28. plugins: ['jest'],
  29. env: {
  30. 'jest/globals': true
  31. },
  32. rules
  33. });
  34. module.exports = {
  35. configs: {
  36. all: createConfig(allRules),
  37. recommended: createConfig(recommendedRules),
  38. style: {
  39. plugins: ['jest'],
  40. rules: {
  41. 'jest/no-alias-methods': 'warn',
  42. 'jest/prefer-to-be-null': 'error',
  43. 'jest/prefer-to-be-undefined': 'error',
  44. 'jest/prefer-to-contain': 'error',
  45. 'jest/prefer-to-have-length': 'error'
  46. }
  47. }
  48. },
  49. environments: {
  50. globals: {
  51. globals: _globals.default
  52. }
  53. },
  54. processors: {
  55. '.snap': snapshotProcessor
  56. },
  57. rules
  58. };