Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint: add the no-wrapper-object-types rule #868

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"rules": {
"no-unused-vars": [ "error", { "args": "none" } ],
"indent": [ "error", "tab" ],
"no-dupe-class-members": "off"
"no-dupe-class-members": "off",
"@typescript-eslint/no-wrapper-object-types": "error"
}
}, {
"files": [ "*.jsx" ],
Expand Down
26 changes: 13 additions & 13 deletions src/base/TilesRendererBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@

export class TilesRendererBase {

readonly rootTileSet : Object | null;
readonly root : Object | null;
readonly rootTileSet : object | null;
readonly root : object | null;

errorTarget : Number;
errorThreshold : Number;
displayActiveTiles : Boolean;
maxDepth : Number;
errorTarget : number;
errorThreshold : number;
displayActiveTiles : boolean;
maxDepth : number;

fetchOptions : RequestInit;

Check warning on line 14 in src/base/TilesRendererBase.d.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'RequestInit' is not defined

Check warning on line 14 in src/base/TilesRendererBase.d.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'RequestInit' is not defined
preprocessURL : ( ( uri: string | URL ) => string ) | null;

lruCache : LRUCache;
parseQueue : PriorityQueue;
downloadQueue : PriorityQueue;

constructor( url?: String );
constructor( url?: string );
update() : void;
registerPlugin( plugin: Object ) : void;
unregisterPlugin( plugin: Object | String ) : Boolean;
getPluginByName( plugin: Object | String ) : Object;
registerPlugin( plugin: object ) : void;
unregisterPlugin( plugin: object | string ) : boolean;
getPluginByName( plugin: object | string ) : object;
traverse(
beforeCb : ( ( tile : Object, parent : Object, depth : Number ) => Boolean ) | null,
afterCb : ( ( tile : Object, parent : Object, depth : Number ) => Boolean ) | null
beforeCb : ( ( tile : object, parent : object, depth : number ) => boolean ) | null,
afterCb : ( ( tile : object, parent : object, depth : number ) => boolean ) | null
) : void;
getAttributions( target? : Array<{ type: String, value: any }> ) : Array<{ type: String, value: any }>;
getAttributions( target? : Array<{ type: string, value: any }> ) : Array<{ type: string, value: any }>;

dispose() : void;
resetFailedTiles() : void;
Expand Down
2 changes: 1 addition & 1 deletion src/base/Tileset.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface Tileset {
/**
* The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels.
*/
geometricError: Number;
geometricError: number;

/**
* The root tile.
Expand Down
2 changes: 1 addition & 1 deletion src/base/loaders/B3DMLoaderBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FeatureTable } from '../../utilities/FeatureTable';

export interface B3DMBaseResult {

version : String;
version : string;
featureTable: FeatureTable;
batchTable : BatchTable;
glbBytes : Uint8Array;
Expand Down
8 changes: 4 additions & 4 deletions src/base/loaders/CMPTLoaderBase.d.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
interface TileInfo {

type : String;
type : string;
buffer : Uint8Array;
version : String;
version : string;

}

export interface CMPTBaseResult {

version : String;
version : string;
tiles : Array< TileInfo >;

}

export class CMPTLoaderBase {

workingPath : string;
load( url : String ) : Promise< CMPTBaseResult >;
load( url : string ) : Promise< CMPTBaseResult >;
parse( buffer : ArrayBuffer ) : CMPTBaseResult;

}
2 changes: 1 addition & 1 deletion src/base/loaders/I3DMLoaderBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FeatureTable } from '../../utilities/FeatureTable';

export interface I3DMBaseResult {

version : String;
version : string;
featureTable: FeatureTable;
batchTable : BatchTable;
glbBytes : Uint8Array;
Expand Down
2 changes: 1 addition & 1 deletion src/base/loaders/PNTSLoaderBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FeatureTable } from '../../utilities/FeatureTable';

export interface PNTSBaseResult {

version : String;
version : string;
featureTable: FeatureTable;
batchTable : BatchTable;

Expand Down
6 changes: 3 additions & 3 deletions src/plugins/three/CesiumIonAuthPlugin.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export class CesiumIonAuthPlugin {

constructor( options : {
apiToken: String,
assetId?: String | null,
autoRefreshToken?: Boolean
apiToken: string,
assetId?: string | null,
autoRefreshToken?: boolean
} );

}
14 changes: 7 additions & 7 deletions src/plugins/three/DebugTilesPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export const RANDOM_NODE_COLOR: ColorMode;
export const CUSTOM_COLOR: ColorMode;
export class DebugTilesPlugin {

displayBoxBounds : Boolean;
displaySphereBounds : Boolean;
displayRegionBounds : Boolean;
displayBoxBounds : boolean;
displaySphereBounds : boolean;
displayRegionBounds : boolean;
colorMode : ColorMode;

maxDebugDepth : Number;
maxDebugDistance : Number;
maxDebugError : Number;
maxDebugDepth : number;
maxDebugDistance : number;
maxDebugError : number;

getDebugColor : ( val: Number, target: Color ) => void;
getDebugColor : ( val: number, target: Color ) => void;
customColorCallback : ( val: Tile, target: Color ) => void;

}
6 changes: 3 additions & 3 deletions src/plugins/three/GLTFExtensionsPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoa
export class GLTFExtensionsPlugin {

constructor( options: {
metadata: Boolean,
rtc: Boolean,
metadata: boolean,
rtc: boolean,

plugins: Array<( parser: GLTFParser ) => GLTFLoaderPlugin>,

dracoLoader: DRACOLoader | null,
ktxLoader: KTX2Loader | null,
autoDispose: Boolean,
autoDispose: boolean,
} );

}
2 changes: 1 addition & 1 deletion src/plugins/three/GoogleCloudAuthPlugin.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class GoogleCloudAuthPlugin {

constructor( options : { apiToken: String, autoRefreshToken?: Boolean } );
constructor( options : { apiToken: string, autoRefreshToken?: boolean } );

}
8 changes: 4 additions & 4 deletions src/plugins/three/ReorientationPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ export class GLTFExtensionsPlugin {

constructor( options: {
up: '+x' | '-x' | '+y' | '-y' | '+z' | '-z',
recenter: Boolean,
recenter: boolean,

lat: Number | null,
lon: Number | null,
height: Number,
lat: number | null,
lon: number | null,
height: number,
} );

}
12 changes: 6 additions & 6 deletions src/plugins/three/TileCompressionPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { TypedArray } from 'three';
export class TileCompressionPlugin {

constructor( options: {
generateNormals: Boolean,
disableMipmaps: Boolean,
compressIndex: Boolean,
compressNormals: Boolean,
compressUvs: Boolean,
compressPosition: Boolean,
generateNormals: boolean,
disableMipmaps: boolean,
compressIndex: boolean,
compressNormals: boolean,
compressUvs: boolean,
compressPosition: boolean,

uvType: TypedArray,
normalType: TypedArray,
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/three/fade/TilesFadePlugin.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export class TilesFadePlugin {

constructor( options: {
maximumFadeOutTiles: Number,
fadeRootTiles: Boolean,
fadeDuration: Number,
maximumFadeOutTiles: number,
fadeRootTiles: boolean,
fadeDuration: number,
} );

}
6 changes: 3 additions & 3 deletions src/plugins/three/gltf/GLTFMeshFeaturesExtension.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export class GLTFMeshFeaturesExtension {

export class MeshFeatures {

getFeatures( triangle: Number, barycoord: Vector3 ): Array<Number>;
getFeaturesAsync( triangle: Number, barycoord: Vector3 ): Promise<Array<Number>>;
getFeaturesInfo(): Array<{ label: String, propertyTable: Number, nullFeatureId: Number | null }>;
getFeatures( triangle: number, barycoord: Vector3 ): Array<number>;
getFeaturesAsync( triangle: number, barycoord: Vector3 ): Promise<Array<number>>;
getFeaturesInfo(): Array<{ label: string, propertyTable: number, nullFeatureId: number | null }>;
dispose(): void;

}
Expand Down
20 changes: 10 additions & 10 deletions src/plugins/three/gltf/GLTFStructuralMetadataExtension.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ class StructuralMetadata {

textures: Array<Texture | null>;

getPropertyTableData( tableIndices: Array<Number>, ids: Array<Number>, target: Array = [] ): Array<any>;
getPropertyTableInfo( tableIndices: Array<Number> | null = null ): Array<{ name: String, className: string }>;
getPropertyTableData( tableIndices: Array<number>, ids: Array<number>, target: Array = [] ): Array<any>;
getPropertyTableInfo( tableIndices: Array<number> | null = null ): Array<{ name: string, className: string }>;

getPropertyTextureData( triangle: Number, barycoord: Vector3, target: Array = [] ): Array<any>;
getPropertyTextureDataAsync( triangle: Number, barycoord: Vector3, target: Array = [] ): Promise<Array<any>>;
getPropertyTextureData( triangle: number, barycoord: Vector3, target: Array = [] ): Array<any>;
getPropertyTextureDataAsync( triangle: number, barycoord: Vector3, target: Array = [] ): Promise<Array<any>>;
getPropertyTextureInfo(): Array<{
name: String,
name: string,
className: string,
properties: {
[key: string]: {
index: Number,
texCoord: Number,
channels: Array<Number>,
index: number,
texCoord: number,
channels: Array<number>,
}
}
}>;

getPropertyAttributeData( attributeIndex: Number, target: Array = [] ): Array<any>;
getPropertyAttributeInfo(): Array<{ name: String, className: string }>;
getPropertyAttributeData( attributeIndex: number, target: Array = [] ): Array<any>;
getPropertyAttributeInfo(): Array<{ name: string, className: string }>;

dispose(): void;

Expand Down
14 changes: 7 additions & 7 deletions src/three/DebugTilesRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export const RANDOM_NODE_COLOR: ColorMode;
export const CUSTOM_COLOR: ColorMode;
export class DebugTilesRenderer extends TilesRenderer {

displayBoxBounds : Boolean;
displaySphereBounds : Boolean;
displayRegionBounds : Boolean;
displayBoxBounds : boolean;
displaySphereBounds : boolean;
displayRegionBounds : boolean;
colorMode : ColorMode;

maxDebugDepth : Number;
maxDebugDistance : Number;
maxDebugError : Number;
maxDebugDepth : number;
maxDebugDistance : number;
maxDebugError : number;

getDebugColor : ( val: Number, target: Color ) => void;
getDebugColor : ( val: number, target: Color ) => void;

}
30 changes: 15 additions & 15 deletions src/three/TilesRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ import { Ellipsoid } from './math/Ellipsoid';
export class TilesRenderer extends TilesRendererBase {

ellipsoid: Ellipsoid;
autoDisableRendererCulling : Boolean;
optimizeRaycast : Boolean;
autoDisableRendererCulling : boolean;
optimizeRaycast : boolean;

manager : LoadingManager;

group : TilesGroup;

getBoundingBox( box : Box3 ) : Boolean;
getOrientedBoundingBox( box : Box3, matrix : Matrix4 ) : Boolean;
getBoundingSphere( sphere: Sphere ) : Boolean;
getBoundingBox( box : Box3 ) : boolean;
getOrientedBoundingBox( box : Box3, matrix : Matrix4 ) : boolean;
getBoundingSphere( sphere: Sphere ) : boolean;

hasCamera( camera : Camera ) : Boolean;
setCamera( camera : Camera ) : Boolean;
deleteCamera( camera : Camera ) : Boolean;
hasCamera( camera : Camera ) : boolean;
setCamera( camera : Camera ) : boolean;
deleteCamera( camera : Camera ) : boolean;

setResolution( camera : Camera, x : Number, y : Number ) : Boolean;
setResolution( camera : Camera, resolution : Vector2 ) : Boolean;
setResolutionFromRenderer( camera : Camera, renderer : WebGLRenderer ) : Boolean;
setResolution( camera : Camera, x : number, y : number ) : boolean;
setResolution( camera : Camera, resolution : Vector2 ) : boolean;
setResolutionFromRenderer( camera : Camera, renderer : WebGLRenderer ) : boolean;

forEachLoadedModel( callback : ( scene : Object3D, tile : Tile ) => void ) : void;

addEventListener( type: String, cb: ( e : Object ) => void );
hasEventListener( type: String, cb: ( e : Object ) => void );
removeEventListener( type: String, cb: ( e : Object ) => void );
dispatchEvent( e : Object );
addEventListener( type: string, cb: ( e : object ) => void );
hasEventListener( type: string, cb: ( e : object ) => void );
removeEventListener( type: string, cb: ( e : object ) => void );
dispatchEvent( e : object );

}
2 changes: 1 addition & 1 deletion src/three/loaders/B3DMLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface B3DMResult extends GLTF, B3DMBaseResult {
export class B3DMLoader {

constructor( manager : LoadingManager );
load( url : String ) : Promise< B3DMResult >;
load( url : string ) : Promise< B3DMResult >;
parse( buffer : ArrayBuffer ) : Promise < B3DMResult >;

}
2 changes: 1 addition & 1 deletion src/three/loaders/CMPTLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface CMPTResult {
export class CMPTLoader {

constructor( manager : LoadingManager );
load( url : String ) : Promise< CMPTResult >;
load( url : string ) : Promise< CMPTResult >;
parse( buffer : ArrayBuffer ) : Promise< CMPTResult >;

}
2 changes: 1 addition & 1 deletion src/three/loaders/I3DMLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface I3DMResult extends GLTF, I3DMBaseResult {
export class I3DMLoader {

constructor( manager : LoadingManager );
load( url : String ) : Promise< I3DMResult >;
load( url : string ) : Promise< I3DMResult >;
parse( buffer : ArrayBuffer ) : Promise< I3DMResult >;

}
2 changes: 1 addition & 1 deletion src/three/loaders/PNTSLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface PNTSResult extends PNTSBaseResult {
export class PNTSLoader extends PNTSLoaderBase {

constructor( manager : LoadingManager );
load( url : String ) : Promise< PNTSResult >;
load( url : string ) : Promise< PNTSResult >;
parse( buffer : ArrayBuffer ) : Promise< PNTSResult >;

}
Loading
Loading