How to use the ember-template-lint.Rule function in ember-template-lint

To help you get started, we’ve selected a few ember-template-lint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-template-lint / ember-template-lint-plugin-prettier / lib / rules / prettier.js View on Github external
"use strict";

const {
  showInvisibles,
  generateDifferences
} = require("prettier-linter-helpers");

const getLocFromIndex = require("../utils/get-loc-from-index");

const { INSERT, DELETE, REPLACE } = generateDifferences;

let prettier;

const Rule = require("ember-template-lint").Rule;

function isFile(loc) {
  return loc.start && loc.start.line === 1 && loc.start.column === 0;
}

module.exports = class Prettier extends Rule {
  constructor(options) {
    super(options);
    this.filePath = options.moduleName + ".hbs";
  }

  visitor() {
    return {
      Program: {
        exit(node) {
          // in hbs AST a Program may be: a Template or a Block

ember-template-lint

Linter for Ember or Handlebars templates.

MIT
Latest version published 9 months ago

Package Health Score

79 / 100
Full package analysis

Popular ember-template-lint functions