JS.VUE.NO.RESTRICTED.SYNTAX

Disallow specified syntax

This rule is the same rule as core [no-restricted-syntax] rule but it applies to the expressions in <template>.

Options

Please see [no-restricted-syntax] for detailed options.

You can include the AST created by [vue-eslint-parser] in the selector. To know more about certain nodes in produced AST, please go [vue-eslint-parser - AST docs].

"VElement > VExpressionContainer CallExpression"

Forbids call expressions inside mustache interpolation.

{'vue/no-restricted-syntax': ['error', 'VElement > VExpressionContainer CallExpression']}

Copy
<template>
  <!-- GOOD -->
  <div> {{ foo }} </div>
  <div> {{ foo.bar }} </div>

  <!-- BAD -->
  <div> {{ foo() }} </div>
  <div> {{ foo.bar() }} </div>
  <div> {{ foo().bar }} </div>
</template>

Further Reading

  • [no-restricted-syntax]
  • [ESTree]
  • [vue-eslint-parser]

  • https://eslint.org/docs/rules/no-restricted-syntax

  • https://github.com/estree/estree
  • https://github.com/vuejs/vue-eslint-parser
  • https://github.com/vuejs/vue-eslint-parser/blob/master/docs/ast.md

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/