Skip to content

Commit bcd8127

Browse files
authored
refactor: add more rules to ESLint config, fix warnings (#4122)
1 parent b3d0c2a commit bcd8127

54 files changed

Lines changed: 127 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintrc.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"prefer-rest-params": "error",
157157
"prefer-spread": "error",
158158
"prefer-template": "error",
159+
"require-await": "error",
159160
"space-in-parens": ["error", "never"],
160161
"spaced-comment": ["error", "always"]
161162
},

‎packages/app-layout/test/app-layout.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('vaadin-app-layout', () => {
106106
expect(toggle.offsetHeight).to.be.greaterThan(0);
107107
});
108108

109-
it('should remove hidden attribute on navbar-bottom on resize', async () => {
109+
it('should remove hidden attribute on navbar-bottom on resize', () => {
110110
expect(layout.$.navbarBottom.hasAttribute('hidden')).to.be.true;
111111
window.dispatchEvent(new Event('resize'));
112112
expect(layout.$.navbarBottom.hasAttribute('hidden')).to.be.false;

‎packages/avatar-group/test/avatar-group.test.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ describe('avatar-group', () => {
7777
expect(items.length).to.equal(group.maxItemsVisible);
7878
});
7979

80-
it('should set abbr property on the overflow avatar', async () => {
80+
it('should set abbr property on the overflow avatar', () => {
8181
const overflow = group.$.overflow;
8282
expect(overflow.abbr).to.equal('+3');
8383
});
8484

85-
it('should set title attribute on the overflow avatar', async () => {
85+
it('should set title attribute on the overflow avatar', () => {
8686
const overflow = group.$.overflow;
8787
const items = group.items;
8888
expect(overflow.getAttribute('title')).to.equal([items[2].name, items[3].abbr, 'anonymous'].join('\n'));
8989
});
9090

91-
it('should show overlay on overflow avatar click', async () => {
91+
it('should show overlay on overflow avatar click', () => {
9292
const overflow = group.$.overflow;
9393
overflow.click();
9494
expect(overflow.hasAttribute('hidden')).to.be.false;

‎packages/charts/test/chart-element.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('vaadin-chart', () => {
4545
describe('creating element', () => {
4646
let chart;
4747

48-
beforeEach(async () => {
48+
beforeEach(() => {
4949
chart = document.createElement('vaadin-chart');
5050
});
5151

‎packages/charts/test/chart-properties.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ describe('vaadin-chart properties', () => {
543543
await oneEvent(chart, 'chart-load');
544544
});
545545

546-
it('should not show a message when lazily setting the property and the chart has data', async () => {
546+
it('should not show a message when lazily setting the property and the chart has data', () => {
547547
chart.emptyText = 'Empty Vaadin Chart';
548548
expect(chart.$.chart.querySelector('.highcharts-no-data > text')).not.to.exist;
549549
});

‎packages/charts/test/turbo-mode.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import '../vaadin-chart.js';
66
describe('turbo-mode', () => {
77
let chart;
88

9-
beforeEach(async () => {
9+
beforeEach(() => {
1010
sinon.stub(console, 'warn');
1111
});
1212

‎packages/checkbox-group/test/checkbox-group.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ describe('vaadin-checkbox-group', () => {
359359
});
360360

361361
describe('error message', () => {
362-
beforeEach(async () => {
362+
beforeEach(() => {
363363
group = fixtureSync(`<vaadin-checkbox-group></vaadin-checkbox-group>`);
364364
});
365365

@@ -383,7 +383,7 @@ describe('vaadin-checkbox-group', () => {
383383
});
384384

385385
describe('helper text', () => {
386-
beforeEach(async () => {
386+
beforeEach(() => {
387387
group = fixtureSync(`<vaadin-checkbox-group></vaadin-checkbox-group>`);
388388
});
389389

‎packages/combo-box/test/external-filtering.test.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('external filtering', () => {
144144
expect(getFocusedItemIndex(comboBox)).to.equal(-1);
145145
});
146146

147-
it('should commit the empty value', async () => {
147+
it('should commit the empty value', () => {
148148
setInputValue(comboBox, '');
149149
enter(comboBox.inputElement);
150150
expect(comboBox.value).to.equal('');
@@ -204,7 +204,7 @@ describe('external filtering', () => {
204204
expect(getFocusedItemIndex(comboBox)).to.equal(0);
205205
});
206206

207-
it('should commit the filtered value', async () => {
207+
it('should commit the filtered value', () => {
208208
setInputValue(comboBox, 'foo');
209209
enter(comboBox.inputElement);
210210
expect(comboBox.value).to.equal('foo');
@@ -216,7 +216,7 @@ describe('external filtering', () => {
216216
expect(getFocusedItemIndex(comboBox)).to.equal(-1);
217217
});
218218

219-
it('should commit an empty value', async () => {
219+
it('should commit an empty value', () => {
220220
setInputValue(comboBox, '');
221221
enter(comboBox.inputElement);
222222
expect(comboBox.value).to.equal('');

‎packages/combo-box/test/keyboard.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ describe('keyboard', () => {
422422
expect(keydownSpy.called).to.be.false;
423423
});
424424

425-
it('should not stop propagation of the keyboard enter event when input has a predefined option', async () => {
425+
it('should not stop propagation of the keyboard enter event when input has a predefined option', () => {
426426
setInputValue(comboBox, 'foo');
427427
expect(comboBox.opened).to.be.false;
428428
const keydownSpy = sinon.spy();

‎packages/combo-box/test/lazy-loading.test.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ describe('lazy loading', () => {
787787
await aTimeout(0);
788788
});
789789

790-
it('should render selectedItem as selected when setting it', async () => {
790+
it('should render selectedItem as selected when setting it', () => {
791791
const loadedItem = 'item 0';
792792
comboBox.selectedItem = loadedItem;
793793
flushComboBox(comboBox);
@@ -796,7 +796,7 @@ describe('lazy loading', () => {
796796
expect(items[0].item).to.deep.equal(loadedItem);
797797
});
798798

799-
it('should render selectedItem as selected when setting it while loading more items', async () => {
799+
it('should render selectedItem as selected when setting it while loading more items', () => {
800800
const alreadyLoadedItem = `item ${comboBox.pageSize - 1}`;
801801

802802
scrollToIndex(comboBox, comboBox.pageSize + 1);
@@ -813,7 +813,7 @@ describe('lazy loading', () => {
813813
});
814814

815815
describe('selectedItem (object items)', () => {
816-
beforeEach(async () => {
816+
beforeEach(() => {
817817
comboBox.itemIdPath = 'id';
818818
comboBox.dataProvider = asyncObjectDataProvider;
819819
});
@@ -834,7 +834,7 @@ describe('lazy loading', () => {
834834
await aTimeout(0);
835835
});
836836

837-
it('should render selectedItem as selected when setting it', async () => {
837+
it('should render selectedItem as selected when setting it', () => {
838838
const loadedItem = { id: 0, value: 'value 0', label: 'label 0' };
839839
comboBox.selectedItem = loadedItem;
840840
flushComboBox(comboBox);
@@ -843,7 +843,7 @@ describe('lazy loading', () => {
843843
expect(items[0].item).to.deep.equal(loadedItem);
844844
});
845845

846-
it('should render selectedItem as selected when setting it while loading more items', async () => {
846+
it('should render selectedItem as selected when setting it while loading more items', () => {
847847
const alreadyLoadedItem = {
848848
id: comboBox.pageSize - 1,
849849
value: `value ${comboBox.pageSize - 1}`,

0 commit comments

Comments
 (0)