All Projects → ember-template-lint → Ember Template Lint

ember-template-lint / Ember Template Lint

Licence: mit
Linter for Ember or Handlebars templates

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Ember Template Lint

Ue4 Style Guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,656 (+1141.12%)
Mutual labels:  lint
Nbqa
Run any standard Python code quality tool on a Jupyter Notebook
Stars: ✭ 193 (-9.81%)
Mutual labels:  lint
Ember Tooltips
Easy and extendible tooltips for Ember components - http://sir-dunxalot.github.io/ember-tooltips/
Stars: ✭ 205 (-4.21%)
Mutual labels:  ember
Parcel Plugin Typescript
🚨 Enhanced TypeScript support for Parcel
Stars: ✭ 176 (-17.76%)
Mutual labels:  lint
Library App
Detailed Ember.js Octane v3.21 tutorial for absolute beginners. https://yoember.com
Stars: ✭ 189 (-11.68%)
Mutual labels:  ember
Add And Commit
Add & commit files from a path directly from GitHub Actions
Stars: ✭ 198 (-7.48%)
Mutual labels:  lint
Ember Cli Notifications
⚛ Atom inspired notification messages for ember-cli
Stars: ✭ 168 (-21.5%)
Mutual labels:  ember
Sql Language Server
SQL Language Server
Stars: ✭ 210 (-1.87%)
Mutual labels:  lint
Woke
✊ Detect non-inclusive language in your source code.
Stars: ✭ 190 (-11.21%)
Mutual labels:  lint
Emberx Select
Select component for Ember based on the native html select element.
Stars: ✭ 202 (-5.61%)
Mutual labels:  ember
Ember Page Title
Page title management for Ember.js Apps
Stars: ✭ 177 (-17.29%)
Mutual labels:  ember
Ember Native Dom Helpers
Test helpers for your integration tests that fire native events
Stars: ✭ 187 (-12.62%)
Mutual labels:  ember
Ember Leaflet
🔥 🍃 Easy and declarative mapping for ember
Stars: ✭ 201 (-6.07%)
Mutual labels:  ember
Ember File Upload
HTML5 file uploads for Ember apps
Stars: ✭ 172 (-19.63%)
Mutual labels:  ember
Grunt Recess
[DEPRECATED] Lint and minify CSS and LESS
Stars: ✭ 205 (-4.21%)
Mutual labels:  lint
Openapi Cli
⚒️ OpenAPI 3 CLI toolbox with rich validation and bundling features.
Stars: ✭ 169 (-21.03%)
Mutual labels:  lint
Ember Power Calendar
Powerful and customizable calendar component for Ember
Stars: ✭ 200 (-6.54%)
Mutual labels:  ember
Ember Models Table
Table with pagination, sorting, filtering and much more
Stars: ✭ 212 (-0.93%)
Mutual labels:  ember
Whispers
Identify hardcoded secrets and dangerous behaviours
Stars: ✭ 66 (-69.16%)
Mutual labels:  lint
Intellij Emberjs
Ember.js support for JetBrains IDEs (IntelliJ, WebStorm, ...)
Stars: ✭ 202 (-5.61%)
Mutual labels:  ember

ember-template-lint

npm version Build Status

ember-template-lint will lint your handlebars template and return error results.

For example, given 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.

Installation

This addon is installed by default with new Ember apps, so check your package.json before installing to see if you need to install it.

To install ember-template-lint

With npm:

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

With yarn:

yarn add ember-template-lint --dev

Node.js 10 || 12 || >=14 is required.

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

Basic usage with a single file

ember-template-lint "app/templates/application.hbs"

Output errors with source description

ember-template-lint "app/templates/application.hbs" --verbose

Multiple file/directory/wildcard paths are accepted

ember-template-lint "app/templates/components/**/*" "app/templates/application.hbs"

Output errors as pretty-printed JSON string

ember-template-lint "app/templates/application.hbs" --json

Ignore warnings / only report errors

ember-template-lint "app/templates/application.hbs" --quiet

Convert errors to TODOs in order to resolve at a later date

ember-template-lint . --update-todo

Number of warnings to trigger nonzero exit code

ember-template-lint "app/templates/application.hbs" --max-warnings=2

Define custom config path

Include TODOs with other output results

ember-template-lint . --include-todo

Define custom config path

ember-template-lint "app/templates/application.hbs" --config-path .my-template-lintrc.js

Read from stdin

ember-template-lint --filename app/templates/application.hbs < app/templates/application.hbs

Specify custom ignore pattern ['**/dist/**', '**/tmp/**', '**/node_modules/**'] by default

ember-template-lint "/tmp/template.hbs" --ignore-pattern "**/foo/**" --ignore-pattern "**/bar/**"

Disable ignore pattern entirely

ember-template-lint "/tmp/template.hbs" --no-ignore-pattern

Running a single rule without options

ember-template-lint --no-config-path app/templates --rule 'no-implicit-this:error'

Running a single rule with options

ember-template-lint --no-config-path app/templates --rule 'no-implicit-this:["error", { "allow": ["some-helper"] }]'

Running a single rule, disabling inline configuration

ember-template-lint --no-config-path app/templates --rule 'no-implicit-this:error' --no-inline-config

Specify a config object to use instead of what exists locally

ember-template-lint --config '{ "rules": { "no-implicit-this": { "severity": 2, "config": true } } }' test/fixtures/no-implicit-this-allow-with-regexp/app/templates

Specify a configuration to override the normally loaded config file:

ember-template-lint . --config='{"extends": "a11y"}'

Provide a custom formatter from a relative path

ember-template-lint --format ./my-shwanky-formatter.js

Provide a custom formatter from a formatter package

ember-template-lint --format ember-template-lint-formatter-snazzy

💡 Ensure you wrap all glob patterns in quotes so that it won't be interpreted by the CLI. ember-template-lint app/templates/** (this will expand all paths in app/templates) and ember-template-lint "app/templates/**" (this will pass the glob to ember-template-lint and not interpret the glob).

For more information about the todo functionality, see the documentation.

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)

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
Rule ID
attribute-indentation
💅 block-indentation
builtin-component-arguments
deprecated-each-syntax
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-args-paths
no-arguments-for-html-elements
✅🔧 no-aria-hidden-body
no-attrs-in-components
no-bare-strings
no-block-params-for-html-elements
no-capital-arguments
no-class-bindings
✅🔧 no-curly-component-invocation
no-debugger
no-down-event-binding
no-duplicate-attributes
no-duplicate-id
no-duplicate-landmark-elements
no-dynamic-subexpression-invocations
no-element-event-actions
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-block-param-definition
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-obsolete-elements
no-outlet-outside-routes
no-partial
no-passed-in-event-handlers
✅🔧 no-positional-data-test-selectors
no-positive-tabindex
no-potential-path-strings
no-quoteless-attributes
✅🔧 no-redundant-fn
✅🔧 no-redundant-landmark-role
no-restricted-invocations
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-unused-block-params
💅 no-whitespace-for-layout
💅 no-whitespace-within-word
no-yield-only
no-yield-to-default
💅 quotes
✅🔧 require-button-type
require-each-key
require-form-method
✅🔧 require-has-block-helper
require-iframe-title
require-input-label
require-lang-attribute
require-splattributes
require-valid-alt-text
💅 self-closing-void-elements
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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].