Skip to content

Commit b3e7ad3

Browse files
committed
Fix linting
1 parent 15e0503 commit b3e7ad3

17 files changed

+78
-63
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
/compilation-stats.json
66
/*.zip
77
*.swp
8+
/out
9+
/types

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ cleanall:
6666
mkdir -p $(dir $@)
6767
touch $@
6868

69-
.build/eslint.timestamp: $(SRC_JS_FILES) $(EXAMPLES_JS_FILES) $(WEBPACK_CONFIG_FILES) .build/node_modules.timestamp
69+
.build/eslint.timestamp: $(SRC_JS_FILES) $(EXAMPLES_JS_FILES) .build/node_modules.timestamp
7070
TARGET=examples ./node_modules/.bin/eslint $(filter-out .build/node_modules.timestamp, $^)
7171
touch $@
7272

buildtools/release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ VERSION=ol-cesium-$TAG
99
cp -R dist/ $VERSION && zip -r $VERSION.zip $VERSION; rm -rf $VERSION
1010

1111
mkdir -p $BUILD
12-
cp -R src/olcs/* $BUILD
12+
node_modules/.bin/tsc
13+
cp -R out/olcs/* $BUILD
1314
cp ./css/olcs.css $BUILD
1415
cp package.json $BUILD
1516
sed -i 's/ol-cesium/olcs/g' $BUILD/package.json

buildtools/webpack.commons.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const path = require('path');
1+
import path from 'path';
2+
import { fileURLToPath } from 'url';
23

34
const babelPresets = [
45
['@babel/preset-env', {
@@ -55,6 +56,8 @@ const iconRule = {
5556
}
5657
};
5758

59+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
60+
5861
const config = {
5962
context: path.resolve(__dirname, '../'),
6063
devtool: 'source-map',
@@ -89,6 +92,6 @@ const config = {
8992
}
9093
};
9194

92-
module.exports = {
95+
export default {
9396
config,
9497
};

buildtools/webpack.dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
mode: 'development',
33
output: {
44
filename: '[name].js'

buildtools/webpack.examples.js

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
const path = require('path');
2-
const fs = require('fs');
3-
const glob = require('fast-glob');
4-
const HtmlWebpackPlugin = require('html-webpack-plugin');
5-
const CopyWebpackPlugin = require('copy-webpack-plugin');
1+
import path from 'path';
2+
import fs from 'fs';
3+
import glob from 'fast-glob';
4+
import HtmlWebpackPlugin from 'html-webpack-plugin';
5+
import CopyWebpackPlugin from 'copy-webpack-plugin';
6+
import { fileURLToPath } from 'url';
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
68

79
const plugins = [];
810
const entry = {};
911

12+
1013
const exampleFilenamePrefix = process.env.DEV_SERVER ? 'examples/' : '';
1114

1215
const splitter = /.*\/(.*)\.html/;
@@ -40,7 +43,7 @@ plugins.push(new CopyWebpackPlugin({
4043
],
4144
}));
4245

43-
module.exports = {
46+
export default Object.assign({
4447
entry,
4548
optimization: {
4649
splitChunks: {
@@ -49,12 +52,8 @@ module.exports = {
4952
}
5053
},
5154
plugins,
52-
};
53-
54-
if (!process.env.DEV_SERVER) {
55-
Object.assign(module.exports, {
56-
output: {
57-
path: path.resolve(__dirname, '../dist/examples/'),
58-
},
59-
});
60-
}
55+
}, !process.env.DEV_SERVER ? {
56+
output: {
57+
path: path.resolve(__dirname, '../dist/examples/'),
58+
},
59+
} : {});

buildtools/webpack.library.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
const path = require('path');
1+
import path from 'path';
2+
import { fileURLToPath } from 'url';
3+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
24

35
const olRegExp = /^ol\/.+$/;
46
const slashReplacerRegExp = new RegExp('/', 'g');
57
const extensionReplacerRegExp = new RegExp('\\.js$');
68

79
const nodeEnv = process.env['NODE_ENV'] || 'development';
810
const filename = nodeEnv === 'development' ? 'olcesium-debug.js' : 'olcesium.js';
9-
module.exports = {
11+
export default {
1012
entry: './src/index.library.js',
1113
output: {
1214
library: 'olcs_unused_var',

buildtools/webpack.prod.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const TerserPlugin = require('terser-webpack-plugin');
1+
import TerserPlugin from 'terser-webpack-plugin';
22

3-
module.exports = {
3+
export default {
44
mode: 'production',
55
output: {
66
filename: '[name].[chunkhash:20].js'

buildtools/webpack.umd.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
const path = require('path');
1+
import path from 'path';
2+
import { fileURLToPath } from 'url';
3+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
24

35
const nodeEnv = process.env['NODE_ENV'] || 'development';
46
const filename = nodeEnv === 'development' ? 'olcesium-debug.umd.js' : 'olcesium.umd.js';
5-
module.exports = {
7+
export default {
68
entry: './src/index.library.js',
79
output: {
810
library: 'olcs',

examples/mvt.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import View from 'ol/View.js';
1212
import MVT from 'ol/format/MVT.js';
1313
import VectorTileLayer from 'ol/layer/VectorTile.js';
1414
import VectorTileSource from 'ol/source/VectorTile.js';
15-
import Stroke from 'ol/style/Stroke';
16-
import Style from 'ol/style/Style';
15+
import Stroke from 'ol/style/Stroke.js';
16+
import Style from 'ol/style/Style.js';
1717
import OSMSource from 'ol/source/OSM.js';
1818
import {OLCS_ION_TOKEN} from './_common.js';
1919

src/olcs/AbstractSynchronizer.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import {unByKey as olObservableUnByKey} from 'ol/Observable.js';
55
import LayerGroup from 'ol/layer/Group.js';
66
import {getUid, olcsListen} from './util.js';
7-
import Map from 'ol/Map'
7+
import Map from 'ol/Map.js';
88
import type {Scene, ImageryLayer} from 'cesium';
9-
import View from 'ol/View';
10-
import Collection from 'ol/Collection';
11-
import BaseLayer from 'ol/layer/Base';
12-
import {EventsKey} from 'ol/events';
13-
import {LayerWithParents} from './core';
9+
import View from 'ol/View.js';
10+
import Collection from 'ol/Collection.js';
11+
import BaseLayer from 'ol/layer/Base.js';
12+
import type {EventsKey} from 'ol/events.js';
13+
import type {LayerWithParents} from './core.js';
1414
import VectorLayerCounterpart from './core/VectorLayerCounterpart';
1515

1616

src/olcs/OLCesium.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
import olGeomPoint from 'ol/geom/Point.js';
55
import {supportsImageRenderingPixelated, imageRenderingValue} from './util.js';
66
import {ol4326CoordinateToCesiumCartesian} from './core';
7-
import {getTransform, TransformFunction} from 'ol/proj.js';
7+
import {getTransform, type TransformFunction} from 'ol/proj.js';
88
import olcsAutoRenderLoop from './AutoRenderLoop.js';
99
import olcsCamera from './Camera.js';
1010
import olcsRasterSynchronizer from './RasterSynchronizer';
1111
import olcsVectorSynchronizer from './VectorSynchronizer';
1212
import olcsOverlaySynchronizer from './OverlaySynchronizer.js';
13-
import Map from 'ol/Map'
14-
import Interaction from 'ol/interaction/Interaction';
15-
import {Group} from 'ol/layer';
16-
import Feature from 'ol/Feature';
17-
import View from 'ol/View';
13+
import Map from 'ol/Map.js';
14+
import Interaction from 'ol/interaction/Interaction.js';
15+
import {Group} from 'ol/layer.js';
16+
import Feature from 'ol/Feature.js';
17+
import View from 'ol/View.js';
1818
import type {
1919
BoundingSphere, ContextOptions,
2020
DataSourceCollection,

src/olcs/RasterSynchronizer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import Map from 'ol/Map';
55
import {getUid, stableSort} from './util.js';
66
import olcsAbstractSynchronizer from './AbstractSynchronizer';
7-
import {LayerWithParents, tileLayerToImageryLayer, updateCesiumLayerProperties} from './core';
7+
import {type LayerWithParents, tileLayerToImageryLayer, updateCesiumLayerProperties} from './core';
88
import type {Scene, ImageryLayer, ImageryLayerCollection} from 'cesium';
99
import type BaseLayer from 'ol/layer/Base';
1010
import type Projection from 'ol/proj/Projection';

src/olcs/VectorSynchronizer.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import olLayerVectorTile from 'ol/layer/VectorTile.js';
1010
import olcsAbstractSynchronizer from './AbstractSynchronizer';
1111
import olcsFeatureConverter from './FeatureConverter.js';
1212
import VectorLayerCounterpart, {
13-
OlFeatureToCesiumContext,
14-
PrimitiveCollectionCounterpart
13+
type OlFeatureToCesiumContext,
14+
type PrimitiveCollectionCounterpart
1515
} from './core/VectorLayerCounterpart';
16-
import type Map from 'ol/Map'
17-
import {LayerWithParents} from './core';
18-
import Feature from 'ol/Feature';
19-
import BaseLayer from 'ol/layer/Base';
20-
import {Billboard, Primitive, PrimitiveCollection, Scene} from 'cesium';
16+
import type Map from 'ol/Map.js';
17+
import {type LayerWithParents} from './core';
18+
import Feature from 'ol/Feature.js';
19+
import BaseLayer from 'ol/layer/Base.js';
20+
import {Primitive, PrimitiveCollection, Scene} from 'cesium';
2121

2222
class VectorSynchronizer extends olcsAbstractSynchronizer<VectorLayerCounterpart> {
2323
protected converter: olcsFeatureConverter;

src/olcs/core.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import {linear as linearEasing} from 'ol/easing.js';
55
import olLayerTile from 'ol/layer/Tile.js';
66
import olLayerImage from 'ol/layer/Image.js';
7-
import {get as getProjection, ProjectionLike, transformExtent} from 'ol/proj.js';
7+
import {get as getProjection, type ProjectionLike, transformExtent} from 'ol/proj.js';
88
import olSourceImageStatic from 'ol/source/ImageStatic.js';
99
import olSourceImageWMS from 'ol/source/ImageWMS.js';
1010
import olSourceTileImage from 'ol/source/TileImage.js';
@@ -15,8 +15,8 @@ import olcsCoreOLImageryProvider from './core/OLImageryProvider.js';
1515
import {getSourceProjection} from './util.js';
1616
import MVTImageryProvider from './MVTImageryProvider.js';
1717
import VectorTileLayer from 'ol/layer/VectorTile.js';
18-
import {Extent, getCenter as getExtentCenter} from 'ol/extent';
19-
import BaseLayer from 'ol/layer/Base';
18+
import {type Extent, getCenter as getExtentCenter} from 'ol/extent.js';
19+
import BaseLayer from 'ol/layer/Base.js';
2020
import LayerGroup from 'ol/layer/Group.js';
2121
import type {
2222
BoundingSphere,
@@ -32,13 +32,16 @@ import type {
3232
Scene,
3333
SingleTileImageryProvider
3434
} from 'cesium';
35-
import Geometry from 'ol/geom/Geometry';
36-
import {Coordinate} from 'ol/coordinate';
37-
import Source, {Attribution} from 'ol/source/Source';
38-
import Map from 'ol/Map';
39-
import Projection from 'ol/proj/Projection';
40-
import {Color as OLColor} from 'ol/color'
41-
import View from 'ol/View';
35+
import Geometry from 'ol/geom/Geometry.js';
36+
import type {Coordinate} from 'ol/coordinate.js';
37+
import Source from 'ol/source/Source.js';
38+
// eslint-disable-next-line no-duplicate-imports
39+
import type {Attribution} from 'ol/source/Source.js';
40+
41+
import Map from 'ol/Map.js';
42+
import Projection from 'ol/proj/Projection.js';
43+
import type {Color as OLColor} from 'ol/color.js';
44+
import View from 'ol/View.js';
4245

4346
type CesiumUrlDefinition = {
4447
url: string,

src/olcs/core/VectorLayerCounterpart.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* @module olcs.core.VectorLayerCounterpart
33
*/
44
import {unByKey as olObservableUnByKey} from 'ol/Observable.js';
5-
import type Projection from 'ol/proj/Projection';
5+
import type Projection from 'ol/proj/Projection.js';
66
import type {Billboard, BillboardCollection, Primitive, PrimitiveCollection, Scene} from 'cesium';
7-
import type {EventsKey} from 'ol/events';
7+
import type {EventsKey} from 'ol/events.js';
88

99

1010
/**

tsconfig.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"compilerOptions": {
3-
"target": "es2020",
4-
"lib": ["es2020", "dom"],
3+
"target": "ES2022",
4+
"lib": ["es2023", "dom"],
55
"allowJs": true,
66
//"checkJs": true,
77
"baseUrl": "./",
88
"skipLibCheck": true,
9-
"moduleResolution": "node",
9+
"moduleResolution": "Node",
10+
"verbatimModuleSyntax": true,
11+
"outDir": "./out",
1012
"noImplicitAny": true,
13+
"forceConsistentCasingInFileNames": true,
1114
"paths": {
1215
"ol/*": ["node_modules/ol/*"]
1316
},

0 commit comments

Comments
 (0)