no-populate.js 610 B

123456789101112131415161718192021222324252627
  1. /**
  2. * @typedef {import('eslint').Rule} Rule
  3. * @typedef {import('./lib/html.js').HtmlOptions} HtmlOptions
  4. */
  5. /** @type {Rule.RuleModule} */
  6. module.exports = {
  7. meta: {
  8. type: 'problem',
  9. },
  10. /**
  11. * @property {Rule.RuleContext} context
  12. * @return {Rule.RuleListener}
  13. */
  14. create: (context) => {
  15. return {
  16. CallExpression(node) {
  17. if (node.callee.property && node.callee.property.name === 'populate') {
  18. context.report({
  19. node,
  20. message: "The 'populate' method should not be called in model modules.",
  21. });
  22. }
  23. },
  24. };
  25. },
  26. };