Skip to content

Commit f230d98

Browse files
authored
eslint: add the no-wrapper-object-types rule (#868)
* style(.eslintrc.json): disallow wrapper object types * style: replace wrapper types with primitive types (Number -> number, Boolean -> boolean...)
1 parent 2a70c80 commit f230d98

31 files changed

Lines changed: 152 additions & 151 deletions

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"rules": {
4444
"no-unused-vars": [ "error", { "args": "none" } ],
4545
"indent": [ "error", "tab" ],
46-
"no-dupe-class-members": "off"
46+
"no-dupe-class-members": "off",
47+
"@typescript-eslint/no-wrapper-object-types": "error"
4748
}
4849
}, {
4950
"files": [ "*.jsx" ],

src/base/TilesRendererBase.d.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { PriorityQueue } from '../utilities/PriorityQueue';
33

44
export class TilesRendererBase {
55

6-
readonly rootTileSet : Object | null;
7-
readonly root : Object | null;
6+
readonly rootTileSet : object | null;
7+
readonly root : object | null;
88

9-
errorTarget : Number;
10-
errorThreshold : Number;
11-
displayActiveTiles : Boolean;
12-
maxDepth : Number;
9+
errorTarget : number;
10+
errorThreshold : number;
11+
displayActiveTiles : boolean;
12+
maxDepth : number;
1313

1414
fetchOptions : RequestInit;
1515
preprocessURL : ( ( uri: string | URL ) => string ) | null;
@@ -18,16 +18,16 @@ export class TilesRendererBase {
1818
parseQueue : PriorityQueue;
1919
downloadQueue : PriorityQueue;
2020

21-
constructor( url?: String );
21+
constructor( url?: string );
2222
update() : void;
23-
registerPlugin( plugin: Object ) : void;
24-
unregisterPlugin( plugin: Object | String ) : Boolean;
25-
getPluginByName( plugin: Object | String ) : Object;
23+
registerPlugin( plugin: object ) : void;
24+
unregisterPlugin( plugin: object | string ) : boolean;
25+
getPluginByName( plugin: object | string ) : object;
2626
traverse(
27-
beforeCb : ( ( tile : Object, parent : Object, depth : Number ) => Boolean ) | null,
28-
afterCb : ( ( tile : Object, parent : Object, depth : Number ) => Boolean ) | null
27+
beforeCb : ( ( tile : object, parent : object, depth : number ) => boolean ) | null,
28+
afterCb : ( ( tile : object, parent : object, depth : number ) => boolean ) | null
2929
) : void;
30-
getAttributions( target? : Array<{ type: String, value: any }> ) : Array<{ type: String, value: any }>;
30+
getAttributions( target? : Array<{ type: string, value: any }> ) : Array<{ type: string, value: any }>;
3131

3232
dispose() : void;
3333
resetFailedTiles() : void;

src/base/Tileset.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface Tileset {
3232
/**
3333
* 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.
3434
*/
35-
geometricError: Number;
35+
geometricError: number;
3636

3737
/**
3838
* The root tile.

src/base/loaders/B3DMLoaderBase.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FeatureTable } from '../../utilities/FeatureTable';
33

44
export interface B3DMBaseResult {
55

6-
version : String;
6+
version : string;
77
featureTable: FeatureTable;
88
batchTable : BatchTable;
99
glbBytes : Uint8Array;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
interface TileInfo {
22

3-
type : String;
3+
type : string;
44
buffer : Uint8Array;
5-
version : String;
5+
version : string;
66

77
}
88

99
export interface CMPTBaseResult {
1010

11-
version : String;
11+
version : string;
1212
tiles : Array< TileInfo >;
1313

1414
}
1515

1616
export class CMPTLoaderBase {
1717

1818
workingPath : string;
19-
load( url : String ) : Promise< CMPTBaseResult >;
19+
load( url : string ) : Promise< CMPTBaseResult >;
2020
parse( buffer : ArrayBuffer ) : CMPTBaseResult;
2121

2222
}

src/base/loaders/I3DMLoaderBase.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FeatureTable } from '../../utilities/FeatureTable';
33

44
export interface I3DMBaseResult {
55

6-
version : String;
6+
version : string;
77
featureTable: FeatureTable;
88
batchTable : BatchTable;
99
glbBytes : Uint8Array;

src/base/loaders/PNTSLoaderBase.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FeatureTable } from '../../utilities/FeatureTable';
33

44
export interface PNTSBaseResult {
55

6-
version : String;
6+
version : string;
77
featureTable: FeatureTable;
88
batchTable : BatchTable;
99

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export class CesiumIonAuthPlugin {
22

33
constructor( options : {
4-
apiToken: String,
5-
assetId?: String | null,
6-
autoRefreshToken?: Boolean
4+
apiToken: string,
5+
assetId?: string | null,
6+
autoRefreshToken?: boolean
77
} );
88

99
}

src/plugins/three/DebugTilesPlugin.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export const RANDOM_NODE_COLOR: ColorMode;
1414
export const CUSTOM_COLOR: ColorMode;
1515
export class DebugTilesPlugin {
1616

17-
displayBoxBounds : Boolean;
18-
displaySphereBounds : Boolean;
19-
displayRegionBounds : Boolean;
17+
displayBoxBounds : boolean;
18+
displaySphereBounds : boolean;
19+
displayRegionBounds : boolean;
2020
colorMode : ColorMode;
2121

22-
maxDebugDepth : Number;
23-
maxDebugDistance : Number;
24-
maxDebugError : Number;
22+
maxDebugDepth : number;
23+
maxDebugDistance : number;
24+
maxDebugError : number;
2525

26-
getDebugColor : ( val: Number, target: Color ) => void;
26+
getDebugColor : ( val: number, target: Color ) => void;
2727
customColorCallback : ( val: Tile, target: Color ) => void;
2828

2929
}

src/plugins/three/GLTFExtensionsPlugin.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoa
55
export class GLTFExtensionsPlugin {
66

77
constructor( options: {
8-
metadata: Boolean,
9-
rtc: Boolean,
8+
metadata: boolean,
9+
rtc: boolean,
1010

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

1313
dracoLoader: DRACOLoader | null,
1414
ktxLoader: KTX2Loader | null,
15-
autoDispose: Boolean,
15+
autoDispose: boolean,
1616
} );
1717

1818
}

0 commit comments

Comments
 (0)