Skip to content

Commit 309c177

Browse files
authored
Update to eslint 9 (#521)
This updates the linting setup to the flat-file config introduced by eslint 9. The config is based on the code in the ember-cli blueprints with some minor adjustments.
1 parent c35ea2b commit 309c177

14 files changed

+1023
-676
lines changed

.eslintignore

-15
This file was deleted.

.eslintrc.js

-61
This file was deleted.

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
plugins: ['prettier-plugin-ember-template-tag'],
55
overrides: [
66
{
7-
files: '*.{js,ts,gjs,gts}',
7+
files: '*.{js,ts,gjs,gts,mjs,cjs}',
88
options: {
99
singleQuote: true,
1010
templateSingleQuote: false,

addon/components/au-date-picker.gts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default class AuDatePicker extends Component<AuDatePickerSignature> {
9191

9292
constructor(owner: unknown, args: AuDatePickerSignature['Args']) {
9393
super(owner, args);
94-
this.registerDuetDatePicker();
94+
void this.registerDuetDatePicker();
9595
}
9696

9797
get adapter() {

addon/components/au-file-upload.gts

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class AuFileUpload extends Component<AuFileUploadSignature> {
9393

9494
@action
9595
upload(file: UploadFile): void | undefined {
96-
this.uploadTask.perform(file);
96+
void this.uploadTask.perform(file);
9797
}
9898

9999
uploadTask = task(async (file: UploadFile) => {
@@ -114,10 +114,10 @@ export default class AuFileUpload extends Component<AuFileUploadSignature> {
114114
const response = await file.upload(this.endPoint, {
115115
contentType: 'multipart/form-data',
116116
});
117-
const body = await response.json();
117+
const body = (await response.json()) as { data: { id: number } };
118118
const fileId = body?.data?.id;
119119
return fileId;
120-
} catch (e) {
120+
} catch {
121121
this.addError(file);
122122
this.removeFileFromQueue(file);
123123
return null;

addon/components/au-toaster.gjs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-undef -- This is a workaround for a false-positive bug: https://github.com/ember-cli/eslint-plugin-ember/issues/1747 */
21
import { AuAlert } from '@appuniversum/ember-appuniversum';
32
import { fn } from '@ember/helper';
43
import { inject as service } from '@ember/service';

addon/private/modifiers/floating-ui.ts

+62-64
Original file line numberDiff line numberDiff line change
@@ -99,77 +99,75 @@ function floatingUi(
9999
);
100100
}
101101

102-
const update = async () => {
103-
const { x, y, placement, middlewareData } = await computePosition(
104-
referenceElement,
105-
floatingElement,
106-
{
107-
middleware,
108-
placement: defaultPlacement,
109-
},
110-
);
111-
112-
Object.assign(floatingElement.style, {
113-
transform: `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`,
114-
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible',
115-
});
116-
117-
if (middlewareData.arrow) {
118-
const { x } = middlewareData.arrow;
119-
const [side, alignment] = placement.split('-') as [
120-
'top' | 'bottom',
121-
'string' | undefined,
122-
];
123-
const isAligned = alignment != null;
124-
125-
const unsetSides = {
126-
top: '',
127-
bottom: '',
128-
left: '',
129-
right: '',
130-
};
131-
132-
const rotation = {
133-
top: '180deg',
134-
bottom: '0deg',
135-
}[side];
136-
137-
Object.assign(arrowElement!.style, {
138-
...unsetSides,
139-
transform: `rotate(${rotation})`,
102+
const update = () => {
103+
void computePosition(referenceElement, floatingElement, {
104+
middleware,
105+
placement: defaultPlacement,
106+
}).then(({ x, y, placement, middlewareData }) => {
107+
Object.assign(floatingElement.style, {
108+
transform: `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`,
109+
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible',
140110
});
141111

142-
if (isAligned) {
143-
const crossSide = {
144-
'top-start': 'left',
145-
'top-end': 'right',
146-
'bottom-start': 'left',
147-
'bottom-end': 'right',
148-
}[placement as 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'];
112+
if (middlewareData.arrow) {
113+
const { x } = middlewareData.arrow;
114+
const [side, alignment] = placement.split('-') as [
115+
'top' | 'bottom',
116+
'string' | undefined,
117+
];
118+
const isAligned = alignment != null;
119+
120+
const unsetSides = {
121+
top: '',
122+
bottom: '',
123+
left: '',
124+
right: '',
125+
};
126+
127+
const rotation = {
128+
top: '180deg',
129+
bottom: '0deg',
130+
}[side];
149131

150132
Object.assign(arrowElement!.style, {
151-
[crossSide]:
152-
typeof options.arrow?.position === 'string'
153-
? options.arrow.position
154-
: `${options.arrow?.position}px`,
155-
});
156-
} else {
157-
Object.assign(arrowElement!.style, {
158-
left: x != null ? `${x}px` : '',
133+
...unsetSides,
134+
transform: `rotate(${rotation})`,
159135
});
160-
}
161-
162-
const mainSide = {
163-
top: 'bottom',
164-
bottom: 'top',
165-
}[side];
166136

167-
if (options.arrow?.offset) {
168-
Object.assign(arrowElement!.style, {
169-
[mainSide]: `${-options.arrow?.offset}px`,
170-
});
137+
if (isAligned) {
138+
const crossSide = {
139+
'top-start': 'left',
140+
'top-end': 'right',
141+
'bottom-start': 'left',
142+
'bottom-end': 'right',
143+
}[
144+
placement as 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'
145+
];
146+
147+
Object.assign(arrowElement!.style, {
148+
[crossSide]:
149+
typeof options.arrow?.position === 'string'
150+
? options.arrow.position
151+
: `${options.arrow?.position}px`,
152+
});
153+
} else {
154+
Object.assign(arrowElement!.style, {
155+
left: x != null ? `${x}px` : '',
156+
});
157+
}
158+
159+
const mainSide = {
160+
top: 'bottom',
161+
bottom: 'top',
162+
}[side];
163+
164+
if (options.arrow?.offset) {
165+
Object.assign(arrowElement!.style, {
166+
[mainSide]: `${-options.arrow?.offset}px`,
167+
});
168+
}
171169
}
172-
}
170+
});
173171
};
174172

175173
const cleanup = autoUpdate(referenceElement, floatingElement, update);

0 commit comments

Comments
 (0)