diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f46e73a90a..bef0ef66c3 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -60,6 +60,7 @@ module.exports = { devDependencies: ['test/**', 'tests/**', 'examples/**'], }], */ 'import/no-extraneous-dependencies': 'off', + 'import/prefer-default-export': 'off', // TODO reactivate all the following rules @@ -95,9 +96,9 @@ module.exports = { 'error', 'ignorePackages', { - 'js': 'never', - 'ts': 'never', - 'tsx': 'never', + js: 'never', + ts: 'never', + tsx: 'never', }, ], camelcase: 'off', diff --git a/src/Converter/convertToTile.js b/src/Converter/convertToTile.js index d3680a16d6..56fd6420a6 100644 --- a/src/Converter/convertToTile.js +++ b/src/Converter/convertToTile.js @@ -6,7 +6,7 @@ import * as THREE from 'three'; import TileMesh from 'Core/TileMesh'; import LayeredMaterial from 'Renderer/LayeredMaterial'; -import newTileGeometry from 'Core/Prefab/TileBuilder'; +import { newTileGeometry } from 'Core/Prefab/TileBuilder'; import ReferLayerProperties from 'Layer/ReferencingLayerProperties'; import { geoidLayerIsVisible } from 'Layer/GeoidLayer'; diff --git a/src/Core/Prefab/Globe/BuilderEllipsoidTile.ts b/src/Core/Prefab/Globe/BuilderEllipsoidTile.ts index 217d3354bd..b03c0626c9 100644 --- a/src/Core/Prefab/Globe/BuilderEllipsoidTile.ts +++ b/src/Core/Prefab/Globe/BuilderEllipsoidTile.ts @@ -28,7 +28,8 @@ export interface GlobeTileBuilderParams extends TileBuilderParams { quatNormalToZ: THREE.Quaternion; } -class BuilderEllipsoidTile implements TileBuilder { +export class GlobeTileBuilder +implements TileBuilder { private _crs: string; private _transform: { coords: Coordinates[]; @@ -63,7 +64,7 @@ class BuilderEllipsoidTile implements TileBuilder { // Offset: Float row coordinate from Pseudo mercator coordinates // EPSG:3857 if (options.uvCount > 1) { - this.computeExtraOffset = BuilderEllipsoidTile._computeExtraOffset; + this.computeExtraOffset = GlobeTileBuilder._computeExtraOffset; } } @@ -167,5 +168,3 @@ class BuilderEllipsoidTile implements TileBuilder { }; } } - -export default BuilderEllipsoidTile; diff --git a/src/Core/Prefab/Globe/GlobeLayer.js b/src/Core/Prefab/Globe/GlobeLayer.js index abc0f44ee1..85d1378e93 100644 --- a/src/Core/Prefab/Globe/GlobeLayer.js +++ b/src/Core/Prefab/Globe/GlobeLayer.js @@ -2,7 +2,7 @@ import * as THREE from 'three'; import TiledGeometryLayer from 'Layer/TiledGeometryLayer'; import { ellipsoidSizes } from 'Core/Math/Ellipsoid'; import { globalExtentTMS, schemeTiles } from 'Core/Tile/TileGrid'; -import BuilderEllipsoidTile from 'Core/Prefab/Globe/BuilderEllipsoidTile'; +import { GlobeTileBuilder } from 'Core/Prefab/Globe/BuilderEllipsoidTile'; import CRS from 'Core/Geographic/Crs'; // matrix to convert sphere to ellipsoid @@ -57,7 +57,7 @@ class GlobeLayer extends TiledGeometryLayer { CRS.tms_3857, ]; const uvCount = config.tileMatrixSets.length; - const builder = new BuilderEllipsoidTile({ crs: 'EPSG:4978', uvCount }); + const builder = new GlobeTileBuilder({ crs: 'EPSG:4978', uvCount }); super(id, object3d || new THREE.Group(), schemeTile, builder, config); diff --git a/src/Core/Prefab/Planar/PlanarLayer.js b/src/Core/Prefab/Planar/PlanarLayer.js index 0bee5987a8..52757cd57c 100644 --- a/src/Core/Prefab/Planar/PlanarLayer.js +++ b/src/Core/Prefab/Planar/PlanarLayer.js @@ -3,7 +3,7 @@ import * as THREE from 'three'; import TiledGeometryLayer from 'Layer/TiledGeometryLayer'; import { globalExtentTMS } from 'Core/Tile/TileGrid'; import CRS from 'Core/Geographic/Crs'; -import PlanarTileBuilder from './PlanarTileBuilder'; +import { PlanarTileBuilder } from './PlanarTileBuilder'; /** * @property {boolean} isPlanarLayer - Used to checkout whether this layer is a diff --git a/src/Core/Prefab/Planar/PlanarTileBuilder.ts b/src/Core/Prefab/Planar/PlanarTileBuilder.ts index fb5e9316dd..81466ba55f 100644 --- a/src/Core/Prefab/Planar/PlanarTileBuilder.ts +++ b/src/Core/Prefab/Planar/PlanarTileBuilder.ts @@ -23,7 +23,7 @@ export interface PlanarTileBuilderParams extends TileBuilderParams { nbRow: number; } -class PlanarTileBuilder implements TileBuilder { +export class PlanarTileBuilder implements TileBuilder { private _uvCount: number; private _transform: Transform; private _crs: string; @@ -110,5 +110,3 @@ class PlanarTileBuilder implements TileBuilder { }; } } - -export default PlanarTileBuilder; diff --git a/src/Core/Prefab/TileBuilder.ts b/src/Core/Prefab/TileBuilder.ts index 11e7adac18..4b6ab229a8 100644 --- a/src/Core/Prefab/TileBuilder.ts +++ b/src/Core/Prefab/TileBuilder.ts @@ -1,7 +1,7 @@ import * as THREE from 'three'; -import TileGeometry from 'Core/TileGeometry'; +import { TileGeometry } from 'Core/TileGeometry'; import Cache from 'Core/Scheduler/Cache'; -import computeBuffers from 'Core/Prefab/computeBufferTileGeometry'; +import { computeBuffers } from 'Core/Prefab/computeBufferTileGeometry'; import OBB from 'Renderer/OBB'; import type Extent from 'Core/Geographic/Extent'; @@ -73,7 +73,7 @@ export interface TileBuilder { computeShareableExtent(extent: Extent): ShareableExtent; } -export default function newTileGeometry( +export function newTileGeometry( builder: TileBuilder, params: TileBuilderParams, ) { diff --git a/src/Core/Prefab/computeBufferTileGeometry.ts b/src/Core/Prefab/computeBufferTileGeometry.ts index 8ca79ff0ff..e468b0f77b 100644 --- a/src/Core/Prefab/computeBufferTileGeometry.ts +++ b/src/Core/Prefab/computeBufferTileGeometry.ts @@ -128,7 +128,7 @@ type ComputeUvs = [typeof computeUv0 | (() => void), ReturnType?]; // TODO: Split this even further into subfunctions -export default function computeBuffers( +export function computeBuffers( builder: TileBuilder, params: TileBuilderParams, ) { diff --git a/src/Core/TileGeometry.ts b/src/Core/TileGeometry.ts index 0f291ef3a5..c3b186e790 100644 --- a/src/Core/TileGeometry.ts +++ b/src/Core/TileGeometry.ts @@ -1,5 +1,5 @@ import * as THREE from 'three'; -import computeBuffers, { getBufferIndexSize } +import { computeBuffers, getBufferIndexSize } from 'Core/Prefab/computeBufferTileGeometry'; import { GpuBufferAttributes, Projected, TileBuilder, TileBuilderParams } from './Prefab/TileBuilder'; @@ -45,7 +45,7 @@ function defaultBuffers( return bufferAttributes; } -class TileGeometry extends THREE.BufferGeometry { +export class TileGeometry extends THREE.BufferGeometry { public OBB: unknown; public extent: Extent; public segments: number; @@ -148,5 +148,3 @@ class TileGeometry extends THREE.BufferGeometry { } } } - -export default TileGeometry; diff --git a/src/Renderer/OBB.js b/src/Renderer/OBB.js index c4c273c2ad..2313b58279 100644 --- a/src/Renderer/OBB.js +++ b/src/Renderer/OBB.js @@ -1,11 +1,11 @@ import * as THREE from 'three'; -import TileGeometry from 'Core/TileGeometry'; -import BuilderEllipsoidTile from 'Core/Prefab/Globe/BuilderEllipsoidTile'; +import { TileGeometry } from 'Core/TileGeometry'; +import { GlobeTileBuilder } from 'Core/Prefab/Globe/BuilderEllipsoidTile'; import Coordinates from 'Core/Geographic/Coordinates'; import CRS from 'Core/Geographic/Crs'; // get oriented bounding box of tile -const builder = new BuilderEllipsoidTile({ crs: 'EPSG:4978', uvCount: 1 }); +const builder = new GlobeTileBuilder({ crs: 'EPSG:4978', uvCount: 1 }); const size = new THREE.Vector3(); const dimension = new THREE.Vector2(); const center = new THREE.Vector3();