Skip to content

Commit

Permalink
ember-cli-update to latest blueprints (#2624)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner authored Jan 28, 2025
1 parent d7057b5 commit fd1b72f
Show file tree
Hide file tree
Showing 114 changed files with 2,666 additions and 2,232 deletions.
2 changes: 1 addition & 1 deletion .ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
"isTypeScriptProject": true
}
23 changes: 0 additions & 23 deletions .eslintignore

This file was deleted.

85 changes: 0 additions & 85 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
- ember-lts-3.28
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-release
- ember-beta
- ember-canary
Expand Down
10 changes: 9 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
overrides: [
{
files: '*.{js,ts}',
files: '*.{js,gjs,ts,gts,mjs,mts,cjs,cts}',
options: {
singleQuote: true,
},
},
{
files: '*.{gjs,gts}',
options: {
singleQuote: true,
templateSingleQuote: false,
},
},
],
};
File renamed without changes.
5 changes: 3 additions & 2 deletions app/components/date-property-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export default class DatePropertyFieldComponent extends DatePicker {
onInsert(element: HTMLInputElement) {
super.onInsert(element);

// eslint-disable-next-line ember/no-runloop
scheduleOnce('afterRender', this, this._openFlatpickr);
}

_openFlatpickr() {
_openFlatpickr = () => {
this.flatpickrRef?.open();
}
};
}
11 changes: 5 additions & 6 deletions app/components/list-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ export default class ListContent extends Component<ListContentSignature> {
*/
@action
elementInserted() {
// eslint-disable-next-line ember/no-runloop
schedule('afterRender', this, this.setupHeight);
}

/**
* Set up the content height and listen to any updates to that property.
*/
@action
setupHeight() {
setupHeight = () => {
this.contentHeight = this.layoutService.contentHeight;
this.layoutService.on(
'content-height-update',
this,
this.updateContentHeight,
);
}
};

/**
* Triggered whenever the app's content height changes. This usually happens
Expand All @@ -90,8 +90,7 @@ export default class ListContent extends Component<ListContentSignature> {
*
* @param height The app's new content height
*/
@action
updateContentHeight(height: number) {
updateContentHeight = (height: number) => {
this.contentHeight = height;
}
};
}
6 changes: 3 additions & 3 deletions app/components/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export default class ListComponent extends Component {
/**
* Layout service used to listen to changes to the application
* layout such as resizing of the main nav or object inspector.
*
* @property layoutService
* @type {Service}
*/
@service('layout') layoutService;

Expand Down Expand Up @@ -120,6 +117,7 @@ export default class ListComponent extends Component {
let oldSchema = this.oldSchema;
let newSchema = this.schema;
if (newSchema && newSchema !== oldSchema) {
// eslint-disable-next-line ember/no-runloop
scheduleOnce('actions', this, this.setupColumns);
}
this.oldSchema = newSchema;
Expand All @@ -128,6 +126,7 @@ export default class ListComponent extends Component {
@action
elementInserted(el) {
this.el = el;
// eslint-disable-next-line ember/no-runloop
scheduleOnce('afterRender', this, this.setupColumns);
this.onResize = () => {
this.debounceColumnWidths.perform();
Expand Down Expand Up @@ -157,6 +156,7 @@ export default class ListComponent extends Component {
arr.push({
name,
title: name,
// eslint-disable-next-line ember/no-runloop
fn: bind(this, this.toggleColumnVisibility, id),
});
return arr;
Expand Down
43 changes: 26 additions & 17 deletions app/components/object-inspector/property.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return */
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import { action, computed } from '@ember/object';
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import { alias, equal } from '@ember/object/computed';
import { next } from '@ember/runloop';
import parseText from 'ember-inspector/utils/parse-text';

interface ObjectInspectorPropertyArgs {
model: any;
digDeeper: () => unknown;
gotoSource: () => void;
sendToConsole: () => void;
saveProperty: (
property: unknown,
value: unknown,
dataType: unknown
) => unknown;
interface ObjectInspectorPropertySignature {
Args: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
model: any;
digDeeper: () => unknown;
gotoSource: () => void;
sendToConsole: () => void;
saveProperty: (
property: unknown,
value: unknown,
dataType: unknown,
) => unknown;
};
}

export default class ObjectInspectorProperty extends Component<ObjectInspectorPropertyArgs> {
export default class ObjectInspectorProperty extends Component<ObjectInspectorPropertySignature> {
@tracked dateValue: Date | null = null;
@tracked isDepsExpanded = false;
@tracked isEdit = false;
Expand Down Expand Up @@ -66,10 +72,7 @@ export default class ObjectInspectorProperty extends Component<ObjectInspectorPr

@computed('args.model.dependentKeys.[]', 'isCalculated')
get hasDependentKeys() {
return (
this.args.model?.dependentKeys?.length &&
this.isCalculated
);
return this.args.model?.dependentKeys?.length && this.isCalculated;
}

get showDependentKeys() {
Expand Down Expand Up @@ -121,8 +124,11 @@ export default class ObjectInspectorProperty extends Component<ObjectInspectorPr
}

get cannotEdit() {
if (this.args.model.name === '...' || !this.isCalculated || this.readOnly) return true;
return !['type-string', 'type-number', 'type-boolean'].includes(this.args.model?.value?.type);
if (this.args.model.name === '...' || !this.isCalculated || this.readOnly)
return true;
return !['type-string', 'type-number', 'type-boolean'].includes(
this.args.model?.value?.type,
);
}

@action
Expand All @@ -143,12 +149,14 @@ export default class ObjectInspectorProperty extends Component<ObjectInspectorPr
return;
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
let value = this.args.model.value.inspect;

if (this.isString) {
value = this._quotedString(value);
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
this.txtValue = value;
this.isEdit = true;
}
Expand All @@ -168,6 +176,7 @@ export default class ObjectInspectorProperty extends Component<ObjectInspectorPr

@action
finishedEditing() {
// eslint-disable-next-line ember/no-runloop
next(() => {
this.isEdit = false;
});
Expand Down
7 changes: 6 additions & 1 deletion app/components/object-inspector/sort-properties.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import { map, sort } from '@ember/object/computed';
import Component from '@glimmer/component';
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import { set, computed } from '@ember/object';
import { A } from '@ember/array';

Expand All @@ -25,7 +27,10 @@ export default class SortProperties extends Component {
let props = A(this.sorted);
if (this.isArray) {
const item = props.find((x) => x.name === 'length');
props.removeObject(item);
const index = props.indexOf(item);
if (index !== -1) {
props.splice(index, 1);
}
props.splice(0, 0, item);
}
if (this.isArray && this.sorted.length > 100) {
Expand Down
6 changes: 4 additions & 2 deletions app/components/promise-item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* eslint-disable ember/no-get */
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import { computed, get } from '@ember/object';
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import { equal, gt, notEmpty } from '@ember/object/computed';
import Component from '@glimmer/component';
import { htmlSafe } from '@ember/template';
Expand Down Expand Up @@ -139,8 +142,7 @@ export default class PromiseItem extends Component {
let startedAt =
get(this, 'args.model.parent.settledAt') ||
get(this, 'args.model.createdAt');
let remaining =
get(this, 'args.model.settledAt').getTime() - startedAt.getTime();
let remaining = this.args.model.settledAt.getTime() - startedAt.getTime();
return remaining;
}
}
Loading

0 comments on commit fd1b72f

Please sign in to comment.