no-deprecated-functional-template.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @author Yosuke Ota
  3. * See LICENSE file in root directory for full license.
  4. */
  5. 'use strict'
  6. const utils = require('../utils')
  7. module.exports = {
  8. meta: {
  9. type: 'problem',
  10. docs: {
  11. description:
  12. 'disallow using deprecated the `functional` template (in Vue.js 3.0.0+)',
  13. categories: ['vue3-essential'],
  14. url: 'https://eslint.vuejs.org/rules/no-deprecated-functional-template.html'
  15. },
  16. fixable: null,
  17. schema: [],
  18. messages: {
  19. unexpected: 'The `functional` template are deprecated.'
  20. }
  21. },
  22. /**
  23. * @param {RuleContext} context - The rule context.
  24. * @returns {RuleListener} AST event handlers.
  25. */
  26. create(context) {
  27. return {
  28. Program(program) {
  29. const element = program.templateBody
  30. if (element == null) {
  31. return
  32. }
  33. const functional = utils.getAttribute(element, 'functional')
  34. if (functional) {
  35. context.report({
  36. node: functional,
  37. messageId: 'unexpected'
  38. })
  39. }
  40. }
  41. }
  42. }
  43. }