Skip to content

Commit 73fc246

Browse files
Run template tag codemod, update types (#2327)
* renamed JS/TS to GJS/GTS * renamed HBS to GJS/GTS * applied codemod * add codemod to ignore-revs * Run prettier * Fix some lint * Try to fix some imports * Update tsconfig.json * Convert gts imports to ts * Add ember-route-template addon * Update contrast-checker-test.gjs * Get tests running * Fix some types * Fix sound playing * Fix some types * Update color-utils.ts * Remove loose mode declarations * Update import sorting * Keep fixing types * Run prettier * Update lint.yml * More types * Make glint happy * Update kuler-palette-row.gts
1 parent d65b1db commit 73fc246

163 files changed

Lines changed: 3087 additions & 2994 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.

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
81b7041f27d5c5590d41ae634a1d2ba8854879f2

.github/workflows/lint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
lint:
11-
name: JS and HBS
11+
name: JS, HBS, Prettier, Types
1212
runs-on: ubuntu-22.04
1313
timeout-minutes: 10
1414
steps:
@@ -23,3 +23,7 @@ jobs:
2323
run: pnpm lint:js
2424
- name: Lint HBS
2525
run: pnpm lint:hbs
26+
- name: Lint Prettier
27+
run: pnpm lint:format
28+
- name: Lint Types
29+
run: pnpm lint:types

.prettierrc.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ const importOrder = [
3333
swachInternals,
3434
];
3535
const importOrderParserPlugins = ['typescript', 'decorators-legacy'];
36-
const importOrderSeparation = true;
37-
const importOrderSortSpecifiers = true;
3836

3937
module.exports = {
4038
plugins: [
4139
'prettier-plugin-ember-template-tag',
42-
'@trivago/prettier-plugin-sort-imports',
40+
'@ianvs/prettier-plugin-sort-imports',
4341
],
4442
importOrder,
4543
importOrderParserPlugins,
46-
importOrderSeparation,
47-
importOrderSortSpecifiers,
4844
overrides: [
4945
{
5046
files: '*.{js,gjs,ts,gts,mjs,mts,cjs,cts}',

app/app.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import Application from '@ember/application';
2-
32
import { InitSentryForEmber } from '@sentry/ember';
43
import loadInitializers from 'ember-load-initializers';
54
import Resolver from 'ember-resolver';
6-
75
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';
8-
96
import config from 'swach/config/environment';
107

118
if (macroCondition(isDevelopingApp())) {

app/authenticators/cognito.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { service } from '@ember/service';
2-
32
import CognitoAuthenticator from 'ember-cognito/authenticators/cognito';
43

54
export default class CognitoAuthenticatorExtended extends CognitoAuthenticator {
Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
1+
import { on } from '@ember/modifier';
12
import { action } from '@ember/object';
23
import type Owner from '@ember/owner';
34
import Component from '@glimmer/component';
45
import { tracked } from '@glimmer/tracking';
5-
66
import type { IpcRenderer } from 'electron';
77

88
interface AboutSignature {
99
Element: HTMLDivElement;
1010
}
1111

1212
export default class AboutComponent extends Component<AboutSignature> {
13+
<template>
14+
<div class="text-xs">
15+
<h6 class="font-semibold mt-4 text-heading text-sm">
16+
About
17+
</h6>
18+
19+
<p class="mt-2">
20+
Version:
21+
{{this.version}}
22+
</p>
23+
24+
<p>
25+
Copyright ©
26+
{{this.copyrightYear}}
27+
Ship Shape Consulting LLC.
28+
</p>
29+
30+
<p>
31+
All rights reserved.
32+
</p>
33+
34+
<p>
35+
<a href class="hover:text-alt-hover" {{on "click" this.visitWebsite}}>
36+
https://swach.io/
37+
</a>
38+
</p>
39+
</div>
40+
</template>
1341
declare ipcRenderer: IpcRenderer;
1442

1543
copyrightYear = new Date().getFullYear();
@@ -38,9 +66,3 @@ export default class AboutComponent extends Component<AboutSignature> {
3866
}
3967
}
4068
}
41-
42-
declare module '@glint/environment-ember-loose/registry' {
43-
export default interface Registry {
44-
About: typeof AboutComponent;
45-
}
46-
}

app/components/about.hbs

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { hash } from '@ember/helper';
2+
import { on } from '@ember/modifier';
13
import { action, set } from '@ember/object';
24
import Component from '@glimmer/component';
3-
5+
// @ts-expect-error TODO: fix this
6+
import OneWayInputMask from 'ember-inputmask/_app_/components/one-way-input-mask.js';
47
import type { SelectedColorModel } from 'swach/components/rgb-input';
58
import { rgbaToHex } from 'swach/data-models/color';
69

@@ -10,11 +13,37 @@ interface AlphaInputSignature {
1013
selectedColor: SelectedColorModel;
1114
update: (value: string | number) => void;
1215
updateColor: () => void;
13-
value?: string;
16+
value?: number;
1417
};
1518
}
1619

1720
export default class AlphaInputComponent extends Component<AlphaInputSignature> {
21+
<template>
22+
<span class="input-prefix">
23+
A:
24+
</span>
25+
26+
<OneWayInputMask
27+
...attributes
28+
maxlength={{4}}
29+
@mask="9[.9[9]]"
30+
@options={{hash
31+
greedy=false
32+
isComplete=this.isComplete
33+
min=0
34+
max=1
35+
oncomplete=this.onComplete
36+
onincomplete=this.onIncomplete
37+
regex=this.alphaRegex
38+
showMaskOnFocus=false
39+
showMaskOnHover=false
40+
unmaskAsNumber=false
41+
}}
42+
@update={{@update}}
43+
@value={{@value}}
44+
{{on "keypress" this.enterPress}}
45+
/>
46+
</template>
1847
alphaRegex = /^[1]$|^[0]$|^(0\.[0-9]{1,2})$/;
1948

2049
@action
@@ -63,9 +92,3 @@ export default class AlphaInputComponent extends Component<AlphaInputSignature>
6392
set(this.args.selectedColor, `_a`, this.args.selectedColor.a);
6493
}
6594
}
66-
67-
declare module '@glint/environment-ember-loose/registry' {
68-
export default interface Registry {
69-
AlphaInput: typeof AlphaInputComponent;
70-
}
71-
}

app/components/alpha-input.hbs

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/components/animated-drag-sort-list.ts renamed to app/components/animated-drag-sort-list.gts

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
import { action, set } from '@ember/object';
2-
3-
import type Sprite from 'ember-animated/-private/sprite';
2+
import TransitionContext from 'ember-animated/-private/transition-context';
3+
import AnimatedContainer from 'ember-animated/components/animated-container';
4+
import AnimatedEach from 'ember-animated/components/animated-each';
45
import { easeOut } from 'ember-animated/easings/cosine';
56
import move from 'ember-animated/motions/move';
67
import { fadeOut } from 'ember-animated/motions/opacity';
8+
// @ts-expect-error TODO: fix this
9+
import DragSortItem from 'ember-drag-sort/components/drag-sort-item';
710
import DragSortList from 'ember-drag-sort/components/drag-sort-list';
811

912
export default class AnimatedDragSortList extends DragSortList {
13+
<template>
14+
{{!@glint-nocheck}}
15+
<AnimatedContainer ...attributes>
16+
{{#AnimatedEach @items duration=400 rules=this.rules as |item index|}}
17+
<DragSortItem
18+
@additionalArgs={{@additionalArgs}}
19+
@item={{item}}
20+
@index={{index}}
21+
@items={{@items}}
22+
@group={{@group}}
23+
@handle={{@handle}}
24+
@class={{@childClass}}
25+
@tagName={{@childTagName}}
26+
@isHorizontal={{@isHorizontal}}
27+
@isRtl={{@isRtl}}
28+
@draggingEnabled={{this.draggingEnabled}}
29+
@dragEndAction={{@dragEndAction}}
30+
@determineForeignPositionAction={{@determineForeignPositionAction}}
31+
@sourceOnly={{@sourceOnly}}
32+
>
33+
{{yield item index}}
34+
</DragSortItem>
35+
{{/AnimatedEach}}
36+
</AnimatedContainer>
37+
</template>
1038
didDrag = false;
1139

1240
dragEnter(event: Event): void {
@@ -31,11 +59,7 @@ export default class AnimatedDragSortList extends DragSortList {
3159
keptSprites,
3260
insertedSprites,
3361
removedSprites,
34-
}: {
35-
keptSprites: Array<Sprite>;
36-
insertedSprites: Array<Sprite>;
37-
removedSprites: Array<Sprite>;
38-
}): unknown {
62+
}: TransitionContext) {
3963
for (const sprite of insertedSprites) {
4064
if (sprite.finalBounds?.height) {
4165
sprite.startTranslatedBy(0, -sprite.finalBounds.height / 2);
@@ -53,9 +77,3 @@ export default class AnimatedDragSortList extends DragSortList {
5377
}
5478
}
5579
}
56-
57-
declare module '@glint/environment-ember-loose/registry' {
58-
export default interface Registry {
59-
AnimatedDragSortList: typeof AnimatedDragSortList;
60-
}
61-
}

0 commit comments

Comments
 (0)