no-stories-of.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. /**
  3. * @fileoverview storiesOf is deprecated and should not be used
  4. * @author Yann Braga
  5. */
  6. const constants_1 = require("../utils/constants");
  7. const create_storybook_rule_1 = require("../utils/create-storybook-rule");
  8. module.exports = (0, create_storybook_rule_1.createStorybookRule)({
  9. name: 'no-stories-of',
  10. defaultOptions: [],
  11. meta: {
  12. type: 'problem',
  13. docs: {
  14. description: 'storiesOf is deprecated and should not be used',
  15. categories: [constants_1.CategoryId.CSF_STRICT],
  16. recommended: 'error',
  17. },
  18. messages: {
  19. doNotUseStoriesOf: 'storiesOf is deprecated and should not be used',
  20. },
  21. schema: [],
  22. },
  23. create(context) {
  24. // variables should be defined here
  25. //----------------------------------------------------------------------
  26. // Helpers
  27. //----------------------------------------------------------------------
  28. // any helper functions should go here or else delete this section
  29. //----------------------------------------------------------------------
  30. // Public
  31. //----------------------------------------------------------------------
  32. return {
  33. ImportSpecifier(node) {
  34. if (node.imported.name === 'storiesOf') {
  35. context.report({
  36. node,
  37. messageId: 'doNotUseStoriesOf',
  38. });
  39. }
  40. },
  41. };
  42. },
  43. });