Skip to content

Commit

Permalink
Fixup linting issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Dec 4, 2020
1 parent 798e404 commit 941f801
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const registeredHooks = new Map<string, Set<Hook>>();
* @param {string} label A label to help identify the hook.
* @returns {string} The compound key for the helper.
*/
function getHelperKey(helperName: string, label: string) {
function getHelperKey(helperName: string, label: string): string {
return `${helperName}:${label}`;
}

Expand Down Expand Up @@ -59,7 +59,7 @@ export function registerHook(helperName: string, label: HookLabel, hook: Hook):
*/
export function runHooks(helperName: string, label: HookLabel, ...args: any[]): Promise<void> {
let hooks = registeredHooks.get(getHelperKey(helperName, label)) || new Set<Hook>();
let promises = [];
let promises: Array<void | Promise<void>> = [];

hooks.forEach(hook => {
let hookResult = hook(...args);
Expand Down
12 changes: 7 additions & 5 deletions addon-test-support/@ember/test-helpers/-utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* globals Promise */

const HAS_PROMISE = typeof Promise === 'function';

import RSVP from 'rsvp';
import { run } from '@ember/runloop';

const HAS_PROMISE =
typeof Promise === 'function' &&
// @ts-ignore this is checking if someone has explicitly done `window.Promise = window.Promise || Ember.RSVP.Promise
Promise !== RSVP.Promise;

import { Promise as PromisePolyfill } from 'es6-promise';

const _Promise: typeof Promise =
HAS_PROMISE && Promise !== RSVP.Promise ? Promise : (PromisePolyfill as typeof Promise);
const _Promise: typeof Promise = HAS_PROMISE ? Promise : (PromisePolyfill as typeof Promise);

export { _Promise as Promise };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { run } from '@ember/runloop';
import Ember from 'ember';
import global from './global';
import { BaseContext, TestContext, isTestContext, getContext } from './setup-context';
import { ensureRenderingScheduled, Promise } from './-utils';
import { Promise } from './-utils';
import settled from './settled';
import { hbs, TemplateFactory } from 'ember-cli-htmlbars';
import getRootElement from './dom/get-root-element';
Expand Down

0 comments on commit 941f801

Please sign in to comment.