Skip to content

Commit

Permalink
ESLint - Limit lines to 350
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Feb 6, 2025
1 parent 580eb57 commit 6c1803c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
14 changes: 12 additions & 2 deletions assets/src/components/SelectionTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ export default class SelectionTool extends HTMLElement {
}

connectedCallback() {

/**
* @typedef lizDict
*/
let selectionResult;
if (mainLizmap.selectionTool.selectedFeaturesCount > 1){
selectionResult = lizDict['selectiontool.results.more'].replace('%s', mainLizmap.selectionTool.selectedFeaturesCount);
} else if (mainLizmap.selectionTool.selectedFeaturesCount === 1) {
selectionResult = lizDict['selectiontool.results.one'];
} else {
selectionResult = lizDict['selectiontool.results.none'];
}
const isFilterDisabled = mainLizmap.selectionTool.selectedFeaturesCount === 0 && mainLizmap.selectionTool.filteredFeaturesCount === 0;
const mainTemplate = () => html`
<div class="selectiontool">
Expand Down Expand Up @@ -63,7 +73,7 @@ export default class SelectionTool extends HTMLElement {
<option value="touches">${lizDict['selectiontool.toolbar.geomOperator.touches']}</option>
</select>
</div>
<div class="selectiontool-results" style="padding:2px">${mainLizmap.selectionTool.selectedFeaturesCount > 1 ? lizDict['selectiontool.results.more'].replace('%s', mainLizmap.selectionTool.selectedFeaturesCount) : mainLizmap.selectionTool.selectedFeaturesCount === 1 ? lizDict['selectiontool.results.one'] : lizDict['selectiontool.results.none']}</div>
<div class="selectiontool-results" style="padding:2px">${selectionResult}</div>
<div class="selectiontool-actions">
<div class="selectiontool-type-buttons btn-group">
<button type="button" class="selectiontool-type-refresh btn btn-sm ${mainLizmap.selectionTool.newAddRemoveSelected === 'new' ? 'active' : ''}" @click=${() => mainLizmap.selectionTool.newAddRemoveSelected = 'new'} data-bs-toggle="tooltip" data-bs-title="${lizDict['selectiontool.toolbar.action.type.refresh']}" value="refresh">
Expand Down
4 changes: 4 additions & 0 deletions assets/src/modules/Digitizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,9 @@ export class Digitizing {
</PolygonSymbolizer>`;
}

/* eslint-disable @stylistic/js/max-len --
* Block of XML
**/
const sld =
`<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
Expand All @@ -1193,6 +1196,7 @@ export class Digitizing {
</FeatureTypeStyle>
</UserStyle>
</StyledLayerDescriptor>`;
/* eslint-enable @stylistic/js/max-len */

// Remove indentation to avoid big queries full of unecessary spaces
return sld.replace(' ', '');
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default [
}
],
"@stylistic/js/max-len": [
"error", 400, 4], // It's a temporary value, until we fix some.
"error", 350, 4], // It's a temporary value, until we fix some.
"no-prototype-builtins": "off",
"no-undef": "off",
'jsdoc/require-description': 'warn',
Expand Down
11 changes: 8 additions & 3 deletions tests/end2end/playwright/print.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@ test.describe('Print', () => {

// check request
getPrintRequest = await getPrintPromise;
/* eslint-disable no-useless-escape, @stylistic/js/max-len --
* Block of SLD
**/
// Extend and update GetPrint parameters
/* eslint-disable no-useless-escape */
const expectedParameters4 = Object.assign({}, expectedParameters, {
'TEMPLATE': 'print_labels',
'map0:EXTENT': /759249.\d+,6271892.\d+,781949.\d+,6286892.\d+/,
Expand Down Expand Up @@ -195,6 +197,7 @@ test.describe('Print', () => {
// 'multiline_label': 'Multiline label',
})
/* eslint-enable no-useless-escape */
/* eslint-enable @stylistic/js/max-len */
getPrintParams = await expectParametersToContain('Print requests 4', getPrintRequest.postData() ?? '', expectedParameters4)
await expect(getPrintParams.size).toBe(17)
});
Expand Down Expand Up @@ -584,8 +587,10 @@ test.describe('Print 3857', () => {

// check request
getPrintRequest = await getPrintPromise;
/* eslint-disable no-useless-escape, @stylistic/js/max-len --
* Block of SLD
**/
// Extend and update GetPrint parameters
/* eslint-disable no-useless-escape */
const expectedParameters3 = Object.assign({}, expectedParameters, {
'map0:EXTENT': /423093.\d+,5399873.\d+,439487.\d+,5410707.\d+/,
'map0:SCALE': '72224',
Expand Down Expand Up @@ -617,7 +622,7 @@ test.describe('Print 3857', () => {
// Disabled because of the migration when project is saved with QGIS >= 3.32
// 'multiline_label': 'Multiline label',
})
/* eslint-enable no-useless-escape */
/* eslint-enable no-useless-escape, @stylistic/js/max-len */
getPrintParams = await expectParametersToContain('Print requests 3', getPrintRequest.postData() ?? '', expectedParameters3)
await expect(getPrintParams.size).toBe(17)
});
Expand Down

0 comments on commit 6c1803c

Please sign in to comment.