Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.33 KB

File metadata and controls

57 lines (41 loc) · 1.33 KB

ember/template-require-strict-mode

HBS Only: This rule applies to classic .hbs template files only (loose mode). It is not relevant for gjs/gts files (strict mode), where these patterns cannot occur.

Require templates to be in strict mode.

Ember's Polaris edition component authoring format is template tag, which makes templates follow "strict mode" semantics.

This rule requires all templates to use strict mode (template tag). Effectively this means you may only have template content in .gjs/.gts files, not in .hbs or .js/.ts.

Examples

This rule forbids the following:

// button.hbs
<button>{{yield}}</button>
// button-test.js
import { hbs } from 'ember-cli-htmlbars';

test('it renders', async (assert) => {
  await render(hbs`<Button>Ok</Button>`);
  // ...
});

This rule allows the following:

// button.gjs
<template>
  <button>{{yield}}</button>
</template>
// button-test.gjs
import { Button } from 'ember-awesome-button';

test('it renders', async (assert) => {
  await render(<template><Button>Ok</Button></template>);
  // ..
});

References