Skip to content

Commit

Permalink
typescript: inline types
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Feb 20, 2023
1 parent 4d1e994 commit bbef9a6
Show file tree
Hide file tree
Showing 180 changed files with 691 additions and 609 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Expand Up @@ -14,6 +14,8 @@ module.exports = {
plugins: ['ember-internal', 'import', 'qunit', 'disable-features'],
rules: {
'no-console': 'error',
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
'no-implicit-coercion': 'error',
'no-new-wrappers': 'error',
'no-unused-vars': 'error',
Expand Down Expand Up @@ -56,7 +58,11 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
// '@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'inline-type-imports' },
],

// TODO: Enable and fix these rules
// Typescript provides better types with these rules enabled
Expand Down
19 changes: 10 additions & 9 deletions packages/@ember/-internals/container/lib/container.ts
@@ -1,16 +1,17 @@
import type {
InternalFactory,
FactoryClass,
InternalOwner,
RegisterOptions,
FactoryManager,
FullName,
import {
type InternalFactory,
type FactoryClass,
type InternalOwner,
type RegisterOptions,
type FactoryManager,
type FullName,
setOwner,
} from '@ember/-internals/owner';
import { setOwner } from '@ember/-internals/owner';

import { dictionary } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import type { DebugRegistry } from './registry';
import { type DebugRegistry } from './registry';
import type Registry from './registry';

interface LeakTracking {
Expand Down
20 changes: 10 additions & 10 deletions packages/@ember/-internals/container/lib/registry.ts
@@ -1,17 +1,17 @@
import type {
FactoryClass,
FullName,
InternalFactory,
KnownForTypeResult,
RegisterOptions,
Resolver,
import {
type FactoryClass,
type FullName,
type InternalFactory,
type KnownForTypeResult,
type RegisterOptions,
type Resolver,
} from '@ember/-internals/owner';
import { dictionary, intern } from '@ember/-internals/utils';
import { assert, deprecate } from '@ember/debug';
import type { set } from '@ember/object';
import { type set } from '@ember/object';
import { DEBUG } from '@glimmer/env';
import type { ContainerOptions, LazyInjection } from './container';
import Container from './container';

import Container, { type ContainerOptions, type LazyInjection } from './container';

export interface Injection {
property: string;
Expand Down
44 changes: 25 additions & 19 deletions packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
Expand Up @@ -9,24 +9,30 @@ import { addChildView, setElementView, setViewElement } from '@ember/-internals/
import { assert, debugFreeze } from '@ember/debug';
import { _instrumentStart } from '@ember/instrumentation';
import { DEBUG } from '@glimmer/env';
import type {
Bounds,
CapturedArguments,
CompilableProgram,
Destroyable,
ElementOperations,
Environment,
InternalComponentCapabilities,
Option,
PreparedArguments,
TemplateFactory,
VMArguments,
WithCreateInstance,
WithDynamicLayout,
WithDynamicTagName,
import {
type Bounds,
type CapturedArguments,
type CompilableProgram,
type Destroyable,
type ElementOperations,
type Environment,
type InternalComponentCapabilities,
type Option,
type PreparedArguments,
type TemplateFactory,
type VMArguments,
type WithCreateInstance,
type WithDynamicLayout,
type WithDynamicTagName,
} from '@glimmer/interfaces';
import type { Reference } from '@glimmer/reference';
import { childRefFor, createComputeRef, createPrimitiveRef, valueForRef } from '@glimmer/reference';
import {
type Reference,
childRefFor,
createComputeRef,
createPrimitiveRef,
valueForRef,
} from '@glimmer/reference';

import { reifyPositional } from '@glimmer/runtime';
import { EMPTY_ARRAY, unwrapTemplate } from '@glimmer/util';
import {
Expand All @@ -38,9 +44,9 @@ import {
validateTag,
valueForTag,
} from '@glimmer/validator';
import type { SimpleElement } from '@simple-dom/interface';
import { type SimpleElement } from '@simple-dom/interface';
import type Component from '../component';
import type { DynamicScope } from '../renderer';
import { type DynamicScope } from '../renderer';
import type RuntimeResolver from '../resolver';
import { isTemplateFactory } from '../template';
import {
Expand Down
34 changes: 17 additions & 17 deletions packages/@ember/-internals/glimmer/lib/component-managers/mount.ts
@@ -1,26 +1,26 @@
import type { InternalOwner } from '@ember/-internals/owner';
import { type InternalOwner } from '@ember/-internals/owner';
import { generateControllerFactory } from '@ember/routing/-internals';
import { assert } from '@ember/debug';
import EngineInstance from '@ember/engine/instance';
import { associateDestroyableChild } from '@glimmer/destroyable';
import type {
CapturedArguments,
ComponentDefinition,
CustomRenderNode,
Destroyable,
Environment,
InternalComponentCapabilities,
Option,
TemplateFactory,
VMArguments,
WithCreateInstance,
WithCustomDebugRenderTree,
WithDynamicLayout,
WithSubOwner,
import {
type CapturedArguments,
type ComponentDefinition,
type CustomRenderNode,
type Destroyable,
type Environment,
type InternalComponentCapabilities,
type Option,
type TemplateFactory,
type VMArguments,
type WithCreateInstance,
type WithCustomDebugRenderTree,
type WithDynamicLayout,
type WithSubOwner,
} from '@glimmer/interfaces';
import { capabilityFlagsFrom } from '@glimmer/manager';
import type { Reference } from '@glimmer/reference';
import { createConstRef, valueForRef } from '@glimmer/reference';
import { type Reference, createConstRef, valueForRef } from '@glimmer/reference';

import { unwrapTemplate } from '@glimmer/util';
import type RuntimeResolver from '../resolver';

Expand Down
42 changes: 21 additions & 21 deletions packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts
@@ -1,34 +1,34 @@
import { ENV } from '@ember/-internals/environment';
import type { InternalOwner } from '@ember/-internals/owner';
import { type InternalOwner } from '@ember/-internals/owner';
import { guidFor } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import EngineInstance from '@ember/engine/instance';
import { _instrumentStart } from '@ember/instrumentation';
import type {
CapturedArguments,
CompilableProgram,
ComponentDefinition,
CustomRenderNode,
Destroyable,
Environment,
InternalComponentCapabilities,
InternalComponentCapability,
Option,
Template,
VMArguments,
WithCreateInstance,
WithCustomDebugRenderTree,
WithDynamicTagName,
import {
type CapturedArguments,
type CompilableProgram,
type ComponentDefinition,
type CustomRenderNode,
type Destroyable,
type Environment,
type InternalComponentCapabilities,
type InternalComponentCapability,
type Option,
type Template,
type VMArguments,
type WithCreateInstance,
type WithCustomDebugRenderTree,
type WithDynamicTagName,
} from '@glimmer/interfaces';
import { capabilityFlagsFrom } from '@glimmer/manager';
import type { Reference } from '@glimmer/reference';
import { createConstRef, valueForRef } from '@glimmer/reference';
import { type Reference, createConstRef, valueForRef } from '@glimmer/reference';

import { EMPTY_ARGS } from '@glimmer/runtime';
import { unwrapTemplate } from '@glimmer/util';

import type { SimpleElement } from '@simple-dom/interface';
import type { DynamicScope } from '../renderer';
import type { OutletState } from '../utils/outlet';
import { type SimpleElement } from '@simple-dom/interface';
import { type DynamicScope } from '../renderer';
import { type OutletState } from '../utils/outlet';
import type OutletView from '../views/outlet';

function instrumentationPayload(def: OutletDefinitionState) {
Expand Down
Expand Up @@ -2,18 +2,18 @@ import { getFactoryFor } from '@ember/-internals/container';
import { assert } from '@ember/debug';
import { _instrumentStart } from '@ember/instrumentation';
import { DEBUG } from '@glimmer/env';
import type {
ComponentDefinition,
Environment,
InternalComponentCapabilities,
Option,
Owner,
VMArguments,
import {
type ComponentDefinition,
type Environment,
type InternalComponentCapabilities,
type Option,
type Owner,
type VMArguments,
} from '@glimmer/interfaces';
import { capabilityFlagsFrom } from '@glimmer/manager';
import { CONSTANT_TAG, consumeTag } from '@glimmer/validator';
import type Component from '../component';
import type { DynamicScope } from '../renderer';
import { type DynamicScope } from '../renderer';
import ComponentStateBucket from '../utils/curly-component-state-bucket';
import CurlyComponentManager, {
DIRTY_TAG,
Expand Down
8 changes: 4 additions & 4 deletions packages/@ember/-internals/glimmer/lib/component.ts
@@ -1,5 +1,5 @@
import { get, PROPERTY_DID_CHANGE } from '@ember/-internals/metal';
import type { PropertyDidChange } from '@ember/-internals/metal/lib/property_events';
import { type PropertyDidChange } from '@ember/-internals/metal/lib/property_events';
import { getOwner } from '@ember/-internals/owner';
import { TargetActionSupport } from '@ember/-internals/runtime';
import {
Expand All @@ -14,12 +14,12 @@ import {
} from '@ember/-internals/views';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import type { Environment, Template, TemplateFactory } from '@glimmer/interfaces';
import { type Environment, type Template, type TemplateFactory } from '@glimmer/interfaces';
import { setInternalComponentManager } from '@glimmer/manager';
import { isUpdatableRef, updateRef } from '@glimmer/reference';
import { normalizeProperty } from '@glimmer/runtime';
import type { DirtyableTag } from '@glimmer/validator';
import { createTag, dirtyTag } from '@glimmer/validator';
import { type DirtyableTag, createTag, dirtyTag } from '@glimmer/validator';

import { Namespace } from '@simple-dom/interface';
import {
ARGS,
Expand Down
@@ -1,10 +1,15 @@
import { tracked } from '@ember/-internals/metal';
import { assert } from '@ember/debug';
import { action } from '@ember/object';
import type { Reference } from '@glimmer/reference';
import { isConstRef, isUpdatableRef, updateRef, valueForRef } from '@glimmer/reference';
import type { EventListener } from './internal';
import InternalComponent from './internal';
import {
type Reference,
isConstRef,
isUpdatableRef,
updateRef,
valueForRef,
} from '@glimmer/reference';

import InternalComponent, { type EventListener } from './internal';

const UNINITIALIZED: unknown = Object.freeze({});

Expand Down
28 changes: 14 additions & 14 deletions packages/@ember/-internals/glimmer/lib/components/internal.ts
@@ -1,21 +1,21 @@
import type { InternalOwner } from '@ember/-internals/owner';
import { setOwner } from '@ember/-internals/owner';
import { type InternalOwner, setOwner } from '@ember/-internals/owner';

import { guidFor } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import type {
CapturedArguments,
Destroyable,
DynamicScope,
Environment,
InternalComponentCapabilities,
InternalComponentManager,
TemplateFactory,
VMArguments,
WithCreateInstance,
import {
type CapturedArguments,
type Destroyable,
type DynamicScope,
type Environment,
type InternalComponentCapabilities,
type InternalComponentManager,
type TemplateFactory,
type VMArguments,
type WithCreateInstance,
} from '@glimmer/interfaces';
import { setComponentTemplate, setInternalComponentManager } from '@glimmer/manager';
import type { Reference } from '@glimmer/reference';
import { createConstRef, isConstRef, valueForRef } from '@glimmer/reference';
import { type Reference, createConstRef, isConstRef, valueForRef } from '@glimmer/reference';

import { untrack } from '@glimmer/validator';

function NOOP(): void {}
Expand Down
6 changes: 3 additions & 3 deletions packages/@ember/-internals/glimmer/lib/components/link-to.ts
@@ -1,5 +1,5 @@
import type Route from '@ember/routing/route';
import type { RouterState, RoutingService } from '@ember/routing/-internals';
import { type RouterState, type RoutingService } from '@ember/routing/-internals';
import { isSimpleClick } from '@ember/-internals/views';
import { assert, debugFreeze, inspect, warn } from '@ember/debug';
import { getEngineParent } from '@ember/engine';
Expand All @@ -8,9 +8,9 @@ import { flaggedInstrument } from '@ember/instrumentation';
import { action } from '@ember/object';
import { service } from '@ember/service';
import { DEBUG } from '@glimmer/env';
import type { Maybe, Option } from '@glimmer/interfaces';
import { type Maybe, type Option } from '@glimmer/interfaces';
import { consumeTag, createCache, getValue, tagFor, untrack } from '@glimmer/validator';
import type { Transition } from 'router_js';
import { type Transition } from 'router_js';
import LinkToTemplate from '../templates/link-to';
import InternalComponent, { opaquify } from './internal';

Expand Down
8 changes: 4 additions & 4 deletions packages/@ember/-internals/glimmer/lib/environment.ts
@@ -1,14 +1,14 @@
import { ENV } from '@ember/-internals/environment';
import { get, set, _getProp, _setProp } from '@ember/-internals/metal';
import type { InternalOwner } from '@ember/-internals/owner';
import { type InternalOwner } from '@ember/-internals/owner';
import { getDebugName } from '@ember/-internals/utils';
import { constructStyleDeprecationMessage } from '@ember/-internals/views';
import { assert, deprecate, warn } from '@ember/debug';
import type { DeprecationOptions } from '@ember/debug';

import { type DeprecationOptions, assert, deprecate, warn } from '@ember/debug';
import { schedule, _backburner } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
import setGlobalContext from '@glimmer/global-context';
import type { EnvironmentDelegate } from '@glimmer/runtime';
import { type EnvironmentDelegate } from '@glimmer/runtime';
import { setTrackingTransactionEnv } from '@glimmer/validator';
import toIterator from './utils/iterator';
import { isHTMLSafe } from './utils/string';
Expand Down

0 comments on commit bbef9a6

Please sign in to comment.