Skip to content

Commit

Permalink
sort imports by module name in TypeScript too, phetsims/chipper#1462
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kauzmann <[email protected]>
  • Loading branch information
zepumph committed Sep 23, 2024
1 parent 773242f commit a11d6a5
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions js/Enumeration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
* @author Michael Kauzmann (PhET Interactive Simulations)
*/

import phetCore from './phetCore.js';
import TEnumeration from './TEnumeration.js';
import EnumerationValue from './EnumerationValue.js';
import inheritance from './inheritance.js';
import Constructor from './types/Constructor.js';
import optionize from './optionize.js';
import phetCore from './phetCore.js';
import TEnumeration from './TEnumeration.js';
import Constructor from './types/Constructor.js';

export type EnumerationOptions<T extends EnumerationValue> = {
phetioDocumentation?: string;
Expand Down
2 changes: 1 addition & 1 deletion js/EnumerationValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @author Michael Kauzmann (PhET Interactive Simulations)
*/

import phetCore from './phetCore.js';
import Enumeration from './Enumeration.js';
import phetCore from './phetCore.js';
import Constructor from './types/Constructor.js';

class EnumerationValue {
Expand Down
2 changes: 1 addition & 1 deletion js/MipmapElement.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022-2024, University of Colorado Boulder

import phetCore from './phetCore.js';
import asyncLoader from './asyncLoader.js';
import phetCore from './phetCore.js';

/**
* Size and raster data for levels in a mipmap. See also type Mipmap in Imageable.ts. Defined in phet-core instead of
Expand Down
36 changes: 18 additions & 18 deletions js/Orientation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

import phetCore from './phetCore.js';
import Enumeration from './Enumeration.js';
import EnumerationValue from './EnumerationValue.js';
import phetCore from './phetCore.js';
import Constructor from './types/Constructor.js';
import IntentionalAny from './types/IntentionalAny.js';

Expand Down Expand Up @@ -74,23 +74,23 @@ class Orientation extends EnumerationValue {
public opposite: Orientation;

public constructor( coordinate: 'x' | 'y',
centerCoordinate: 'centerX' | 'centerY',
minCoordinate: 'minX' | 'minY',
maxCoordinate: 'maxX' | 'maxY',
minSide: 'left' | 'top',
maxSide: 'right' | 'bottom',
minSize: 'minWidth' | 'minHeight',
maxSize: 'maxWidth' | 'maxHeight',
rectCoordinate: 'rectX' | 'rectY',
rectSize: 'rectWidth' | 'rectHeight',
flowBoxOrientation: 'horizontal' | 'vertical',
size: 'width' | 'height',
line: 'column' | 'row',
preferredSize: 'preferredWidth' | 'preferredHeight',
localPreferredSize: 'localPreferredWidth' | 'localPreferredHeight',
sizable: 'widthSizable' | 'heightSizable',
modelToView: ( m: MVT, n: number ) => number,
viewToModel: ( m: MVT, n: number ) => number, toVector: <T>( n: number, m: number, VectorType: new ( x: number, y: number, ...args: IntentionalAny[] ) => T ) => T ) {
centerCoordinate: 'centerX' | 'centerY',
minCoordinate: 'minX' | 'minY',
maxCoordinate: 'maxX' | 'maxY',
minSide: 'left' | 'top',
maxSide: 'right' | 'bottom',
minSize: 'minWidth' | 'minHeight',
maxSize: 'maxWidth' | 'maxHeight',
rectCoordinate: 'rectX' | 'rectY',
rectSize: 'rectWidth' | 'rectHeight',
flowBoxOrientation: 'horizontal' | 'vertical',
size: 'width' | 'height',
line: 'column' | 'row',
preferredSize: 'preferredWidth' | 'preferredHeight',
localPreferredSize: 'localPreferredWidth' | 'localPreferredHeight',
sizable: 'widthSizable' | 'heightSizable',
modelToView: ( m: MVT, n: number ) => number,
viewToModel: ( m: MVT, n: number ) => number, toVector: <T>( n: number, m: number, VectorType: new ( x: number, y: number, ...args: IntentionalAny[] ) => T ) => T ) {

super();
this.coordinate = coordinate;
Expand Down
14 changes: 7 additions & 7 deletions js/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
*
* With this style of pooling, the following should be standard boilerplate within the class:
public freeToPool(): void {
MyType.pool.freeToPool( this );
}
public freeToPool(): void {
MyType.pool.freeToPool( this );
}
public static readonly pool = new Pool( MyType );
public static readonly pool = new Pool( MyType );
* and can additionally implement TPoolable to make it clear that the type is pooled
*
Expand Down Expand Up @@ -50,9 +50,9 @@ type SelfPoolableOptions<T extends Constructor> = {

export type PoolableOptions<T extends Constructor> =
SelfPoolableOptions<T> & ( InstanceType<T> extends { initialize: PoolableInitializer<T> } ? unknown : {
// Require initialize if our type doesn't have a compatible initialize method.
initialize: PoolableInitializer<T>;
} );
// Require initialize if our type doesn't have a compatible initialize method.
initialize: PoolableInitializer<T>;
} );
type PoolableInitializer<T extends Constructor> = ( ...args: ConstructorParameters<T> ) => InstanceType<T>;

export type TPoolable = {
Expand Down
4 changes: 2 additions & 2 deletions js/Poolable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
* @author Jonathan Olson <[email protected]>
*/

import Constructor from './types/Constructor.js';
import extend from './extend.js';
import phetCore from './phetCore.js';
import optionize from './optionize.js';
import phetCore from './phetCore.js';
import Constructor from './types/Constructor.js';
import IntentionalAny from './types/IntentionalAny.js';

type PoolableOptions<Type extends Constructor> = {
Expand Down
2 changes: 1 addition & 1 deletion js/assertHasProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import inheritance from './inheritance.js';
import IntentionalAny from './types/IntentionalAny.js';
import phetCore from './phetCore.js';
import IntentionalAny from './types/IntentionalAny.js';

const assertHasProperties = ( object: IntentionalAny, properties: string[] ): void => {
if ( assert && object ) {
Expand Down
4 changes: 2 additions & 2 deletions js/optionize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* @author Michael Kauzmann (PhET Interactive Simulations)
*/

import phetCore from './phetCore.js';
import merge from './merge.js';
import phetCore from './phetCore.js';
import IntentionalAny from './types/IntentionalAny.js';
import RequiredKeys from './types/RequiredKeys.js';
import OptionalKeys from './types/OptionalKeys.js';
import RequiredKeys from './types/RequiredKeys.js';

// Gets the parts of an object that are optional
type Options<T> = Pick<T, OptionalKeys<T>>;
Expand Down

0 comments on commit a11d6a5

Please sign in to comment.