Giter Club home page Giter Club logo

ember-cli-template-lint'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.

ember-cli-template-lint's People

Contributors

captain-enjoyable avatar davewasmer avatar dcyriller avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar devotox avatar dwickern avatar ef4 avatar elwayman02 avatar ember-tomster avatar exelord avatar gavinjoyce avatar greenkeeper[bot] avatar greenkeeperio-bot avatar heroiceric avatar jathanasiou avatar mixonic avatar orisomething avatar patocallaghan avatar pschutz93 avatar rwjblue avatar scottkidder avatar simonihmig avatar splattne avatar stopfstedt avatar t-sauer avatar turbo87 avatar wagenet avatar xiphiasuvella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-template-lint's Issues

[META] Linting for obvious accessibility issues.

We discussed that we can catch accessibility issues and more in this addon. Introducing David Peter, @sarenji, from the Ember A11y team. ๐Ÿ˜„ Amusingly, the ember-a11y addon came out of the same Zesty Hack Day as ember-cli-template-lint.

Rule: Require block contents to be indented.

Hi, not sure if this is on purpose but I'm getting no warnings when I test my build with this template:

<div>
<div>
{{#if isSingleError}}
{{firstError}}
{{else if errors}}
{{errors}}
{{else}}
{{t 'no errors found'}}
{{/if}}
</div>
</div>

Should warn about multiple incorrect indentation correct?

I'm testing with ember serve and visiting: http://localhost:4200/tests

May be related to #36

Should lint everytime ember builds

Hi, @rwjblue first of all, thank you so much for all the stuff you do for Ember, awesome work!
I just tried this since it seems like an awesome idea but I'm having trouble seeing the linter output.
Is this supposed to happen?

  1. update cli to 2.4.2 and install [email protected]
  2. ember serve
  3. see multiple linter warnings
  4. don't fix anything
  5. restart ember serve
  6. no errors show up (although they are still there)

I even rm -rf tmp/ dist/ and start the server again but nothing shows up. I know the errors are still there because I didn't fix them.
How can I re-lint my files?

Thank you so much in advance!

Incorrect identification of Indentation errors

<div>
    <h1>{{translate 'heading'}}</h1>
</div>

For the above snippet, it throws the error
Incorrect indentation for <h1> beginning at ('app/pods/application/template.hbs'@ L2:C1). Expected <h1> to be at an indentation of 2 but was found at 1.

Even if the above snippet is changed as the following, it throws the same error

<div>
    <h1>
        {{translate 'heading'}}
    </h1>
</div>

{{else if foo}} is not handled correctly

{{#if isMorning}}
  Good morning
{{else if isAfternoon}}
  Good afternoon
{{else}}
  Good night
{{/if}}

Will report:

Incorrect indentation for `if` beginning at ('rwe/components/criteria-operator-select/template.hbs'@ L3:C0).
Expected `{{/if}}` ending at ('rwe/components/criteria-operator-select/template.hbs'@ L7:C0)to be at an indentation of 0 but was found at -7.

Enforce consistent quote style

Something that plagues our templates is inconsistent quotes. For example, take the following snippets:

{{edit-person name="Jessica Jones" changed=(action 'personChanged')}}

<div class="messages">
  {{#each messages as |message|}}
    <span class='message'>{{message}}</span>
  {{/each}}
</div>

Similar to the rules used in ember-suave, it would be great to enforce a consistent quote style across an app.

I personally prefer using double quotes in html/templates, but I think consistency is the most important. This should probably be configurable in order to migrate existing projects easier.

Some examples of what I'd be fine with:

{{edit-person name="Jessica Jones" changed=(action "personChanged")}}

<div class="messages">
  {{#each messages as |message|}}
    <span class="message">{{message}}</span>
  {{/each}}
</div>

{{! single quotes are okay, if they contain double quotes }}
{{edit-person name='Zebediah "Purple man" Killgrave' changed=(action "personChanged")}}

The error message should contain the exact position of the 'wrong' string, so fixing the error is easy and editor integration is not broken.

Make rules opt-in?

Currently, our rules are all enabled by default, but I think that could likely get annoying as we add more rules.

I think that we should likely migrate to all rules needing to be enabled in the .template-lintrc file. We can make this easier by adding a blueprint that generates one with nice defaults (currently, it would just enable all rules ๐Ÿ˜).

Thoughts?

Make symbols free from bare string rule

Sometimes we require symbols such as : , ( , ) , + , - ,etc., to be displayed in the web page. For that we can go for using bare strings instead of translating for each symbols.
For eg:
{{translate "firstname.label"}} : {{input type="text"}}
{{translate "requestGradePoint"}} : {{input type="number"}} / {{input type="number"}}
<p>&times;</p> for 'x'

BUG: bare-strings - Prevent bare strings in common "display" attributes.

Things like:

<img alt="lolol, you do not know english">

A few obvious ones:

  • placeholder
  • alt
  • title

What other attributes are troublesome?


We should add a generic mechanism to check each element attribute. Something like isAttributeBareStringAllowed(tagName, attributeName, value) should do the trick.

Per-template rules don't seem to work

Per-template rules don't seem to work correctly in some cases. With the following config:

module.exports = {
  'bare-strings': true,
  'triple-curlies': true
};

and the following template:

<!-- template-lint triple-curlies=false -->
<div>Bare strings are bad...</div>
{{{tripleCurliesAreAllowedInThisTemplate}}}

I'm seeing a Usage of triple curly brackets is unsafe '{{{tripleCurliesAreAllowedInThisTemplate}}}' error.

Is also see the error if I use the following template:

<!-- template-lint disable=true -->
<div>Bare strings are bad...</div>
{{{tripleCurliesAreAllowedInThisTemplate}}}

One-line block helper/components are not handled correctly

{{#x-foo}}bar{{/x-foo}}

will report

Incorrect indentation for `x-foo` beginning at ('template.hbs'@ L1:C0). 
Expected `{{/x-foo}}` ending at ('template.hbs'@ L1:C14) to be at an indentation of 0 but was found at 14.

Which is incorrect IMO.

Only addon files are linted when using `ember test`

I've used ember install ember-cli-template-lint and modified .template-lintrc to look like this:

module.exports = {
    rules: {
        'self-closing-void-elements': true,
    }
};

When I use ember template-lint:print-failing I get a nice list of all templates in my app that break the rule. No addon files are inspected.

When I use ember test or ember build I get:

self-closing-void-elements: Self-closing a void element is redundant(modules/ember-cli-head/templates/components/head-layout):
`<meta name="ember-cli-head-start" />`
self-closing-void-elements: Self-closing a void element is redundant(modules/ember-cli-head/templates/components/head-layout @ L1:C52):
`<meta name="ember-cli-head-end" />`
===== 2 Template Linting Errors

Which ignored in-app templates and instead linted the ones from ember-cli-head addon.

I've tried to debug it and found that lintTree(type, tree) hook in https://github.com/rwjblue/ember-cli-template-lint/blob/master/index.js#L18 is called only twice and for this specific addon with type === 'addon' and type === 'templates.
After digging in ember-cli I've found that lintTree is only mentioned in the addon context:

Does it mean that ember-cli-template-lint is designed for addons only? I don't see any info about this and it doesn't really make sense given that ember template-lint:print-failing lints the app templates.
Did I misconfigure something? You can check my setup at https://github.com/Wikia/mercury/tree/ember-cli-template-lint/front/main

Add CHANGELOG.md

Hi, would you mind adding a change log file? Maybe an automated one from your commits or latest pull requests would suffice. This is moving so fast it's hard to follow : )

Thanks!

Disallow undefined parameters

This could be tricky because you need to know the context a template is operating in, and probably all helpers/components, but if I have the following in a template:

{{foo}} and {{bar}}

And the following component:

export default Component.extend({
  foo: "here"
});

It should warn that bar is not defined.

Split core into stand alone package.

I am working this weekend to split the rules from ember-cli-template-lint into ember-template-lint which has a simple JS API (and is unrelated to ember-cli). This library would then consume that external lib, and work exactly the same as it does today.

This will unlock a number of things:

  • Writing the reverse of sourceForNode (ala rewriteNode or something).
  • Add a command line invocation (outside of ember-cli land)
  • Use both of those things and add a --fix command to rewrite mechanical refactors (aka {{each foo in bar}} to {{each bar as |foo|}}). This could be used like (or from) ember-watson.

Incorrect error message for "Incorrect indentation" error

Hey @rwjblue just tried your last release v0.2.9 that enforces indentation. Awesome job!
Everything seems fine except for a minor message error. See below:

I have this incorrectly indented template:

{{#each groupedServices as |group|}}
  <li>{{group.groupName}}
    <ul>
      {{#each group.services as |service|}}
        <li>{{service.name}}</li>
      {{/each}}
    </ul>
  </li>
{{/each}}

And I get an error warning me about the {{group.groupName}} that is in the wrong place:

Incorrect indentation for `{{#group.groupName}}` beginning at ('code/templates/components/services.hbs'@ L2:C6). Expected `{{#group.groupName}}` to be at an indentation of 4 but was found at 6.

The bug here is that the error says I should look for a {{#group.groupName}}where in fact I should be looking for {{{{group.groupName}}}}i.e. without the #.

One again thanks for your awesome work!

block-indentation required handlebars-expressions to be on their own line

With block-indentation, the following throws an error:

<div>
  {{t 'Use the following ID:'}}
  {{t 'id-prefix-'}}{{id}}
</div>

However, in some cases this can be necessary, e.g. if you do not want to have whitespace between two elements or translated strings. I feel that non-block handlebars expressions should not be required to be in their own lines.

it seems BasePlugin#sourceForNode() trims first character of `AttrNode`s

it seems BasePlugin#sourceForNode() trims first character of AttrNodes.
from log i made:

----
{ type: 'AttrNode',
  name: 'src',
  value: { type: 'TextNode', chars: 'tomster.png', loc: null },
  loc:
   { source: null,
     start: { line: 1, column: 20 },
     end: { line: 1, column: 36 } } }
===
rc='tomster.png'
===

Newest htmlbars release (0.14.17) breaks block indentation rule

This change breaks the block indentation rule because now this check passes for text nodes. This is because this:

{{#if foo}}
  {{foo}}
{{/if}}

is a MustacheStatement whose first child is a TextNode containing the two spaces before the {{foo}}. Those two spaces' location points to column 0, which the block indentation logic flags as incorrect, and then when trying to log the error, throws an exception on this line because text nodes don't have a path attribute.

I think the fix is to look for an explicit list of node types instead of the !child.loc check, but I don't have time to prepare a fix right now. If somebody else does, great, otherwise maybe we can just pin the version of htmlbars to 0.14.16 until we have time to get in a fix?

how to add warnings message on folder level using pending

One of my dependency addon in package.json contains errors in templates.

I want to get warnings message for the template inside this particular folder instead of getting huge errors errors.

Please find the below example

Example:

my-addon (I using ember-cli-template-lint in my addon only)
   |
   | node_modules
              |
              | internal-addons => (which is throwing a lot of template related errors, 
I want this addon shouldn't validate or to throw warning 
message instead of error )

I have used below, but this not working properly

'use strict';

module.exports = {
  extends: 'recommended',

  rules: {
    'bare-strings': false,
    'img-alt-attributes': true,
    'self-closing-void-elements': true,
    'invalid-interactive': true
  },

  pending: [
    'modules/internal-addons/component/**'
  ]
};

Help on this please.

Disallow inline 'style' attribute in html or hbs

Im most projects, we recommend that using css to style the dom elements. But some ones may prefer to write inline style rules, because it's just quick! I would be wonderful if we have a rule that totally disallow inline style rules. And it would be even more wonderful if we can add inline directive comment to disable a rule for some rare reasons.

Incorrect expectation of </input>

Hey, maybe my indentation is weird here but I think no error should show up for this:

<input
  type="text"
  value={{if extra.labelPath (get selected extra.labelPath) selected}}
  class="ember-power-select-typeahead-input"
  oninput={{action "search" value="target.value"}}
  onkeydown={{action "onkeydown"}}
  onmousedown={{action "onmousedown"}}>

But I'm getting the following error:

Incorrect indentation for `input` beginning at ('code/templates/components/input-trigger.hbs'@ L1:C0). Expected `</input>` ending at ('code/templates/components/input-trigger.hbs'@ L7:C44)to be at an indentation of 0 but was found at 36.

If i put the input closing >char on the next line at position 0 I get indentation of 0 but was found at -7. which is weird, no?

No error is thrown if I put the whole input in a single line. Or like this:

<input
  type="text"
  value={{if extra.labelPath (get selected extra.labelPath) selected}}
  class="ember-power-select-typeahead-input"
  oninput={{action "search" value="target.value"}}
  onkeydown={{action "handleKeydown"}}
  onmousedown={{action "captureMouseDown"}}
       >

I understand why this is happening, but should an error be thrown here? If yes, maybe the expectation of the closing ">" char position should be different.

Thanks a lot in advance!

Rule: Disallow unused block params.

Given the following:

{{#foo-bar as |blah|}}
  Stuff goes here, but doesn't use block param at all.
{{/foo-bar}}

We should error indicating that the block param was not used (roughly the same as an unused variable in JS linters).

Add rules for deprecated patterns.

As of #27 we are no longer using ember-template-compiler.js, so we can now support deprecations across a number of Ember versions.

A few things that jump out are:

  • {{#each foo in bar}}{{/each}} #84
  • {{#each foo itemController="asdf" as |bar}}{{/each}}
  • {{#view 'foo'}}{{/view}}
  • {{view 'foo'}}
  • {{view.some.path}}
  • {{input on="enter" action="lol"}}

There are likely more...

Rule: Disallow HTML comments

I can't think of a good use case for using <!-- HTML comments --> in templates since {{!-- handlebars comments --}} serve the purpose of commenting the template, but are not included in the compiled output and eventual DOM. But I'm so used to HTML comments that I always forget and use them when I don't mean to! I'd love a lint rule to catch this.

I see that the linter uses HTML comments for its instructions. Is this because brocolli-template-lint doesn't expose handlebars comments or something? Or could it instead support instructions in handlebars comments? I believe this rule could be made to work either way (obviously ignoring HTML comments that are instructions to the linter).

I'd be happy to take a crack at a PR for this if it sounds like a good idea outside of my head as well as inside of it ๐Ÿ˜„

Rule: Disallow mustaches/subexpr in partials.

Dynamic lookups in partials quickly become untenable because they have absolutely no limitations to the things they can reach out and "get". It also becomes nearly impossible to refactor the template/controller/component invoking the partial without completely internalizing absolutely everything since they have no established API.

Good:

{{! some-path/-blah.hbs }}
{{! no dynamic lookups here}}
<svg></svg>

Bad:

{{! some-path/-blah.hbs }}
{{! oh no dynamic lookups here!! }}
<div>{{foo}}</div>

Textareas display whitespace from block indentation

Since textareas are block elements, the linter will instruct the closing tag to match the indentation of the opening tag.

e.g. to change

<textarea></textarea>

to

<textarea>
</textarea>

When this rule is obeyed the textarea will include the added whitespace in the input box.

image

This took a while to debug :-)

Heres the rule message:

block-indentation: Incorrect indentation for `textarea` beginning at L31:C6. Expected `</textarea>` ending at L36:C88 to be at an indentation of 6 but was found at 77.(live-ops/templates/components/new-last-minute-job-form @ L36:C88): 

`<textarea class="form-control"
                id="job-instructions"
                rows="3"
                placeholder="Do it well"
                value={{job.instructions}}
                oninput={{action 'updateInstructions' value='target.value'}}></textarea>`

Any ideas for a potential fix? In the mean time I'll disable the rule.

Enforce indentation for multiline blocks.

This would likely fall into the block-indentation rule, but the basic idea is that for HTML elements that span multiple lines you want to ensure they start and stop at the same location.

<!-- bad -->

<div>
  <p>SomeStuff Here</p></div>
<!-- good -->

<div>
  <p>SomeStuff Here</p>
</div>

<div><p>SomeStuff Here</p></div>

RFC: add `template-lint` command

Sister to ember-cli/ember-cli-eslint#92

Running the linting without running the whole test suite may be beneficial. Returning an error code for failures may help for CIs. I'm not familiar with this codebase, but if it functions like eslint, you may be able to get faster results if you don't have to wait for a complete ember build.

Linter Tests should be marked as unit tests

Currently the name of a test looks like this:

TemplateLint - path/to/template.hbs: should pass TemplateLint

To define better testing stages for CI/CD pipelines it would be great to have the possibility to configure the name to get something like this:

TemplateLint - Unit - path/to/template.hbs: should pass TemplateLint

Allow non-translated special character strings & numbers

In my templates, I have a few things like this:

({{t 'Optional'}})

Because I do not want to have both 'Optional' and '(Optional)' in my translation files. However, ( and ) are counted as untranslated strings. The same happens if I use numbers. I think it would make sense to only throw this error for strings containing letters, and ignore it if a string contains only numbers and/or special characters.

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.