Skip to content

Commit 1c1ad1c

Browse files
Merge pull request #1020 from NullVoxPopuli/fix-ci
lint:fix
2 parents d919158 + ebfdb00 commit 1c1ad1c

File tree

21 files changed

+60
-60
lines changed

21 files changed

+60
-60
lines changed

ember-resources/src/core/cell.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class ReadonlyCell<Value> implements Reactive<Value> {
1010

1111
toHTML(): string {
1212
assert(
13-
'Not a valid API. Please access either .current or .read() if the value of this Cell is needed'
13+
'Not a valid API. Please access either .current or .read() if the value of this Cell is needed',
1414
);
1515
}
1616

@@ -32,7 +32,7 @@ export class Cell<Value = unknown> implements Reactive<Value> {
3232

3333
toHTML(): string {
3434
assert(
35-
'Not a valid API. Please access either .current or .read() if the value of this Cell is needed'
35+
'Not a valid API. Please access either .current or .read() if the value of this Cell is needed',
3636
);
3737
}
3838

@@ -51,7 +51,7 @@ export class Cell<Value = unknown> implements Reactive<Value> {
5151
toggle = () => {
5252
assert(
5353
`toggle can only be used when 'current' is a boolean type`,
54-
typeof this.current === 'boolean' || this.current === undefined
54+
typeof this.current === 'boolean' || this.current === undefined,
5555
);
5656

5757
(this.current as boolean) = !this.current;

ember-resources/src/core/class-based/resource.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class Resource<Args = unknown> {
192192
*/
193193
static from<SomeResource extends Resource<any>>(
194194
this: Constructor<SomeResource>,
195-
thunk: AsThunk<ArgsFrom<SomeResource>>
195+
thunk: AsThunk<ArgsFrom<SomeResource>>,
196196
): SomeResource;
197197

198198
/**
@@ -241,13 +241,13 @@ export class Resource<Args = unknown> {
241241
static from<SomeResource extends Resource<any>>(
242242
this: Constructor<SomeResource>,
243243
context: unknown,
244-
thunk: AsThunk<ArgsFrom<SomeResource>>
244+
thunk: AsThunk<ArgsFrom<SomeResource>>,
245245
): SomeResource;
246246

247247
static from<SomeResource extends Resource<any>>(
248248
this: Constructor<SomeResource>,
249249
contextOrThunk: unknown | AsThunk<ArgsFrom<SomeResource>>,
250-
thunkOrUndefined?: undefined | AsThunk<ArgsFrom<SomeResource>>
250+
thunkOrUndefined?: undefined | AsThunk<ArgsFrom<SomeResource>>,
251251
): SomeResource {
252252
/**
253253
* This first branch is for
@@ -338,12 +338,12 @@ export class Resource<Args = unknown> {
338338
function resourceOf<SomeResource extends Resource<unknown>>(
339339
context: unknown,
340340
klass: Constructor<SomeResource>,
341-
thunk?: Thunk
341+
thunk?: Thunk,
342342
): SomeResource {
343343
assert(
344344
`Expected second argument, klass, to be a Resource. ` +
345345
`Instead, received some ${typeof klass}, ${klass.name}`,
346-
klass.prototype instanceof Resource
346+
klass.prototype instanceof Resource,
347347
);
348348

349349
let cache: Cache<SomeResource>;

ember-resources/src/core/function-based/immediate-invocation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class ResourceInvokerManager {
130130
* ```
131131
*/
132132
export function resourceFactory<Value = unknown, Args extends any[] = any[]>(
133-
wrapperFn: (...args: Args) => ReturnType<typeof resource<Value>>
133+
wrapperFn: (...args: Args) => ReturnType<typeof resource<Value>>,
134134
/**
135135
* This is a bonkers return type.
136136
* Here are the scenarios:

ember-resources/src/core/function-based/manager.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ class FunctionResourceManager {
7979
const use: ResourceAPI['use'] = (usable) => {
8080
assert(
8181
`Expected the resource's \`use(...)\` utility to have been passed an object, but a \`${typeof usable}\` was passed.`,
82-
typeof usable === 'object'
82+
typeof usable === 'object',
8383
);
8484
assert(
8585
`Expected the resource's \`use(...)\` utility to have been passed a truthy value, instead was passed: ${usable}.`,
86-
usable
86+
usable,
8787
);
8888
assert(
8989
`Expected the resource's \`use(...)\` utility to have been passed another resource, but something else was passed.`,
90-
INTERNAL in usable
90+
INTERNAL in usable,
9191
);
9292

9393
let previousCache = usableCache.get(usable);

ember-resources/src/core/function-based/resource.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ export function resource<Value>(context: object, setup: ResourceFunction<Value>)
166166
*/
167167
export function resource<Value>(
168168
context: object | ResourceFunction<Value>,
169-
setup?: ResourceFunction<Value>
169+
setup?: ResourceFunction<Value>,
170170
): Value | InternalFunctionResourceConfig<Value> | ResourceFn<Value> {
171171
if (!setup) {
172172
assert(
173173
`When using \`resource\` with @use, ` +
174174
`the first argument to \`resource\` must be a function. ` +
175175
`Instead, a ${typeof context} was received.`,
176-
typeof context === 'function'
176+
typeof context === 'function',
177177
);
178178

179179
let internalConfig: InternalFunctionResourceConfig<Value> = {
@@ -204,12 +204,12 @@ export function resource<Value>(
204204
`Mismatched argument types passed to \`resource\`. ` +
205205
`Expected the first arg, the context, to be a type of object. This is usually the \`this\`. ` +
206206
`Received ${typeof context} instead.`,
207-
typeof context === 'object'
207+
typeof context === 'object',
208208
);
209209
assert(
210210
`Mismatched argument type passed to \`resource\`. ` +
211211
`Expected the second arg to be a function but instead received ${typeof setup}.`,
212-
typeof setup === 'function'
212+
typeof setup === 'function',
213213
);
214214

215215
let internalConfig: InternalFunctionResourceConfig<Value> = {

ember-resources/src/core/function-based/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { InternalFunctionResourceConfig } from './types';
1616
*/
1717
export function wrapForPlainUsage<Value>(
1818
context: object,
19-
setup: InternalFunctionResourceConfig<Value>
19+
setup: InternalFunctionResourceConfig<Value>,
2020
) {
2121
let cache: Cache;
2222

ember-resources/src/core/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface Stage1DecoratorDescriptor {
2626
export type Stage1Decorator = (
2727
prototype: object,
2828
key: string | symbol,
29-
descriptor?: Stage1DecoratorDescriptor
29+
descriptor?: Stage1DecoratorDescriptor,
3030
) => any;
3131

3232
export interface ClassResourceConfig {

ember-resources/src/core/use.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function use<Value>(definition: Value | (() => Value)): PropertyDecorator
5454
export function use<Prototype, Key>(
5555
prototype: NonInstanceType<Prototype>,
5656
key: DecoratorKey<Key>,
57-
descriptor?: Stage1DecoratorDescriptor
57+
descriptor?: Stage1DecoratorDescriptor,
5858
): void;
5959

6060
/**
@@ -78,7 +78,7 @@ export function use<Prototype, Key>(
7878
export function use<Value>(
7979
parent: object,
8080
definition: Value | (() => Value),
81-
_?: never
81+
_?: never,
8282
): Reactive<Value extends Reactive<any> ? Value['current'] : Value>;
8383

8484
export function use(
@@ -117,7 +117,7 @@ function getCurrentValue<Value>(value: Value | Reactive<Value>): Value {
117117

118118
function classContextLink<Value>(
119119
context: object,
120-
definition: Value | (() => Value)
120+
definition: Value | (() => Value),
121121
): Reactive<Value> {
122122
let cache: ReturnType<typeof invokeHelper>;
123123

@@ -138,7 +138,7 @@ function argumentToDecorator<Value>(definition: Value | (() => Value)): Property
138138
return (
139139
_prototype: object,
140140
key: string | symbol,
141-
descriptor?: Stage1DecoratorDescriptor
141+
descriptor?: Stage1DecoratorDescriptor,
142142
): void => {
143143
// TS's types for decorators use the Stage2 implementation, even though Babel uses Stage 1
144144
if (!descriptor) return;
@@ -148,7 +148,7 @@ function argumentToDecorator<Value>(definition: Value | (() => Value)): Property
148148
assert(
149149
`When @use(...) is passed a resource, an initialized value is not allowed. ` +
150150
`\`@use(Clock) time;`,
151-
!descriptor.initializer
151+
!descriptor.initializer,
152152
);
153153

154154
let newDescriptor = descriptorGetter(definition);
@@ -171,7 +171,7 @@ function descriptorGetter(initializer: unknown | (() => unknown)) {
171171

172172
assert(
173173
`Expected initialized value under @use to have used either the \`resource\` wrapper function, or a \`Resource.from\` call`,
174-
INTERNAL in config
174+
INTERNAL in config,
175175
);
176176

177177
if (config.type === 'function-based') {
@@ -199,7 +199,7 @@ function descriptorGetter(initializer: unknown | (() => unknown)) {
199199
function initializerDecorator(
200200
_prototype: object,
201201
key: string | symbol,
202-
descriptor?: Stage1DecoratorDescriptor
202+
descriptor?: Stage1DecoratorDescriptor,
203203
): void {
204204
// TS's types for decorators use the Stage2 implementation, even though Babel uses Stage 1
205205
if (!descriptor) return;
@@ -212,7 +212,7 @@ function initializerDecorator(
212212
`@use may only be used on initialized properties. For example, ` +
213213
`\`@use foo = resource(() => { ... })\` or ` +
214214
`\`@use foo = SomeResource.from(() => { ... });\``,
215-
initializer
215+
initializer,
216216
);
217217

218218
return descriptorGetter(initializer) as unknown as void /* Thanks, TS and Stage 2 Decorators */;

ember-resources/src/link.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function linkDecorator(
140140
_prototype: object,
141141
key: string | Symbol,
142142
descriptor: Stage1DecoratorDescriptor | undefined,
143-
explicitChild?: Class<unknown>
143+
explicitChild?: Class<unknown>,
144144
): void {
145145
assert(`@link is a stage 1 decorator, and requires a descriptor`, descriptor);
146146
assert(`@link can only be used with string-keys`, typeof key === 'string');
@@ -150,7 +150,7 @@ function linkDecorator(
150150
assert(
151151
`@link requires an initializer or be used as a decorator factory (\`@link(...))\`). For example, ` +
152152
`\`@link foo = new MyClass();\` or \`@link(MyClass) foo;\``,
153-
initializer || explicitChild
153+
initializer || explicitChild,
154154
);
155155

156156
let caches = new WeakMap<object, any>();

ember-resources/src/modifier/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type ArgsForFn<S> = S extends { Args?: object }
6464
*
6565
*/
6666
export function modifier<El extends Element, Args extends unknown[] = unknown[]>(
67-
fn: (element: El, ...args: Args) => void
67+
fn: (element: El, ...args: Args) => void,
6868
): ModifierLike<{
6969
Element: El;
7070
Args: {
@@ -112,7 +112,7 @@ export function modifier<El extends Element, Args extends unknown[] = unknown[]>
112112
*
113113
*/
114114
export function modifier<S extends { Element?: Element }>(
115-
fn: (element: ElementFor<S>, ...args: ArgsForFn<S>) => ReturnType<typeof resource>
115+
fn: (element: ElementFor<S>, ...args: ArgsForFn<S>) => ReturnType<typeof resource>,
116116
): ModifierLike<S>;
117117
/**
118118
* A resource-based API for building modifiers.
@@ -153,7 +153,7 @@ export function modifier<S extends { Element?: Element }>(
153153
*
154154
*/
155155
export function modifier<S extends { Args?: object }>(
156-
fn: (element: ElementFor<S>, ...args: ArgsForFn<S>) => ReturnType<typeof resource>
156+
fn: (element: ElementFor<S>, ...args: ArgsForFn<S>) => ReturnType<typeof resource>,
157157
): ModifierLike<S>;
158158
/**
159159
* A resource-based API for building modifiers.
@@ -194,7 +194,7 @@ export function modifier<S extends { Args?: object }>(
194194
*
195195
*/
196196
export function modifier<S extends { Element?: Element; Args?: object }>(
197-
fn: (element: ElementFor<S>, ...args: ArgsForFn<S>) => ReturnType<typeof resource>
197+
fn: (element: ElementFor<S>, ...args: ArgsForFn<S>) => ReturnType<typeof resource>,
198198
): ModifierLike<S>;
199199

200200
export function modifier(fn: (element: Element, ...args: unknown[]) => void): ModifierLike<{
@@ -223,5 +223,5 @@ export function modifier(fn: (element: Element, ...args: unknown[]) => void): Mo
223223
export type FunctionBasedModifierDefinition<S> = (
224224
element: ElementFor<S>,
225225
positional: PositionalArgs<S>,
226-
named: NamedArgs<S>
226+
named: NamedArgs<S>,
227227
) => void;

ember-resources/src/service.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function service(resource: unknown) {
121121
return function legacyServiceDecorator(
122122
_prototype: object,
123123
key: string,
124-
descriptor?: Stage1DecoratorDescriptor
124+
descriptor?: Stage1DecoratorDescriptor,
125125
) {
126126
if (!descriptor) return;
127127

@@ -130,12 +130,12 @@ export function service(resource: unknown) {
130130
assert(
131131
`@service(...) may not be used with an initializer. For example, ` +
132132
`\`@service(MyService) property;\``,
133-
!descriptor.initializer
133+
!descriptor.initializer,
134134
);
135135

136136
assert(
137137
`Expected passed resource to be a valid resource definition.`,
138-
typeof resource === 'function' || (typeof resource === 'object' && resource !== null)
138+
typeof resource === 'function' || (typeof resource === 'object' && resource !== null),
139139
);
140140

141141
return {
@@ -146,7 +146,7 @@ export function service(resource: unknown) {
146146
`owner was not found on instance of ${this.constructor.name}. ` +
147147
`Has it been linked up correctly with setOwner?` +
148148
`If this error has occured in a framework-controlled class, something has gone wrong.`,
149-
owner
149+
owner,
150150
);
151151

152152
assert(`Resource definition is invalid`, isResourceType(resource));
@@ -171,7 +171,7 @@ export function service(resource: unknown) {
171171
assert(
172172
`When using resources with @service(...), do not call .from() on class-based resources. ` +
173173
`Resources used as services may not take arguments.`,
174-
resource.type === 'function-based'
174+
resource.type === 'function-based',
175175
);
176176

177177
cache = invokeHelper(owner, resource);
@@ -180,15 +180,15 @@ export function service(resource: unknown) {
180180
} else if ((resource as any).prototype instanceof Resource) {
181181
assert(
182182
`The .from() method on a type of Resource has been removed or altered. This is not allowed.`,
183-
'from' in resource && resource.from === Resource.from
183+
'from' in resource && resource.from === Resource.from,
184184
);
185185

186186
/**
187187
* We do a lot of lying internally to make TypeScript nice for consumers.
188188
* But it does mean that we have to cast in our own code.
189189
*/
190190
let { definition } = (resource as typeof Resource).from(
191-
() => []
191+
() => [],
192192
) as unknown as ClassResourceConfig;
193193

194194
cache = invokeHelper(owner, definition);
@@ -238,7 +238,7 @@ interface RegisterOptions {
238238
export function serviceOverride(owner: Owner, { original, replacement }: RegisterOptions) {
239239
if (macroCondition(!isTesting() && !isDevelopingApp())) {
240240
throw new Error(
241-
'@service is experimental and `serviceOverride` is not available in production builds.'
241+
'@service is experimental and `serviceOverride` is not available in production builds.',
242242
);
243243
}
244244

ember-resources/src/util/ember-concurrency.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ import type { Cache } from '../core/types';
6868
export function task<
6969
Return = unknown,
7070
Args extends unknown[] = unknown[],
71-
LocalTask extends TaskIsh<Args, Return> = TaskIsh<Args, Return>
71+
LocalTask extends TaskIsh<Args, Return> = TaskIsh<Args, Return>,
7272
>(context: object, task: LocalTask, thunk?: () => Args) {
7373
assert(`Task does not have a perform method. Is it actually a task?`, 'perform' in task);
7474

@@ -85,7 +85,7 @@ const TASK_CACHE = new WeakMap<object, any>();
8585
function buildUnproxiedTaskResource<
8686
ArgsList extends any[],
8787
Return,
88-
LocalTask extends TaskIsh<ArgsList, Return> = TaskIsh<ArgsList, Return>
88+
LocalTask extends TaskIsh<ArgsList, Return> = TaskIsh<ArgsList, Return>,
8989
>(context: object, task: LocalTask, thunk: () => ArgsList) {
9090
type LocalResource = TaskResource<ArgsList, Return, LocalTask>;
9191
type Klass = new (...args: unknown[]) => LocalResource;
@@ -128,7 +128,7 @@ export function proxyClass<
128128
ArgsList,
129129
Return,
130130
LocalTask
131-
>
131+
>,
132132
>(target: { value: Instance }) {
133133
/*
134134
* This proxy defaults to returning the underlying data on
@@ -216,7 +216,7 @@ export const TASK = Symbol('TASK');
216216
export class TaskResource<
217217
Args extends any[],
218218
Return,
219-
LocalTask extends TaskIsh<Args, Return>
219+
LocalTask extends TaskIsh<Args, Return>,
220220
> extends Resource<{
221221
positional: Args;
222222
}> {

ember-resources/src/util/helper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type Get<T, K, Otherwise = unknown> = K extends keyof T ? T[K] : Otherwise;
6464
export function helper<T = unknown, S = InferSignature<T>, Return = Get<S, 'Return'>>(
6565
context: object,
6666
helper: T,
67-
thunk: Thunk = DEFAULT_THUNK
67+
thunk: Thunk = DEFAULT_THUNK,
6868
): { value: Return } {
6969
let resource: Cache<unknown>;
7070

0 commit comments

Comments
 (0)