Skip to content

Commit

Permalink
Eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Feb 29, 2024
1 parent a46538a commit e5b8d5e
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 204 deletions.
405 changes: 205 additions & 200 deletions .eslintrc.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion components/ImportLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import isEmpty from 'lodash.isempty';
import {WorkerMessageHandler} from "pdfjs-dist/build/pdf.worker";
import Proj4js from 'proj4';
import PropTypes from 'prop-types';
import url from 'url';

import {addLayer, addLayerFeatures} from '../actions/layers';
import EditableSelect from '../components/widgets/EditableSelect';
Expand Down
7 changes: 7 additions & 0 deletions components/Swipeable.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React from 'react';
import {useSwipeable} from 'react-swipeable';

import PropTypes from 'prop-types';


export const Swipeable = ({children, ...props}) => {
const handlers = useSwipeable(props);
return (<div { ...handlers }>{children}</div>);
};

Swipeable.propTypes = {
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qwc2",
"version": "2024.02.28-master",
"version": "2024.02.29-master",
"description": "QGIS Web Client 2 core",
"author": "Sourcepole AG",
"license": "BSD-2-Clause",
Expand Down
2 changes: 1 addition & 1 deletion plugins/MapTip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MapTip extends React.Component {
maptips: [],
pos: null
};
componentDidUpdate(prevProps, prevState) {
componentDidUpdate(prevProps) {
if (this.props.map !== prevProps.map || this.props.theme !== prevProps.theme) {
this.clearMaptip();
}
Expand Down
1 change: 1 addition & 0 deletions scripts/gen-plugin-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ pluginData.forEach(plugin => {
});

fs.writeFileSync('./qwc2/doc/plugins.md', output);
/* eslint-disable-next-line */
console.log("Plugin documentation written to doc/src/plugins.md!");
9 changes: 9 additions & 0 deletions scripts/themesConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function getThumbnail(configItem, resultItem, layers, crs, extent, resolve, prox
}
}

/* eslint-disable-next-line */
console.error("Using WMS GetMap to generate thumbnail for " + configItem.url);

// WMS GetMap request
Expand Down Expand Up @@ -105,6 +106,7 @@ function getThumbnail(configItem, resultItem, layers, crs, extent, resolve, prox
// finish task
resolve(true);
}).catch((error) => {
/* eslint-disable-next-line */
console.error("ERROR generating thumbnail for WMS " + configItem.url + ":\n", error);
resultItem.thumbnail = "img/mapthumbs/default.jpg";
// finish task
Expand Down Expand Up @@ -300,6 +302,7 @@ function getTheme(config, configItem, result, resultItem, proxy) {
}
);

/* eslint-disable-next-line */
console.log("Parsing WMS GetProjectSettings of " + configItem.url);

const topLayer = capabilities.Capability.Layer;
Expand Down Expand Up @@ -401,6 +404,7 @@ function getTheme(config, configItem, result, resultItem, proxy) {
printTemplate.atlasCoverageLayer = atlasLayer;
printTemplate.atlas_pk = pk;
} catch (e) {
/* eslint-disable-next-line */
console.warn("Failed to determine primary key for atlas layer " + atlasLayer);
}
}
Expand Down Expand Up @@ -540,6 +544,7 @@ function getTheme(config, configItem, result, resultItem, proxy) {
// get thumbnail asynchronously
getThumbnail(configItem, resultItem, visibleLayers, crs, extent, resolve, proxy);
}).catch((error) => {
/* eslint-disable-next-line */
console.error("ERROR reading WMS GetProjectSettings of " + configItem.url + ":\n", error);
resultItem.error = "Could not read GetProjectSettings";
resultItem.title = "Error";
Expand Down Expand Up @@ -639,14 +644,17 @@ function genThemes(themesConfig) {
// write config file
fs.writeFile(process.cwd() + '/static/themes.json', JSON.stringify(result, null, 2), (error) => {
if (error) {
/* eslint-disable-next-line */
console.error("ERROR:", error);
process.exit(1);
} else {
/* eslint-disable-next-line */
console.log("\nCreated themes.json\n\n");
}
});

}).catch((error) => {
/* eslint-disable-next-line */
console.error("ERROR:", error);
process.exit(1);
});
Expand All @@ -658,6 +666,7 @@ lookup(os.hostname(), { hints: dns.ADDRCONFIG })
.then((result) => lookupService(result.address, 0))
.then((result) => {
hostFqdn = "http://" + result.hostname;
/* eslint-disable-next-line */
console.log("Reading " + themesConfigPath);

genThemes(themesConfigPath);
Expand Down
5 changes: 5 additions & 0 deletions scripts/updateTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const workspaces = readJSON('/package.json').workspaces || [];
// Generate workspace translations
let collectedMsgIds = new Set();
for (const workspace of workspaces) {
/* eslint-disable-next-line */
console.log("Generating translations for " + workspace);
const newMsgIds = updateTsConfig(process.cwd() + '/' + workspace, '/' + workspace + '/translations/tsconfig.json');
collectedMsgIds = new Set([...collectedMsgIds, ...newMsgIds]);
Expand All @@ -110,8 +111,10 @@ for (const workspace of workspaces) {
// Write updated translations file
try {
fs.writeFileSync(process.cwd() + '/' + workspace + '/translations/' + lang + ".json", JSON.stringify(data, null, 2) + "\n");
/* eslint-disable-next-line */
console.log('Wrote ' + workspace + '/translations/' + lang + '.json');
} catch (e) {
/* eslint-disable-next-line */
console.error('Failed to write ' + workspace + '/translations/' + lang + '.json: ' + e);
}
}
Expand Down Expand Up @@ -147,8 +150,10 @@ for (const lang of config.languages || []) {
// Write output
try {
fs.writeFileSync(process.cwd() + '/static/translations/' + lang + '.json', JSON.stringify(data, null, 2) + "\n");
/* eslint-disable-next-line */
console.log('Wrote static/translations/' + lang + '.json');
} catch (e) {
/* eslint-disable-next-line */
console.error('Failed to write static/translations/' + lang + '.json: ' + e);
}
}
3 changes: 2 additions & 1 deletion utils/LayerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const LayerUtils = {
newParams = {
LAYERS: layers.join(","),
OPACITIES: layers.map((x, i) => Math.round((opacities[i] ?? "255") * opacityMult)).map(Math.round).join(","),
STYLES: layer.style ?? params.STYLES ?? layers.map(x => "").join(","),
STYLES: layer.style ?? params.STYLES ?? layers.map(() => "").join(","),
...layer.dimensionValues
};
queryLayers = layer.queryable && !layer.omitFromQueryLayers ? [layer.name] : [];
Expand Down Expand Up @@ -717,6 +717,7 @@ const LayerUtils = {
if (externalLayer.tileGridName) {
externalLayer.tileGridConfig = (ConfigUtils.getConfigProp("mvtTileGrids") || {})[externalLayer.tileGridName];
if (!externalLayer.tileGridConfig) {
/* eslint-disable-next-line */
console.warn("Tile grid config not found: " + externalLayer.tileGridName);
}
}
Expand Down

0 comments on commit e5b8d5e

Please sign in to comment.