no-deprecated-functional-template.js 1.4 KB

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