Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

no-restricted-syntax linting for templates #689

Closed
@mrginglymus

Description

Tell us about your environment

  • ESLint version: 4.19.1
  • eslint-plugin-vue version: 4.4.0
  • Node version: 8.9.4

Please show your full configuration:

{
 "rules": {
 "no-restricted-syntax": [
 "error",
 {
 "selector": "CallExpression[callee.property.name='$gettext'] TemplateLiteral"
 }
 ]
}

What did you do?
Apologies if this is more of an eslint than a eslint-plugin-vue issue. I am trying to write a linting rule to ensure that no template literals are passed into our gettext function (registered on Vue as vm.$gettext). This is working fine for script code, but I have played around with a number of rules and can't seem to get it to work for template invocations.

<template>
 <div :foo="$gettext(`bar`)">{{$gettext(`bar`)}}</div>
</template>
<script>
export default {
 computed: {
 baz() {
 return this.$gettext(`bar`);
 }
 }
}
</script>

What did you expect to happen?
3 linting errors, for each incorrect invocation of $gettext

What actually happened?
1 linting error from the script, none from the template

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /