Skip to content

Commit f823eca

Browse files
committed
Lint fixes
1 parent 993e8b7 commit f823eca

File tree

15 files changed

+517
-149
lines changed

15 files changed

+517
-149
lines changed

.template-lintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
module.exports = {
44
extends: 'recommended',
5+
rules: {
6+
'no-curly-component-invocation': {
7+
allow: ['emitter-action'],
8+
},
9+
},
510
};

addon/components/collection-scroll-view/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</div>
2828
{{/if}}
2929

30-
{{#unless (and (has-block 'header') (is-empty this.headerDimensions))}}
30+
{{#if (not (and (has-block 'header') (is-empty this.headerDimensions)))}}
3131
<div data-test-collection-items-container style={{html-safe (concat "position:relative;height:" this.contentSize.height "px;width:" this.contentSize.width "px")}}>
3232
<CollectionScrollView::CollectionItems
3333
@clientSize={{this.collectionClientSize}}
@@ -44,7 +44,7 @@
4444
{{~/each~}}
4545
</CollectionScrollView::CollectionItems>
4646
</div>
47-
{{/unless}}
47+
{{/if}}
4848

4949
{{#if @revealService}}
5050
{{emitter-action

addon/templates/components/scroll-view.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
class="ScrollView-scrollBar"
1717
@contentHeight={{this.scrollBarContentHeight}}
1818
@scrollerHeight={{this.scrollBarClientHeight}}
19-
@registerWithScrollView={{action this.scrollViewApi.registerScrollPositionCallback}}
19+
@registerWithScrollView={{this.scrollViewApi.registerScrollPositionCallback}}
2020
/>
2121
{{emitter-action
22-
emitter=this.windowRef
23-
eventName="requestScrollToTop"
24-
action=this.scrollViewApi.scrollToTopIfInViewport
22+
emitter=this.windowRef
23+
eventName="requestScrollToTop"
24+
action=this.scrollViewApi.scrollToTopIfInViewport
2525
}}
2626
</div>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"build": "ember build --environment=production",
2020
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
2121
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
22+
"lint:hbs": "ember-template-lint .",
2223
"lint:hbs:fix": "ember-template-lint . --fix",
2324
"lint:js": "eslint . --cache",
2425
"release": "release-it",
@@ -81,7 +82,7 @@
8182
"ember-simulant-test-helpers": "^0.3.2",
8283
"ember-source": "~3.28.8",
8384
"ember-source-channel-url": "^3.0.0",
84-
"ember-template-lint": "^3.15.0",
85+
"ember-template-lint": "^5.13.0",
8586
"ember-try": "^1.4.0",
8687
"eslint": "^7.32.0",
8788
"eslint-config-prettier": "^8.3.0",

tests/dummy/app/controllers/images.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export default class extends Controller {
2929
@tracked containerHeight = 600;
3030

3131
@action
32-
updateContainerWidth(value) {
33-
this.containerWidth = parseInt(value, 10);
32+
updateContainerWidth(ev) {
33+
this.containerWidth = parseInt(ev.target.value, 10);
3434
}
3535

3636
@action
37-
updateContainerHeight(value) {
38-
this.containerHeight = parseInt(value, 10);
37+
updateContainerHeight(ev) {
38+
this.containerHeight = parseInt(ev.target.value, 10);
3939
}
4040

4141
@action

tests/dummy/app/controllers/virtual.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export default class extends Controller {
3030
@tracked containerHeight = 600;
3131

3232
@action
33-
updateContainerWidth(value) {
34-
this.containerWidth = parseInt(value, 10);
33+
updateContainerWidth(ev) {
34+
this.containerWidth = parseInt(ev.target.value, 10);
3535
}
3636

3737
@action
38-
updateContainerHeight(value) {
39-
this.containerHeight = parseInt(value, 10);
38+
updateContainerHeight(ev) {
39+
this.containerHeight = parseInt(ev.target.value, 10);
4040
}
4141

4242
@action

tests/dummy/app/templates/images.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
{{!-- template-lint-disable require-input-label --}}
12
<h3>Images</h3>
23
<button type="button" {{on 'click' this.shuffle}}>Shuffle</button>
34
<p>
4-
Container Width: <input type='range' min=200 max=1000 value={{this.containerWidth}} oninput={{action 'updateContainerWidth' value='target.value'}}> {{this.containerWidth}}
5-
Container Height: <input type='range' min=200 max=1000 value={{this.containerHeight}} oninput={{action 'updateContainerHeight' value='target.value'}}> {{this.containerHeight}}
5+
Container Width: <input type='range' min="200" max="1000" value={{this.containerWidth}} oninput={{this.updateContainerWidth}}> {{this.containerWidth}}
6+
Container Height: <input type='range' min="200" max="1000" value={{this.containerHeight}} oninput={{this.updateContainerHeight}}> {{this.containerHeight}}
67
</p>
78
<p>
89
Item Height: {{this.itemHeight}}
@@ -18,7 +19,7 @@ Item Width: {{this.itemWidth}}
1819
@buffer={{1}}
1920
@cell-layout={{fixed-grid-layout this.itemWidth this.itemHeight}}
2021
>
21-
<:row as |item index|>
22+
<:row as |item|>
2223
<div class="list-item">
2324
{{dynamic-image item.imageSrc width=50 height=50}}
2425
{{item.name}}

tests/dummy/app/templates/loading-scroll-view.hbs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
{{!-- template-lint-disable no-inline-styles --}}
12
<div style="height:640px; width: 500px; overflow: hidden; position: relative">
23
<LoadingScrollView
3-
@hasMore={{hasMore}}
4-
@isLoadingMore={{isLoadingMore}}
5-
@loadMore={{action 'loadMore'}}
4+
@hasMore={{this.hasMore}}
5+
@isLoadingMore={{this.isLoadingMore}}
6+
@loadMore={{this.loadMore}}
67
@threshold={{100}}
78
>
8-
{{#each loadedStrings as |string|}}
9+
{{#each this.loadedStrings as |string|}}
910
<p>{{string}}</p>
1011
{{/each}}
1112
</LoadingScrollView>
1213
</div>
13-
{{#if isLoadingMore}}
14+
{{#if this.isLoadingMore}}
1415
<div style="color:red">
1516
LOADING MORE...
1617
</div>

tests/dummy/app/templates/scroll-view.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<button type="button" {{action 'toggleIsShort'}}>Toggle short content</button>
1+
{{!-- template-lint-disable no-inline-styles require-input-label --}}
2+
<button type="button" {{on 'click' this.toggleIsShort}}>Toggle short content</button>
23
<div style="height:640px; width: 320px; overflow: hidden; position: relative; border: 1px solid gray">
3-
<ScrollView as |scrollViewApi|>
4+
<ScrollView>
45
<p>
56
Accumsan augue ac vehicula convallis sed nam lacus sociosqu ex sapien penatibus, cursus nisi mauris facilisi lectus facilisis sem luctus pharetra. Duis montes tincidunt egestas vitae ultricies habitant eleifend molestie, litora natoque maximus purus tristique magna semper, aliquam eu parturient cras quam consectetur class. Quis ornare ut pulvinar malesuada semper non sollicitudin mattis consectetur, hendrerit tristique placerat ante tincidunt vel eleifend netus amet praesent, lorem curabitur auctor sit sed ad quam class. Montes vehicula proin aptent faucibus a est tellus potenti semper class, hendrerit integer adipiscing torquent magna quisque parturient aliquam dictum nascetur, magnis pharetra varius et etiam maecenas enim porttitor elit. Praesent nam in sit montes est curabitur mauris, congue phasellus augue proin non tortor suspendisse vulputate, nulla inceptos potenti commodo sollicitudin laoreet. Lacus curae class auctor ullamcorper sociosqu proin ut, nostra venenatis aenean vitae sit dis tempus, ornare consectetur sodales malesuada magna praesent.
67
</p>
7-
{{#unless isShort}}
8+
{{#unless this.isShort}}
89
<p>
910
Turpis in a dolor vivamus bibendum vel, maximus quam laoreet accumsan imperdiet ac lacus, sodales felis montes nullam lorem. Volutpat duis vivamus integer lorem feugiat bibendum suspendisse pretium in eu, vestibulum morbi hac dapibus facilisi leo ut blandit vulputate. Turpis urna at phasellus sociosqu imperdiet nec taciti primis, justo purus duis penatibus aliquam ligula cras maecenas magna, tristique mollis aptent dolor dictumst id nisi. Rhoncus sagittis per a pretium dapibus cubilia laoreet, velit placerat inceptos eleifend quisque lacus libero, cras aliquam hac arcu scelerisque mus. Rhoncus orci consequat ullamcorper arcu quis vivamus commodo integer facilisis, pharetra suspendisse erat enim ad non etiam maecenas, viverra ante consectetur imperdiet amet tincidunt sit conubia. Sollicitudin tempus platea fames penatibus conubia porta suspendisse condimentum bibendum aliquam nunc ex enim, placerat aliquet efficitur amet habitant iaculis ultricies finibus in nibh luctus inceptos. Egestas vel cursus commodo congue ridiculus rhoncus platea tristique praesent leo, sapien morbi ac metus magnis arcu nec mollis placerat magna vestibulum, fusce eros nisl risus lorem iaculis feugiat litora augue.
1011
</p>

tests/dummy/app/templates/virtual.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{!-- template-lint-disable require-input-label --}}
12
<h3>Simple Virtual</h3>
23
<button type="button" {{on 'click' this.makeSquare}}>Square</button>
34
<button type="button" {{on 'click' this.makeRow}}>Row</button>
@@ -6,8 +7,8 @@
67
<button type="button" {{on 'click' this.shuffle}}>Shuffle</button>
78
<button type="button" {{on 'click' this.swapCollection}}>Swap for another collection half the length</button>
89
<p>
9-
Container Width: <input type='range' min=200 max=1000 value={{this.containerWidth}} oninput={{action 'updateContainerWidth' value='target.value'}}> {{this.containerWidth}}
10-
Container Height: <input type='range' min=200 max=1000 value={{this.containerHeight}} oninput={{action 'updateContainerHeight' value='target.value'}}> {{this.containerHeight}}
10+
Container Width: <input type='range' min="200" max="1000" value={{this.containerWidth}} oninput={{this.updateContainerWidth}}> {{this.containerWidth}}
11+
Container Height: <input type='range' min="200" max="1000" value={{this.containerHeight}} oninput={{this.updateContainerHeight}}> {{this.containerHeight}}
1112
</p>
1213
<p>
1314
Item Height: {{this.itemHeight}}
@@ -23,7 +24,7 @@ Item Width: {{this.itemWidth}}
2324
@buffer={{1}}
2425
@cell-layout={{fixed-grid-layout this.itemWidth this.itemHeight}}
2526
>
26-
<:row as |item index|>
27+
<:row as |item|>
2728
<div class="list-item">
2829
{{item.name}}
2930
</div>

tests/integration/components/collection-scroll-view-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module('Integration | Component | collection-scroll-view', function (hooks) {
7676
@cell-layout={{fixed-grid-layout 320 100}}
7777
@revealService={{this.revealService}}
7878
>
79-
<:row as |item index|>
79+
<:row as |item|>
8080
<div class="list-item" data-list-item-id={{item.id}}>
8181
{{item.name}}
8282
</div>
@@ -174,7 +174,7 @@ module('Integration | Component | collection-scroll-view', function (hooks) {
174174
</h1>
175175
</:header>
176176
177-
<:row as |item index|>
177+
<:row as |item|>
178178
<div class="list-item" data-list-item-id={{item.id}}>
179179
{{item.name}}
180180
</div>

tests/integration/components/loading-scroll-view-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module('Integration | Component | loading-scroll-view', function (hooks) {
1818
this.set('loadMore', function () {});
1919
});
2020
const EXAMPLE_1_HBS = hbs`
21+
{{!-- template-lint-disable no-inline-styles --}}
2122
<div style={{html-safe (concat "width:320px; height:" this.viewportHeight "px; position:relative")}}>
2223
<LoadingScrollView
2324
@hasMore={{this.hasMore}}

tests/integration/components/scroll-view-test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module('Integration | Component | scroll-view', function (hooks) {
2727
this.set('initialScrollTop', null);
2828
});
2929
const EXAMPLE_1_HBS = hbs`
30+
{{!-- template-lint-disable no-inline-styles --}}
3031
<div style={{html-safe (concat "width:320px; height:" this.viewportHeight "px; position:relative")}}>
3132
<ScrollView
3233
@scrollChange={{optional this.scrollChange}}
@@ -38,24 +39,27 @@ module('Integration | Component | scroll-view', function (hooks) {
3839
One
3940
<button
4041
{{on 'click' scrollViewApi.scrollToBottom}}
42+
type="button"
4143
data-test-scroll-to-bottom-button
4244
>
4345
Scroll to Bottom
4446
</button>
4547
<button
4648
{{on 'click' (fn (optional scrollViewApi.scrollToElement) this.element3)}}
49+
type="button"
4750
data-test-scroll-to-element-button
4851
>
4952
Scroll to Element 3
5053
</button>
5154
</div>
5255
<div style="width:320px;height:200px">Two</div>
5356
<div id="element3" style="width:320px;height:200px">Three</div>
54-
<a style={{html-safe "display:block;width:320px;height:200px"}} data-test-link {{on 'click' (fn (optional this.onClickLink))}}>Four</a>
57+
<a href="#" style={{html-safe "display:block;width:320px;height:200px"}} data-test-link {{on 'click' (fn (optional this.onClickLink))}}>Four</a>
5558
<div style="width:320px;height:200px">
5659
Five
5760
<button
5861
{{on 'click' (fn (optional scrollViewApi.scrollToTop))}}
62+
type="button"
5963
data-test-scroll-to-top-button
6064
>
6165
Scroll to Top
@@ -137,6 +141,7 @@ module('Integration | Component | scroll-view', function (hooks) {
137141
test('it emits an action when scrolling to top, with scrollTopOffset set', async function (assert) {
138142
this.set('scrollTopOffset', 50);
139143
const template = hbs`
144+
{{!-- template-lint-disable no-inline-styles --}}
140145
<div style={{html-safe (concat "width:320px; height:" this.viewportHeight "px; position:relative")}}>
141146
<ScrollView @scrollTopOffset={{this.scrollTopOffset}} @scrolledToTopChange={{this.scrolledToTopChange}}>
142147
<div style="width:320px;height:400px">One</div>
@@ -189,6 +194,7 @@ module('Integration | Component | scroll-view', function (hooks) {
189194
test('it sets initial scrollTop to initialScrollTop value', async function (assert) {
190195
this.set('initialScrollTop', 50);
191196
const template = hbs`
197+
{{!-- template-lint-disable no-inline-styles --}}
192198
<div style={{html-safe (concat "width:320px; height:" this.viewportHeight "px; position:relative")}}>
193199
<ScrollView @initialScrollTop={{this.initialScrollTop}}>
194200
<div style="width:320px;height:400px">One</div>
@@ -230,6 +236,7 @@ module('Integration | Component | scroll-view', function (hooks) {
230236

231237
test('it renders content with height less than the height of the scroll container OK', async function (assert) {
232238
await render(hbs`
239+
{{!-- template-lint-disable no-inline-styles --}}
233240
<div style="width:320px; height:480px; position:relative">
234241
<ScrollView>
235242
<div style="width:320px;height:200px">One</div>
@@ -355,8 +362,9 @@ module('Integration | Component | scroll-view', function (hooks) {
355362

356363
test('swiping on a textarea does not cause scrolling', async function (assert) {
357364
let template = hbs`
365+
{{!-- template-lint-disable no-inline-styles require-input-label --}}
358366
<div style={{html-safe (concat "width:320px; height:" this.viewportHeight "px; position:relative")}}>
359-
<ScrollView as |scrollViewApi|>
367+
<ScrollView>
360368
<div style="width:320px;height:200px">
361369
<textarea style="width:320px;height:200px">
362370
</textarea>
@@ -376,6 +384,7 @@ module('Integration | Component | scroll-view', function (hooks) {
376384

377385
test('remembers scroll position based on key attribute', async function (assert) {
378386
const template = hbs`
387+
{{!-- template-lint-disable no-inline-styles --}}
379388
<div style={{html-safe (concat "width:320px; height:" this.viewportHeight "px; position:relative")}}>
380389
<ScrollView @key={{this.key}}>
381390
<div style="width:320px;height:400px">One</div>

tests/integration/components/vertical-scroll-bar-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module('Integration | Component | vertical-scroll-bar', function (hooks) {
2424
this.set('verticalPadding', 2);
2525
});
2626
const EXAMPLE_1_HBS = hbs`
27+
{{!-- template-lint-disable no-forbidden-elements --}}
2728
<style>
2829
.VerticalScrollBar {
2930
position: absolute;

0 commit comments

Comments
 (0)