Make code prettier

This updates ESLint and our shared eslint-config-openlayers to use Prettier.  Most formatting changes were automatically applied with this:

    npm run lint -- --fix

A few manual changes were required:

 * In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
 * In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason.  While editing this, I reworked `ExampleBuilder` to be a class.
 * In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
Tim Schaub
2020-04-06 12:25:12 -06:00
parent 53b48baf62
commit 054af09032
790 changed files with 46833 additions and 33765 deletions

View File

@@ -1,13 +1,12 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls, ScaleLine} from '../src/ol/control.js';
import ImageLayer from '../src/ol/layer/Image.js';
import {fromLonLat} from '../src/ol/proj.js';
import Projection from '../src/ol/proj/Projection.js';
import ImageWMS from '../src/ol/source/ImageWMS.js';
import {register} from '../src/ol/proj/proj4.js';
import Map from '../src/ol/Map.js';
import Projection from '../src/ol/proj/Projection.js';
import View from '../src/ol/View.js';
import proj4 from 'proj4';
import {ScaleLine, defaults as defaultControls} from '../src/ol/control.js';
import {fromLonLat} from '../src/ol/proj.js';
import {register} from '../src/ol/proj/proj4.js';
// Transparent Proj4js support:
//
@@ -22,15 +21,17 @@ import proj4 from 'proj4';
// determine the view resolution for zoom level 0. Recommended values for a
// projection's validity extent can be found at https://epsg.io/.
proj4.defs('EPSG:21781',
proj4.defs(
'EPSG:21781',
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 ' +
'+x_0=600000 +y_0=200000 +ellps=bessel ' +
'+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs');
'+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs'
);
register(proj4);
const projection = new Projection({
code: 'EPSG:21781',
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864]
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
});
const extent = [420000, 30000, 900000, 350000];
@@ -40,38 +41,38 @@ const layers = [
source: new ImageWMS({
url: 'https://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
'en/home.html">Pixelmap 1:1000000 / geo.admin.ch</a>',
attributions:
'© <a href="http://www.geo.admin.ch/internet/geoportal/' +
'en/home.html">Pixelmap 1:1000000 / geo.admin.ch</a>',
params: {
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'FORMAT': 'image/jpeg'
'FORMAT': 'image/jpeg',
},
serverType: 'mapserver'
})
serverType: 'mapserver',
}),
}),
new ImageLayer({
extent: extent,
source: new ImageWMS({
url: 'https://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
'en/home.html">National parks / geo.admin.ch</a>',
attributions:
'© <a href="http://www.geo.admin.ch/internet/geoportal/' +
'en/home.html">National parks / geo.admin.ch</a>',
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
serverType: 'mapserver'
})
})
serverType: 'mapserver',
}),
}),
];
const map = new Map({
controls: defaultControls().extend([
new ScaleLine()
]),
controls: defaultControls().extend([new ScaleLine()]),
layers: layers,
target: 'map',
view: new View({
projection: projection,
center: fromLonLat([8.23, 46.86], projection),
extent: extent,
zoom: 2
})
zoom: 2,
}),
});