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.

no-jest-import.js 992B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _utils = require("./utils");
  7. var _default = (0, _utils.createRule)({
  8. name: __filename,
  9. meta: {
  10. type: 'problem',
  11. docs: {
  12. description: 'Disallow importing Jest',
  13. category: 'Best Practices',
  14. recommended: 'error'
  15. },
  16. messages: {
  17. unexpectedImport: `Jest is automatically in scope. Do not import "jest", as Jest doesn't export anything.`
  18. },
  19. schema: []
  20. },
  21. defaultOptions: [],
  22. create(context) {
  23. return {
  24. 'ImportDeclaration[source.value="jest"]'(node) {
  25. context.report({
  26. node,
  27. messageId: 'unexpectedImport'
  28. });
  29. },
  30. 'CallExpression[callee.name="require"][arguments.0.value="jest"]'(node) {
  31. context.report({
  32. loc: node.arguments[0].loc,
  33. messageId: 'unexpectedImport',
  34. node
  35. });
  36. }
  37. };
  38. }
  39. });
  40. exports.default = _default;