Skip to content

Commit

Permalink
Lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Sep 16, 2024
1 parent a57e5c5 commit 587357d
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 16 deletions.
3 changes: 2 additions & 1 deletion reactiveweb/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Addon } from "@embroider/addon-dev/rollup";

import { babel } from "@rollup/plugin-babel";
import copy from "rollup-plugin-copy";
import { Addon } from "@embroider/addon-dev/rollup";

const addon = new Addon({
srcDir: "src",
Expand Down
23 changes: 20 additions & 3 deletions reactiveweb/src/-private/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,26 @@ export interface Class<Instance> {
new (...args: unknown[]): Instance;
}

// This is a bit of a lie, because we don't have an easy way to
// represent an object with no properties.
export type EmptyObject = {};
// --- Type utilities for component signatures --- //
// Type-only "symbol" to use with `EmptyObject` below, so that it is *not*
// equivalent to an empty interface.
declare const Empty: unique symbol;

/**
* This provides us a way to have a "fallback" which represents an empty object,
* without the downsides of how TS treats `{}`. Specifically: this will
* correctly leverage "excess property checking" so that, given a component
* which has no named args, if someone invokes it with any named args, they will
* get a type error.
*
* @internal This is exported so declaration emit works (if it were not emitted,
* declarations which fall back to it would not work). It is *not* intended for
* public usage, and the specific mechanics it uses may change at any time.
* The location of this export *is* part of the public API, because moving it
* will break existing declarations, but is not legal for end users to import
* themselves, so ***DO NOT RELY ON IT***.
*/
export type EmptyObject = { [Empty]?: true };

export type GetOrElse<Obj, K, Fallback> = K extends keyof Obj ? Obj[K] : Fallback;

Expand Down
1 change: 0 additions & 1 deletion reactiveweb/src/ember-concurrency.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable ember/no-get */
import { assert } from '@ember/debug';
import { associateDestroyableChild, registerDestructor } from '@ember/destroyable';
Expand Down
2 changes: 1 addition & 1 deletion reactiveweb/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function linkDecoratorFactory(child: Class<unknown>) {

function linkDecorator(
_prototype: object,
key: string | Symbol,
key: string | symbol,
descriptor: Stage1DecoratorDescriptor | undefined,
explicitChild?: Class<unknown>
): void {
Expand Down
2 changes: 2 additions & 0 deletions reactiveweb/src/resource/modifier/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export function modifier<S extends { Element?: Element; Args?: object }>(
export function modifier(fn: (element: Element, ...args: unknown[]) => void): ModifierLike<{
Element: Element;
Args: {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
Named: {};
Positional: [];
};
Expand All @@ -211,6 +212,7 @@ export function modifier(fn: (element: Element, ...args: unknown[]) => void): Mo
return fn as unknown as ModifierLike<{
Element: Element;
Args: {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
Named: {};
Positional: [];
};
Expand Down
1 change: 0 additions & 1 deletion reactiveweb/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { ArgsWrapper, Thunk } from 'ember-resources';

export const DEFAULT_THUNK = () => [];
Expand Down
9 changes: 0 additions & 9 deletions reactiveweb/unpublished-development-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,3 @@
import 'ember-source/types';
import 'ember-source/types/preview';
import '@glint/environment-ember-loose';

declare module '@glint/environment-ember-loose/registry' {
// Remove this once entries have been added! 👇
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export default interface Registry {
// Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates)
// See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons
}
}
1 change: 1 addition & 0 deletions tests/test-app/tests/utils/ember-concurrency/js-test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-expressions */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { tracked } from '@glimmer/tracking';
import { settled } from '@ember/test-helpers';
Expand Down
1 change: 1 addition & 0 deletions tests/test-app/tests/utils/function/js-test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-expressions */
import { tracked } from '@glimmer/tracking';
import { destroy, isDestroyed, isDestroying } from '@ember/destroyable';
import { settled } from '@ember/test-helpers';
Expand Down
1 change: 1 addition & 0 deletions tests/test-app/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '@glint/environment-ember-loose';
import type PageTitle from 'ember-page-title/template-registry';

declare module '@glint/environment-ember-loose/registry' {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export default interface Registry extends PageTitle {
/* your local loose-mode entries here */
}
Expand Down

0 comments on commit 587357d

Please sign in to comment.