Skip to content

Latest commit

 

History

History
73 lines (53 loc) · 1.43 KB

File metadata and controls

73 lines (53 loc) · 1.43 KB

ember/template-no-restricted-invocations

Disallow certain components, helpers or modifiers from being used.

Use cases include:

  • You bring in some addon with helpers or components, but your team deems one or many not suitable and wants to guard against their usage
  • You want to discourage use of a deprecated component

Examples

Given a config of:

{ "template-no-restricted-invocations": ["foo-bar"] }

This rule forbids the following:

<template>{{foo-bar}}</template>
<template>{{#foo-bar}}{{/foo-bar}}</template>
<template><FooBar /></template>

This rule allows the following:

<template>{{baz}}</template>
<template><Baz /></template>

Configuration

One of these:

  • string[] - helpers or components to disallow (using kebab-case names like nested-scope/component-name)
  • object[] - with the following keys:
    • names - string[] - helpers or components to disallow
    • message - string - custom error message to report for violations
// .eslintrc.js
module.exports = {
  rules: {
    'ember/template-no-restricted-invocations': [
      'error',
      [
        'foo-bar',
        {
          names: ['deprecated-component'],
          message: 'Use new-component instead',
        },
      ],
    ],
  },
};

References