パッケージの詳細

ember-template-lint-plugin-denylist

shamrt18SEE LICENSE IN LICENSE0.1.1

ember-template-lint plugin for setting attribute denylists

ember-template-lint, ember-template-lint-plugin, plugin, denylist

readme

ember-template-lint-plugin-denylist

An ember-template-lint plugin for setting attribute denylists.

Usage

This plugin allows you to set a denylist for any arbitrary HTML attribute value or values.

Configuration

You can use all the standard ember-template-lint configuration options. For example project wide:

// .template-lintrc.js
module.exports = {
  plugins: ['ember-template-lint-plugin-denylist'],
  extends: ['recommended'],
  rules: {
    denylist: [
      'error',
      {
        attributes: [
          { name: 'alt', values: 'foo' }, // forbid substring 'foo' in 'alt' attributes
          { name: 'class', values: ['^test__', 'bar'] }, // forbid class names starting with 'test__' or containing substring 'bar'
          { name: 'id', values: 'baz$' }, // forbid IDs ending starting with 'baz'
          { name: 'class', values: '$quox$' } // forbid class names exactly matching 'quox'
        ]
      }
    ]
  }
};

Configuration options

attributes

  • array -- An array of objects with the following properties:
    • name -- string: HTML attribute to target
    • values -- string|string[]: Value or list of values to forbid
      • Special characters:
        • Prepending a value with ^ only forbids matches from the beginning of a value (e.g., '^foo' matches 'foobar' but not 'barfoo')
        • Suffixing a value with $ only forbids matches from the ending of a value (e.g., 'bar$' matches 'foobar' but not 'barbaz')
        • Combining both special characters forbid only exact matches (e.g., '^foo$' only forbids 'foo')

Changelog

See CHANGELOG.md.

Contributing

Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.

Authors and license

Shane Martin and contributors.

MIT License, see the included LICENSE file.

更新履歴

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

0.1.1 (2022-05-29)

Features

  • enable value extraction from concat mustache statements (033bfd3)

0.1.0 (2022-05-29)

Features

  • add functional attribute denylist rule (9527deb)
  • add peer dependency validation (2ba4d6b)
  • allow either string or string array values (773c279)
  • enable exact attribute matching (a5b425a)
  • enable starts- or ends-with value matching (9a7a2bb)