Skip to content

Latest commit

 

History

History
529 lines (371 loc) · 17.3 KB

CHANGELOG.md

File metadata and controls

529 lines (371 loc) · 17.3 KB

Changelog

0.8.14

  • Ensure that the configuration objects are not mutated.

0.8.13

  • Add new quotes rule. Examples:

Enforce either:

<div class="my-class">test</div>
{{my-helper "hello there"}}

or:

<div class='my-class'>test</div>
{{my-helper 'hello there'}}

You can read more about the rule in the documentation.

0.8.12

  • Ensure packages required by the executable script are dependencies. This fixes issues when using ember-template-lint as a globally installed package.

0.8.11

  • Fix issue with attribute-indentation rule (reporting incorrect indentation for multiple valid invocations).

0.8.10

  • Add new no-trailing-spaces rule. Examples:

Bad:

<div>test</div>//••
//•••••

Good:

<div>test</div>//
//

You can read more about the rule in the documentation.

  • Add new eol-last rule. Examples:

Enforce either:

<div>test</div>

or:

<div>test</div>

You can read more about the rule in the documentation.

0.8.9

  • Add support for colgroup and caption to table-groups rule.
  • Colorize the error severity in the console output.

0.8.8

  • Add new table-groups rule. Examples:

The rule forbids the following:

<table>
  <tr>
    <td></td>
  </tr>
</table>
<table>
  {{some-thing content=content}}
</table>

Instead, you should write your table as:

<table>
  <tbody>
    <tr>
      <td></td>
    </tr>
  </tbody>
</table>
<table>
  <tbody>
    {{some-thing content=content}}
  </tbody>
</table>

You can read more about the rule in the documentation.

0.8.7

  • Ensure that the contents of else blocks (a.k.a. inverse blocks) are checked for indentation.

0.8.6

  • Fix error in simple-unless rule when an {{if or {{unless block was empty.

0.8.5

  • Add new template-length rule. When enabled, this rule restricts the total number of lines in a template file to the configured number. You can read more about the rule (and configuration) in the documentation.

0.8.4

  • Add new attribute-indentation rule. Examples:
{{! good }}

{{foo-bar baz="bat" derp="qux"}}

{{foo-bar
  baz="bat"
  derp="qux"
}}

{{#foo-bar
  baz="bat"
  derp="qux"
as |foo|}}
  stuff here
{{/foo-bar}}

{{#foo-bar baz="bat" derp="qux" as |foo|}}
  stuff here
{{/foo-bar}}
{{! bad }}

{{foo-bar baz="bat"
  derp="qux"
}}

{{foo-bar
baz="bat"
derp="qux"
}}

{{foo-bar
  baz="bat"
  derp="qux"}}

You can read more about the rule (and configuration) in the documentation.

0.8.3

  • Update @glimmer packages to 0.27.0.
  • Update block-indentation rule to allow {{#if foo}}stuff{{else}}stuff{{/if}}.
  • Fix error being thrown by linebreak-style rule when dynamic attributes were being used (e.g. <img alt="example" src={{some/thing here}}>).

0.8.2

  • Add new rule no-duplicate-attributes to prevent duplicating the same attributes in a single mustache/block/element. Read the documentation for more details.
  • Add new rule linkbreak-style to ensure all templates use the same style of linebreaks throughout the template. Read the documentation for more details.

0.8.1

  • Fix issue with console output formatting to avoid noisy console output when no errors are present.

0.8.0

  • Refactor the console output formatter to be a much closer match to ESLint output (changes the signature of Linter.errorsToMessages).

0.7.4

  • Cleanup dependencies (remove unused, update versions to latest, etc).
  • Move rule documentation out of the README.md and into docs/rules/<rule-name>.md to make it simpler to reason about and link to documentation by rule.
  • Add require as an option to self-closing-void-elements. Use this value if you would like to require that all void elements are self closing (e.g. you require <img />).

0.7.3

  • Move strip-bom to dependencies (was mistakenly a devDependency).

0.7.2

  • Prevent errors when using contextual components.

0.7.1

  • Prevent errors within the bare-strings rule for <input placeholder="{{foo}}.">

0.7.0

  • Add support for user supplied rules and configuration. Please review the documentation for more details.

  • Add ember-template-lint command line script. This enable much easier running of the linter from the command line, editor plugins, etc. Supports --json flag to enable easier consumption by tools. See documentation for more details.

  • Allow rel=noreferrer to satisfy the link-rel-noopener rule.

  • Add inline-styles rule, which forbids using the style attribute in HTML elements.

  • Drop support for Node < 4.

  • Fix a number of issues with block-indentation rule when using "whitespace control" characters (e.g. {{~if foo~}}).

  • Add support for globs in .template-lintrc.js's ignore option.

  • Add simple-unless rule which forbids using {{unless with an inverse (or from an inverse), and with complex helper invocations as the predicate.

    {{! good }}
    
    <div class="{{unless foo "bar"}}"></div>
    {{#unless something}}
    {{/unless}}
    
    {{! bad }}
    
    {{#unless something}}
    {{else}}
    {{/unless}}
    
    
    {{#unless (complex (helper (invocation)))}}
    {{/unless}}
  • Add simple-unless to the recommended configuration.

  • Allow <form onsubmit={{action 'foo'}}></form> from the invalid-interactive rule.

  • Remove deprecated-each-syntax from recommended config.

  • Add configurable option to link-rel-noopener to require both noopener and noreferrer. See the documentation for more details.

  • Update to leverage ES2015 features that are supported in Node 4.

  • Added no-log and no-debugger rules. These rules forbid usage of {{log}} and {{debugger} helpers, which should be used only for local debugging and never checked in.

  • Fix issues around templates including a Byte Order Mark.

  • Upgrade underlying engine to leverage @glimmer/compiler@0.25.1. Includes much smaller footprint, better location support, easier to use plugin API.

  • Change API around Rule definition. A simple class extends Rule { } is all that is required.

v0.6.3

  • Add support for Handlebars comments.

    A few new types of control statements are now available:

    • {{! template-lint-enable some-rule-name }} - This will enable the rule some-rule-name with the default configuration (from .template-lintrc.js) or true (if not present in the config file). This can be ran for multiple rules at once (i.e. {{! template-lint-enable bare-strings some-other-thing }}).
    • {{! template-lint-disable some-rule-name }} - This will disable the rule some-rule-name. Multiple rules can be provided at once (i.e. {{! template-lint-disable bare-strings some-other-thing }}).
    • {{! template-lint-configure some-rule-name { "whitelist": ["some", "valid", "json"] } }} - This configures the rule some-rule-name with the JSON.parse()'ed result of the second argument. The configure instruction only applies toa single rule at a time.

    These configuration instructions do not modify the rule for the rest of the template, but instead only modify it within whatever DOM scope the comment instruction appears.

    An instruction will apply to all later siblings and their descendants:

    {{! disable for <p> and <span> and their contents, but not for <div> or <hr> }}
    <div>
      <hr>
      {{! template-lint-disable }}
      <p>
        <span>Hello!</span>
      </p>
    </div>

    An in-element instruction will apply to only that element:

    {{! enable for <p>, but not for <div>, <hr> or <span> }}
    <div>
      <hr>
      <p {{! template-lint-enable }}>
        <span>Hello!</span>
      </p>
    </div>

    An in-element instruction with the -tree suffix will apply to that element and all its descendants:

    {{! configure for <p>, <span> and their contents, but not for <div> or <hr> }}
    <div>
      <hr>
      <p {{! template-lint-configure-tree block-indentation "tab" }}>
        <span>Hello!</span>
      </p>
    </div>
  • Deprecate using HTML comments for enabling/disabling rules. Support for HTML comments will be removed in v0.7.0.

v0.6.2

  • Add ignore to allowed configuration values. ignore is an array of moduleId's that are to be completely ignored. This is similar (but different) from pending.
  • Add unused-block-params rule. The following example would fail this rule (since it has an unused block param index):
{{#each foo as |bar index|}}
  {{bar}}
{{/each}}
  • Update img-alt-attributes rule to allow <img alt> and <img alt="">.
  • Update invalid-interactive rule to allow <form {{action 'foo' on="submit"}}>.

v0.6.1

  • Fix issue with new deprecated-inline-view-helper (throwing error when parsing mustache statements).

v0.6.0

  • Add invalid-interactive to recommended rules.
  • Add img-alt-attributes to recommended rules.
  • Add style-concatenation to recommended rules.
  • Add deprecated-inline-view-helper to recommended rules.
  • Add link-rel-noopener to recommended rules.
  • Remove support for Node 0.10.

v0.5.18

  • Add deprecated-inline-view-helper rule. Usage of {{view / {{#view helper and {{view.path.here}} were deprecated in Ember 1.13, and subsequently removed in Ember 2.0. This rule flags these usages.

v0.5.17

  • Fix issue with the invalid-interactive rule not honoring the documented additonalInteractiveTags option.

v0.5.16

  • Fix issue with link-rel-noopener rule when using properly with a listing (i.e. rel="noopener noreferrer").
  • Add inline-link-to rule to prevent usage of inline {{link-to.
  • Add style-concatenation rule. This prevents the usage of <div style="{{make-background url}}"> (quoted value with any dynamic segments) but allows <div style={{make-background url}}>.

v0.5.15

  • Fix issue causing <iframe> to be detected as {{#if.
  • Add link-rel-noopener rule. This rule requires that any <a target="_blank"> have a rel="noopener". This prevents the newly opened window from having access to the opener (and helps prevent a number of phishing attacks).

v0.5.14

  • Fix invalid-indentation rule to allow scenarios where the opening and closing elements can have no space between. For example:
<textarea
    class="form-control"
    id="job-instructions"
    rows="3"
    placeholder="Do it well"
    value={{job.instructions}}
    oninput={{action 'updateInstructions' value='target.value'}}></textarea>

If the above </textarea> had been after a newline and indented properly, the default contents of the textarea would then include that whitespace. The rule now enforces that there be no child elements within a given block.

  • Remove a few ARIA roles that were incorrectly flagging things as interactive elements (i.e. dialog and alertdialog).

v0.5.13

  • Fix bug with invalid-interactive rule incorrectly flagging valid elements.

v0.5.12

  • Change nested-interactive rule to ignore elements using tabindex when determining if a parent element is interactive. tabindex is still used for detecting all child elements once already inside of another interactive element.

  • Fix various issues with nested-interactive and <label>.

    • Consider <label> an interactive element.
    • Specifically handle the various edge cases of having <label><input></label>.
    • Prevent multiple interactive elements inside of a <label>.
  • Fix bugs with the invalid-indentation around escaped mustaches and raw blocks.

  • Add invalid-interactive rule (full documentation). Adding interactivity to an element that is not naturally interactive content leads to a very poor experience for users of assistive technology (i.e. screen readers). In order to ensure that screen readers can provide useful information to their users, we should add an appropriate role attribute when the underlying element would not have made that role obvious.

    This rule forbids the following:

<div {{action 'foo'}}></div>

Instead, you should add a role to the element in question so that the A/T is aware that it is interactive:

<div role="button" {{action "foo"}}></div>
  • Add img-alt-attributes rule (full documentation). An <img> without an alt attribute is essentially invisible to assistive technology (i.e. screen readers). In order to ensure that screen readers can provide useful information, we need to ensure that all <img> elements have an alt specified. See WCAG Suggestion H37.

    The rule forbids the following:

<img src="rwjblue.png">

Instead, you should write the template as:

<img src="rwjblue.png" alt="picture of Robert Jackson">

v0.5.11

  • Add internal helper for determining if a given element is an interactive element.
  • Update nested-interactive rule to use the new isInteractiveElement helper function.
  • Change nested-interactive configuration. Now uses an object (instead of an array). Example:
rules: {
  'nested-interactive': {
    ignoredTags: ['a', 'button'], // list of tag names to ignore
    ignoreTabindex: true, // ignore the tabindex check
    ignoreUsemapAttribute: ['img', 'object'], // ignore `usemap` check for specific tag names
    additionalInteractiveTags: ['some-custom-tag'], // not sure this is needed, but it seams neat :P
  }
}

v0.5.10

  • Add ability to mark specific rules as pending for a module. Given the following .template-lintrc.js file, the foo/bar/baz module would have only its indentation related issues labeled as warnings:
module.exports = {
  extends: 'recommended',
  pending: [
    { moduleId: 'foo/bar/baz', only: ['block-indentation']}
  ]
}

All other rules with errors in the foo/bar/baz template would still be reported as errors.

v0.5.9

  • Update internals to use better API for traversing nodes in template AST.
  • Lock down parser version (should make package more stable as loose deps won't break consumers).

v0.5.8

  • Fix various issues with block-indentation rule:
    • Ensure that usage of whitespace control in end block does not trigger an error. Before this: {{#if foo}}{{~/if}} would error.
    • Validate indentation for block inverse (aka {{else}}).

v0.5.7

  • Fix a bug with block-indentation rule that would throw an error if a block contained a comment.
  • Fixed bugs upstream in HTMLBars that caused location information to be incorrect for attributes and comments.

v0.5.6

  • Remove bare-strings from recommended configuration. See #27 for more details.

v0.5.5

  • Fix invalid rule name in recommended configuration.
  • Add ability to mark files as pending in the .template-lintrc.js configuration file. When a module is listed in the pending list, it will be checked but any errors detected will be marked as warnings (and will not trigger a failing test when using ember-cli-template-lint). If there are no errors detected when checking a pending file, a new error will be triggered. The goal of this process is to allow large existing projects begin utilizing ember-template-lint / ember-cli-template-lint and slowly fix their template files to comply with the rules here. Feedback welcome on this idea/process...

v0.5.4

  • Move rule configuration into rules property inside .tempalte-lintrc.js. Configuration in the root is still supported, but triggers a deprecation warning. Migration should be very straigtforward.

    Before:

    // .template-lintrc.js
    module.exports = {
      'bare-strings': true
    }

    After:

    // .template-lintrc.js
    module.exports = {
      rules: {
        'bare-strings': true
      }
    }

v0.5.3

  • Add ability to extend from internally managed configurations.
  • Add recommended configuration, which can be used via the following in your .template-lintrc.js:
module.exports = {
  extends: 'recommended'
}

v0.5.2

  • Add fix information to the results object for:
    • html-comments
    • self-closing-void-elements
    • deprecated-each-syntax
  • Add support for context shifting {{#each (i.e. {{#each posts}}) to the deprecated-each-syntax.

v0.5.1

  • Bring back rules lost during migration from ember-cli-template-lint (deprecated-each, self-closing-void-elements).

v0.5.0

  • Initial migration of plugins from ember-cli-template-lint.
  • Implement new node API for the Linter.
  • Implement new result objects.