Giter Club home page Giter Club logo

website's Introduction

ember-template-lint

npm version Build Status

ember-template-lint is a library that will lint your handlebars template and return error results.

For example, if the rule no-bare-strings is enabled, this template would be in violation:

{{! app/components/my-thing/template.hbs  }}
<div>A bare string</div>

When the ember-template-lint executable is run, we would have a single result indicating that the no-bare-strings rule found an error.

Requirements

  • Node.js ^18.18.0 || ^20.9.0 || >=21.1.0

Installation

npm install --save-dev ember-template-lint
yarn add --dev ember-template-lint

Note: this library is installed by default with new Ember apps.

Usage

While ember-template-lint does have a Node API, the main way to use it is through its executable, which is intended to be installed locally within a project.

Basic usage is as straightforward as

ember-template-lint .

Workflow Examples

See documentation on workflow examples.

See documentation on the todo functionality.

Configuration

Project Wide

You can turn on specific rules by toggling them in a .template-lintrc.js file at the base of your project, or at a custom relative path which may be identified using the CLI:

module.exports = {
  extends: 'recommended',

  rules: {
    'no-bare-strings': true,
  },
};

For more detailed information see configuration.

Presets

Name Description
โœ… recommended Enables the recommended rules.
๐Ÿ’… stylistic Enables stylistic rules for those who aren't ready to adopt ember-template-lint-plugin-prettier (including stylistic rules that were previously in the recommended preset in ember-template-lint v1).
โŒจ๏ธ a11y Enables A11Y rules. Its goal is to include all A11Y related rules, therefore it does not follow the same SemVer policy as the other presets. Please see versioning for more details.

Rules

Each rule has emojis denoting:

  • what configuration it belongs to
  • ๐Ÿ”ง if some problems reported by the rule are automatically fixable by the --fix command line option
Name โœ… ๐Ÿ’… โŒจ๏ธ ๐Ÿ”ง
attribute-indentation
attribute-order ๐Ÿ”ง
block-indentation ๐Ÿ’… ๐Ÿ”ง
builtin-component-arguments โœ…
deprecated-inline-view-helper โœ…
deprecated-render-helper โœ…
eol-last ๐Ÿ’… ๐Ÿ”ง
inline-link-to ๐Ÿ”ง
linebreak-style ๐Ÿ’…
link-href-attributes โœ… โŒจ๏ธ
link-rel-noopener โœ… ๐Ÿ”ง
modifier-name-case ๐Ÿ’… ๐Ÿ”ง
no-abstract-roles โœ… โŒจ๏ธ
no-accesskey-attribute โœ… โŒจ๏ธ ๐Ÿ”ง
no-action โœ…
no-action-modifiers
no-action-on-submit-button โœ…
no-args-paths โœ…
no-arguments-for-html-elements โœ…
no-aria-hidden-body โœ… โŒจ๏ธ ๐Ÿ”ง
no-aria-unsupported-elements โœ… โŒจ๏ธ
no-array-prototype-extensions โœ… ๐Ÿ”ง
no-at-ember-render-modifiers โœ…
no-attrs-in-components โœ…
no-autofocus-attribute โœ… โŒจ๏ธ
no-bare-strings
no-block-params-for-html-elements โœ…
no-builtin-form-components โœ…
no-capital-arguments โœ…
no-class-bindings โœ…
no-curly-component-invocation โœ… ๐Ÿ”ง
no-debugger โœ…
no-duplicate-attributes โœ… โŒจ๏ธ ๐Ÿ”ง
no-duplicate-id โœ… โŒจ๏ธ
no-duplicate-landmark-elements โœ… โŒจ๏ธ
no-dynamic-subexpression-invocations
no-element-event-actions
no-empty-headings โœ… โŒจ๏ธ
no-extra-mut-helper-argument โœ…
no-forbidden-elements โœ…
no-heading-inside-button โœ… โŒจ๏ธ
no-html-comments โœ… ๐Ÿ”ง
no-implicit-this โœ…
no-index-component-invocation โœ…
no-inline-styles โœ…
no-input-block โœ…
no-input-tagname โœ…
no-invalid-aria-attributes โœ… โŒจ๏ธ
no-invalid-interactive โœ… โŒจ๏ธ
no-invalid-link-text โœ… โŒจ๏ธ
no-invalid-link-title โœ… โŒจ๏ธ
no-invalid-meta โœ… โŒจ๏ธ
no-invalid-role โœ… โŒจ๏ธ
no-link-to-positional-params โœ…
no-link-to-tagname โœ…
no-log โœ…
no-model-argument-in-route-templates ๐Ÿ”ง
no-multiple-empty-lines ๐Ÿ’… ๐Ÿ”ง
no-mut-helper
no-negated-condition โœ… ๐Ÿ”ง
no-nested-interactive โœ… โŒจ๏ธ
no-nested-landmark โœ… โŒจ๏ธ
no-nested-splattributes โœ…
no-obscure-array-access โœ… ๐Ÿ”ง
no-obsolete-elements โœ… โŒจ๏ธ
no-outlet-outside-routes โœ…
no-partial โœ…
no-passed-in-event-handlers โœ…
no-pointer-down-event-binding โœ… โŒจ๏ธ
no-positional-data-test-selectors โœ… ๐Ÿ”ง
no-positive-tabindex โœ… โŒจ๏ธ
no-potential-path-strings โœ…
no-quoteless-attributes โœ… ๐Ÿ”ง
no-redundant-fn โœ… ๐Ÿ”ง
no-redundant-role โœ… โŒจ๏ธ ๐Ÿ”ง
no-restricted-invocations
no-route-action โœ…
no-scope-outside-table-headings โœ… โŒจ๏ธ
no-shadowed-elements โœ…
no-this-in-template-only-components ๐Ÿ”ง
no-trailing-spaces ๐Ÿ’… ๐Ÿ”ง
no-triple-curlies โœ…
no-unbalanced-curlies โœ…
no-unbound โœ…
no-unknown-arguments-for-builtin-components โœ… ๐Ÿ”ง
no-unnecessary-component-helper โœ… ๐Ÿ”ง
no-unnecessary-concat ๐Ÿ’… ๐Ÿ”ง
no-unnecessary-curly-parens โœ… ๐Ÿ”ง
no-unnecessary-curly-strings โœ… ๐Ÿ”ง
no-unsupported-role-attributes โœ… โŒจ๏ธ ๐Ÿ”ง
no-unused-block-params โœ…
no-valueless-arguments โœ…
no-whitespace-for-layout โœ… โŒจ๏ธ
no-whitespace-within-word โœ… โŒจ๏ธ
no-with โœ…
no-yield-only โœ…
no-yield-to-default โœ…
quotes ๐Ÿ’… ๐Ÿ”ง
require-aria-activedescendant-tabindex โœ… โŒจ๏ธ
require-button-type โœ… ๐Ÿ”ง
require-context-role โœ… โŒจ๏ธ
require-each-key
require-form-method
require-has-block-helper โœ… ๐Ÿ”ง
require-iframe-title โœ… โŒจ๏ธ
require-input-label โœ… โŒจ๏ธ
require-lang-attribute โœ… โŒจ๏ธ
require-mandatory-role-attributes โœ… โŒจ๏ธ
require-media-caption โœ… โŒจ๏ธ
require-presentational-children โœ… โŒจ๏ธ
require-splattributes
require-valid-alt-text โœ… โŒจ๏ธ
require-valid-named-block-naming-format โœ… ๐Ÿ”ง
self-closing-void-elements ๐Ÿ’… ๐Ÿ”ง
simple-modifiers โœ…
simple-unless โœ… ๐Ÿ”ง
splat-attributes-only โœ…
style-concatenation โœ…
table-groups โœ… โŒจ๏ธ
template-length

Supporting the --fix option

You can add a fixer to a rule. See fixer documentation for more details.

Sharing configs

It is possible to share a config (extends) or plugin (custom rules) across projects. See ember-template-lint-plugin-peopleconnect for an example.

Defining your own rules

You can define and use your own custom rules using the plugin system. See plugin documentation for more details.

Semantic Versioning Policy

The semver policy for this addon can be read here: semver policy.

Contributing

See the Contributing Guidelines for information on how to help out.

License

This project is licensed under the MIT License.

website's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.