Skip to content

Commit

Permalink
add lint for hbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Anne-Gaelle-S committed Nov 23, 2021
1 parent 511aa6c commit 9ede04d
Show file tree
Hide file tree
Showing 26 changed files with 176 additions and 127 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/blueprints/**
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 100,
"singleQuote": true,
"overrides": [
{
"files": "*.hbs",
"options": {
"singleQuote": false
}
}
]
}
11 changes: 10 additions & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
'use strict';

module.exports = {
extends: ['recommended', 'a11y'],
extends: ['recommended', 'a11y', 'ember-template-lint-plugin-prettier:recommended'],
plugins: ['ember-template-lint-plugin-prettier'],
rules: {
'no-invalid-interactive': false,
'no-nested-interactive': false,
'no-outlet-outside-routes': false,
'no-inline-styles': {
allowDynamicStyles: true,
},
},
};
2 changes: 1 addition & 1 deletion addon/components/pix-background-header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

{{yield}}

</div>
</div>
7 changes: 5 additions & 2 deletions addon/components/pix-banner.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
{{yield}}
{{#if this.displayAction}}
{{#if this.isExternalLink}}
<a class="pix-banner__action" href={{@actionUrl}} target="_blank" rel="noopener noreferrer">{{@actionLabel}}<FaIcon class='external-link' @icon='external-link-alt' /></a>
<a class="pix-banner__action" href={{@actionUrl}} target="_blank" rel="noopener noreferrer">
{{@actionLabel}}
<FaIcon class="external-link" @icon="external-link-alt" />
</a>
{{else}}
<LinkTo class="pix-banner__action" @route={{@actionUrl}}>{{@actionLabel}}</LinkTo>
{{/if}}
{{/if}}
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion addon/components/pix-block.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

{{yield}}

</div>
</div>
22 changes: 11 additions & 11 deletions addon/components/pix-button-link.hbs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{{#if @route}}
<LinkTo
@route={{@route}}
@models={{if @model (array @model) this.defaultModel}}
@disabled={{@isDisabled}}
@query={{if @query @query this.defaultParams}}
class={{this.className}}
...attributes
>
{{yield}}
</LinkTo>
<LinkTo
@route={{@route}}
@models={{if @model (array @model) this.defaultModel}}
@disabled={{@isDisabled}}
@query={{if @query @query this.defaultParams}}
class={{this.className}}
...attributes
>
{{yield}}
</LinkTo>
{{else}}
<a href={{@href}} class={{this.className}} ...attributes>
{{yield}}
</a>
{{/if}}
{{/if}}
2 changes: 1 addition & 1 deletion addon/components/pix-button-upload.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
value={{this.files}}
{{on "change" this.handleChange}}
...attributes
/>
/>
2 changes: 1 addition & 1 deletion addon/components/pix-button.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
</button>
{{/if}}

{{/if}}
{{/if}}
20 changes: 10 additions & 10 deletions addon/components/pix-collapsible.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class='pix-collapsible {{if this.isUnCollapsed 'pix-collapsible--uncollapsed'}}'>
<div class="pix-collapsible {{if this.isUnCollapsed "pix-collapsible--uncollapsed"}}">

<button
type="button"
{{on "click" this.toggleCollapsible}}
class='pix-collapsible__title {{if this.isUnCollapsed 'pix-collapsible__title--uncollapsed'}}'
class="pix-collapsible__title {{if this.isUnCollapsed "pix-collapsible__title--uncollapsed"}}"
aria-controls={{this.contentId}}
aria-expanded={{if this.isUnCollapsed 'true' 'false'}}
aria-expanded={{if this.isUnCollapsed "true" "false"}}
...attributes
>
<span>
Expand All @@ -15,15 +15,15 @@
{{this.title}}
</span>

<FaIcon
@icon="{{if this.isCollapsed 'plus' 'minus'}}"
class="pix-collapsible-title__icon" />
<FaIcon @icon="{{if this.isCollapsed "plus" "minus"}}" class="pix-collapsible-title__icon" />
</button>

<div
id={{this.contentId}}
aria-hidden={{if this.isCollapsed 'true' 'false'}}
class='pix-collapsible__content {{if this.isUnCollapsed "pix-collapsible__content--uncollapse"}}' >
{{yield}}
aria-hidden={{if this.isCollapsed "true" "false"}}
class="pix-collapsible__content
{{if this.isUnCollapsed " pix-collapsible__content--uncollapse"}}"
>
{{yield}}
</div>
</div>
</div>
17 changes: 11 additions & 6 deletions addon/components/pix-filter-banner.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class='pix-filter-banner' ...attributes>
<div class='pix-filter-banner__container-left'>
<div class="pix-filter-banner" ...attributes>
<div class="pix-filter-banner__container-left">
{{#if this.displayTitle}}
<p class="pix-filter-banner__title">{{@title}}</p>
{{/if}}
Expand All @@ -13,11 +13,16 @@
{{/if}}
{{#if this.displayClearFilters}}
<div class="pix-filter-banner__button-container">
<PixButton class="pix-filter-banner__button" @shape="squircle" @size="small" @triggerAction={{@onClearFilters}}>
<FaIcon class="pix-filter-banner-button__icon" @icon='trash-alt' @prefix='far'/>
{{@clearFiltersLabel}}
<PixButton
class="pix-filter-banner__button"
@shape="squircle"
@size="small"
@triggerAction={{@onClearFilters}}
>
<FaIcon class="pix-filter-banner-button__icon" @icon="trash-alt" @prefix="far" />
{{@clearFiltersLabel}}
</PixButton>
</div>
{{/if}}
</div>
</div>
</div>
11 changes: 7 additions & 4 deletions addon/components/pix-icon-button.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<button
type="button"
aria-label={{this.ariaLabel}}
class="pix-icon-button pix-icon-button--{{this.size}} pix-icon-button--{{this.color}} {{if @withBackground 'pix-icon-button--background'}}"
class="pix-icon-button pix-icon-button--{{this.size}}
pix-icon-button--{{this.color}}
{{if @withBackground " pix-icon-button--background"}}"
{{on "click" this.triggerAction}}
...attributes>
<FaIcon @icon={{this.icon}} @prefix={{@iconPrefix}}/>
</button>
...attributes
>
<FaIcon @icon={{this.icon}} @prefix={{@iconPrefix}} />
</button>
10 changes: 5 additions & 5 deletions addon/components/pix-input-code.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{!-- template-lint-disable no-down-event-binding --}}
<div class='pix-input-code'>
<fieldset aria-describedby='pix-input-code__details-of-use'>
{{! template-lint-disable no-down-event-binding }}
<div class="pix-input-code">
<fieldset aria-describedby="pix-input-code__details-of-use">
<legend>{{this.legend}}</legend>
<p id='pix-input-code__details-of-use'>{{this.explanationOfUse}}</p>
<p id="pix-input-code__details-of-use">{{this.explanationOfUse}}</p>
{{#each this.numberOfIterations as |i|}}
<input
...attributes
Expand All @@ -21,4 +21,4 @@
/>
{{/each}}
</fieldset>
</div>
</div>
46 changes: 25 additions & 21 deletions addon/components/pix-input-password.hbs
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
<div class='pix-input-password'>
<div class="pix-input-password">
{{#if this.label}}
<label for={{this.id}} class="pix-input__label">{{this.label}}</label>
{{/if}}
{{#if @information}}
<label for={{this.id}} class="pix-input__information">{{@information}}</label>
{{/if}}
<div class="pix-input-password__container {{if @errorMessage "pix-input-password__error-container"}} {{if @prefix "pix-input-password__with-prefix"}}">
<div
class="pix-input-password__container
{{if @errorMessage "pix-input-password__error-container"}}
{{if @prefix "pix-input-password__with-prefix"}}"
>

{{#if @prefix}}
<span class="pix-input-password__prefix">{{@prefix}}</span>
{{/if}}
{{#if @prefix}}
<span class="pix-input-password__prefix">{{@prefix}}</span>
{{/if}}

<input
id={{this.id}}
type={{if this.isPasswordVisible 'text' 'password'}}
value={{@value}}
aria-label={{this.ariaLabel}}
{{on 'change' this.onChange}}
...attributes
/>
<input
id={{this.id}}
type={{if this.isPasswordVisible "text" "password"}}
value={{@value}}
aria-label={{this.ariaLabel}}
{{on "change" this.onChange}}
...attributes
/>

<PixIconButton
class="pix-input-password__button {{if @errorMessage " pix-input-password__error-button"}}"
@icon={{if this.isPasswordVisible 'eye' 'eye-slash'}}
@ariaLabel={{if this.isPasswordVisible "Masquer le mot de passe" "Afficher le mot de passe"}}
@triggerAction={{this.togglePasswordVisibility}}
@size="small"
/>
<PixIconButton
class="pix-input-password__button {{if @errorMessage " pix-input-password__error-button"}}"
@icon={{if this.isPasswordVisible "eye" "eye-slash"}}
@ariaLabel={{if this.isPasswordVisible "Masquer le mot de passe" "Afficher le mot de passe"}}
@triggerAction={{this.togglePasswordVisibility}}
@size="small"
/>

</div>

{{#if @errorMessage}}
<FaIcon @icon="times" class="pix-input-password__error-icon" />
<label for={{this.id}} class="pix-input__error-message">{{@errorMessage}}</label>
{{/if}}
</div>
</div>
9 changes: 5 additions & 4 deletions addon/components/pix-input.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class='pix-input'>
<div class="pix-input">
{{#if @label}}
<label for={{this.id}} class="pix-input__label">{{@label}}</label>
{{/if}}
Expand All @@ -10,8 +10,9 @@
id={{this.id}}
class={{this.className}}
@value={{@value}}
{{on 'change' this.onChange}}
...attributes />
{{on "change" this.onChange}}
...attributes
/>

{{#if @errorMessage}}
<FaIcon @icon="times" class="pix-input__error-icon" />
Expand All @@ -22,4 +23,4 @@
<FaIcon @icon={{@icon}} class="pix-input__icon {{if @isIconLeft "pix-input__icon--left"}}" />
{{/if}}

</div>
</div>
4 changes: 2 additions & 2 deletions addon/components/pix-message.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p class="pix-message {{concat "pix-message--" this.type}}" ...attributes>
{{#if @withIcon}}
<FaIcon @icon={{ this.iconClass }} />
<FaIcon @icon={{this.iconClass}} />
{{/if}}
<span class="pix-message__content">
{{yield}}
</span>
</p>
</p>
43 changes: 27 additions & 16 deletions addon/components/pix-multi-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<label class="pix-multi-select-header {{if this.isBig "pix-multi-select-header--big"}}">

<span class="pix-multi-select-header__title">{{@title}}</span>
<FaIcon @icon='search' class="pix-multi-select-header__search-icon" />
<FaIcon @icon="search" class="pix-multi-select-header__search-icon" />

<input
id={{@id}}
Expand All @@ -18,42 +18,53 @@
autocomplete="off"
{{on "input" this.updateSearch}}
{{on "focus" this.focusDropdown}}
class="pix-multi-select-header__search-input"/>
class="pix-multi-select-header__search-input"
/>

</label>
{{else}}
<button
id={{@id}}
type="button"
type="button"
class="pix-multi-select-header {{if this.isBig "pix-multi-select-header--big"}}"
{{on "click" this.toggleDropDown}}
>
{{@title}}
<FaIcon class="pix-multi-select-header__dropdown-icon {{if this.isExpanded 'pix-multi-select-header__dropdown-icon--expand' }}" @icon={{if this.isExpanded "chevron-up" "chevron-down"}}/>
<FaIcon
class="pix-multi-select-header__dropdown-icon
{{if this.isExpanded " pix-multi-select-header__dropdown-icon--expand"}}"
@icon={{if this.isExpanded "chevron-up" "chevron-down"}}
/>
</button>
{{/if}}

<ul class="pix-multi-select-list {{unless this.isExpanded 'pix-multi-select-list--hidden'}}">
<ul class="pix-multi-select-list {{unless this.isExpanded "pix-multi-select-list--hidden"}}">
{{#if (gt this.results.length 0)}}
{{#each this.results as |option|}}
{{#each this.results as |option|}}
<li class="pix-multi-select-list__item">
<input
class="pix-multi-select-list__checkbox
{{if @isSearchable ' pix-multi-select-list__checkbox--searchable' }}"
type="checkbox"
checked={{option.checked}}
id={{concat @id '-' option.value}}
name={{option.label}}
value={{option.value}} {{on 'change' this.onSelect}}/>
<label for={{concat @id '-' option.value}}>
{{if @isSearchable " pix-multi-select-list__checkbox--searchable"}}"
type="checkbox"
checked={{option.checked}}
id={{concat @id "-" option.value}}
name={{option.label}}
value={{option.value}}
{{on "change" this.onSelect}}
/>
<label for={{concat @id "-" option.value}}>
{{yield option}}
</label>
</li>
{{/each}}
{{else if this.isLoadingOptions}}
<li class="pix-multi-select-list__item pix-multi-select-list__item--no-result">{{@loadingMessage}}</li>
<li
class="pix-multi-select-list__item pix-multi-select-list__item--no-result"
>{{@loadingMessage}}</li>
{{else}}
<li class="pix-multi-select-list__item pix-multi-select-list__item--no-result">{{@emptyMessage}}</li>
<li
class="pix-multi-select-list__item pix-multi-select-list__item--no-result"
>{{@emptyMessage}}</li>
{{/if}}
</ul>
</div>
</div>
Loading

0 comments on commit 9ede04d

Please sign in to comment.