From 7bd80d5bd81e0d4cb0d27a8aefa5aba9b879eaa6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:52:28 +0000 Subject: [PATCH 01/10] Update dependency eslint to v9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 19d2519e58de..f48d51ceb91b 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "doctrine": "3.0.0", "editorconfig-checker": "5.1.8", "ejs-loader": "0.5.0", - "eslint": "8.57.0", + "eslint": "9.9.1", "eslint-plugin-jsdoc": "50.2.2", "eslint-plugin-lit": "1.14.0", "eslint-plugin-wc": "2.1.1", From 95b4ada0b429bd230f7ed79c60dc12bc03626921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 15:44:52 +0200 Subject: [PATCH 02/10] Migrate eslint config --- .eslintrc.yaml | 76 ----------------------------------- Makefile | 12 +++--- eslint.config.mjs | 100 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 9 +++-- 4 files changed, 112 insertions(+), 85 deletions(-) delete mode 100644 .eslintrc.yaml create mode 100644 eslint.config.mjs diff --git a/.eslintrc.yaml b/.eslintrc.yaml deleted file mode 100644 index ef7ce9420208..000000000000 --- a/.eslintrc.yaml +++ /dev/null @@ -1,76 +0,0 @@ -extends: - - eslint:recommended - - plugin:jsdoc/recommended - - plugin:@typescript-eslint/recommended - - plugin:@typescript-eslint/recommended-requiring-type-checking - - plugin:wc/recommended - - plugin:lit/recommended - -plugins: - - '@typescript-eslint' - -parser: '@typescript-eslint/parser' -parserOptions: - sourceType: module - ecmaVersion: 2020 - project: - - tsconfig-eslint.json - -env: - es6: true - node: true - browser: true - jquery: true - -rules: - no-multi-asterisks: off - no-prototype-builtins: warn - no-case-declarations: warn - no-eq-null: error - no-multi-assign: error - no-negated-in-lhs: error - no-use-before-define: - - error - - nofunc - no-var: error - jsdoc/require-param-type: off - jsdoc/require-property-type: off - jsdoc/require-returns-type: off - jsdoc/check-tag-names: warn - # not compatible with jsdoc - jsdoc/check-types: off - jsdoc/no-undefined-types: warn - jsdoc/require-returns-description: warn - jsdoc/require-param-description: warn - jsdoc/require-property-description: warn - '@typescript-eslint/no-var-requires': off - '@typescript-eslint/ban-ts-comment': off - '@typescript-eslint/no-explicit-any': off - '@typescript-eslint/no-empty-function': off - '@typescript-eslint/no-non-null-assertion': off - '@typescript-eslint/explicit-module-boundary-types': warn - '@typescript-eslint/no-unsafe-member-access': warn - '@typescript-eslint/no-unsafe-assignment': warn - '@typescript-eslint/no-unsafe-return': warn - '@typescript-eslint/no-unsafe-call': warn - '@typescript-eslint/no-floating-promises': warn - '@typescript-eslint/unbound-method': warn - '@typescript-eslint/restrict-template-expressions': warn - '@typescript-eslint/no-misused-promises': warn - '@typescript-eslint/require-await': warn - '@typescript-eslint/no-unsafe-argument': warn - '@typescript-eslint/no-unused-vars': warn - '@typescript-eslint/no-unused-expressions': warn - '@typescript-eslint/prefer-promise-reject-errors': warn - # TODO: Remove before release 2.9 - '@typescript-eslint/no-require-imports': warn - '@typescript-eslint/no-useless-constructor': error - '@typescript-eslint/prefer-for-of': error - '@typescript-eslint/prefer-includes': error - '@typescript-eslint/prefer-string-starts-ends-with': error - -settings: - jsdoc: - preferredTypes: - '[]': - 'Array<>': '[]' diff --git a/Makefile b/Makefile index 670e4a2635ec..32edb90b6edf 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ examples-hosted-apps: .build/gmf-apps.timestamp npm run build-gmf-apps touch $@ -.build/eslint.timestamp: .eslintrc.yaml \ +.build/eslint.timestamp: eslint.config.mjs \ $(API_JS_FILES) \ $(NGEO_JS_FILES) \ $(NGEO_TEST_JS_FILES) \ @@ -208,16 +208,16 @@ examples-hosted-apps: .build/gmf-apps.timestamp $(GMF_EXAMPLES_JS_FILES) \ $(GMF_APPS_JS_FILES) \ $(BUILD_JS_FILES) - ./node_modules/.bin/eslint $(filter-out .eslintrc.yaml, $^) + ./node_modules/.bin/eslint $(filter-out eslint.config.mjs, $^) touch $@ -.build/eslint-ts.timestamp: .eslintrc.yaml \ +.build/eslint-ts.timestamp: eslint.config.mjs \ $(TS_FILES) - ./node_modules/.bin/eslint --max-warnings=0 $(filter-out .eslintrc.yaml .eslintrc-ts.yaml, $^) + ./node_modules/.bin/eslint --max-warnings=0 $(filter-out eslint.config.mjs .eslintrc-ts.yaml, $^) touch $@ .PHONY: eslint-fix -eslint-fix: .eslintrc.yaml \ +eslint-fix: eslint.config.mjs \ $(API_JS_FILES) \ $(NGEO_JS_FILES) \ $(NGEO_TEST_JS_FILES) \ @@ -225,7 +225,7 @@ eslint-fix: .eslintrc.yaml \ $(GMF_EXAMPLES_JS_FILES) \ $(GMF_APPS_JS_FILES) \ $(BUILD_JS_FILES) - ./node_modules/.bin/eslint --fix $(filter-out .eslintrc.yaml, $^) + ./node_modules/.bin/eslint --fix $(filter-out eslint.config.mjs, $^) .build/examples-hosted/partials: examples/partials/ mkdir -p $(dir $@) diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000000..cd7821cc5f4f --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,100 @@ +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import globals from 'globals'; +import tsParser from '@typescript-eslint/parser'; +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; +import js from '@eslint/js'; +import {FlatCompat} from '@eslint/eslintrc'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +export default [ + ...compat.extends( + 'eslint:recommended', + 'plugin:jsdoc/recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:wc/recommended', + 'plugin:lit/recommended', + ), + { + plugins: { + '@typescript-eslint': typescriptEslint, + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.browser, + ...globals.jquery, + }, + + parser: tsParser, + ecmaVersion: 2020, + sourceType: 'module', + + parserOptions: { + project: ['tsconfig-eslint.json'], + }, + }, + + settings: { + jsdoc: { + preferredTypes: { + '[]': null, + 'Array<>': '[]', + }, + }, + }, + + rules: { + 'no-multi-asterisks': 'off', + 'no-prototype-builtins': 'warn', + 'no-case-declarations': 'warn', + 'no-eq-null': 'error', + 'no-multi-assign': 'error', + 'no-negated-in-lhs': 'error', + 'no-use-before-define': ['error', 'nofunc'], + 'no-var': 'error', + 'jsdoc/require-param-type': 'off', + 'jsdoc/require-property-type': 'off', + 'jsdoc/require-returns-type': 'off', + 'jsdoc/check-tag-names': 'warn', + 'jsdoc/check-types': 'off', + 'jsdoc/no-undefined-types': 'warn', + 'jsdoc/require-returns-description': 'warn', + 'jsdoc/require-param-description': 'warn', + 'jsdoc/require-property-description': 'warn', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'warn', + '@typescript-eslint/no-unsafe-member-access': 'warn', + '@typescript-eslint/no-unsafe-assignment': 'warn', + '@typescript-eslint/no-unsafe-return': 'warn', + '@typescript-eslint/no-unsafe-call': 'warn', + '@typescript-eslint/no-floating-promises': 'warn', + '@typescript-eslint/unbound-method': 'warn', + '@typescript-eslint/restrict-template-expressions': 'warn', + '@typescript-eslint/no-misused-promises': 'warn', + '@typescript-eslint/require-await': 'warn', + '@typescript-eslint/no-unsafe-argument': 'warn', + '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/no-unused-expressions': 'warn', + '@typescript-eslint/prefer-promise-reject-errors': 'warn', + '@typescript-eslint/no-require-imports': 'warn', + '@typescript-eslint/no-useless-constructor': 'error', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-includes': 'error', + '@typescript-eslint/prefer-string-starts-ends-with': 'error', + }, + }, +]; diff --git a/package.json b/package.json index f48d51ceb91b..83ecc1c26854 100644 --- a/package.json +++ b/package.json @@ -58,17 +58,20 @@ }, "devDependencies": { "@babel/core": "7.25.2", - "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6", - "@babel/plugin-proposal-optional-chaining": "7.21.0", "@babel/plugin-proposal-class-properties": "7.18.6", "@babel/plugin-proposal-decorators": "7.24.7", + "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6", + "@babel/plugin-proposal-optional-chaining": "7.21.0", "@babel/plugin-syntax-object-rest-spread": "7.8.3", "@babel/plugin-transform-spread": "7.24.7", "@babel/plugin-transform-typescript": "7.25.2", "@babel/preset-env": "7.25.3", "@babel/preset-typescript": "7.24.7", + "@eslint/eslintrc": "3.1.0", + "@eslint/js": "9.9.1", "@fortawesome/fontawesome-free": "5.15.4", "@lit/reactive-element": "1.6.3", + "@popperjs/core": "2.11.8", "@sentry/browser": "7.118.0", "@sentry/tracing": "7.114.0", "@sentry/types": "7.118.0", @@ -144,6 +147,7 @@ "floatthead": "2.2.5", "fs-extra": "11.2.0", "glob": "11.0.0", + "globals": "15.9.0", "html-webpack-plugin": "4.5.2", "i18next": "23.14.0", "i18next-browser-languagedetector": "8.0.0", @@ -179,7 +183,6 @@ "ol-layerswitcher": "4.1.2", "ol-mapbox-style": "12.3.5", "parse-absolute-css-unit": "1.0.2", - "@popperjs/core": "2.11.8", "proj4": "2.11.0", "puppeteer": "20.9.0", "qruri": "0.0.4", From f0c259ccb372fe419510ae430e39857d04e909c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 16:14:01 +0200 Subject: [PATCH 03/10] Eslint: auto-fix --- src/auth/FormElement.ts | 4 ++-- src/auth/component.spec.ts | 3 --- src/auth/component.stories.ts | 1 - src/canvas/Desktop.stories.ts | 1 - src/download/Csv.ts | 1 - src/e2e/desktop.spec.ts | 7 ++----- src/lidar/Manager.ts | 2 +- src/lidar/Measure.ts | 12 ++++++------ src/lidar/Plot.ts | 23 ++++++++++------------- src/profile/d3Elevation.ts | 3 +-- 10 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/auth/FormElement.ts b/src/auth/FormElement.ts index ba7317eaab98..ea65e432577c 100644 --- a/src/auth/FormElement.ts +++ b/src/auth/FormElement.ts @@ -618,9 +618,9 @@ export default class GmfAuthForm extends GmfBaseElement { */ cleanForm_(): void { const form = this.renderRoot.querySelector('form') as HTMLFormElement; - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + const loginField = document.body.querySelector('input[slot=gmf-auth-login]') as HTMLInputElement; - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + const passwordField = document.body.querySelector('input[slot=gmf-auth-password]') as HTMLInputElement; form.reset(); loginField.value = ''; diff --git a/src/auth/component.spec.ts b/src/auth/component.spec.ts index d9f607cf5076..06ef1ff232b2 100644 --- a/src/auth/component.spec.ts +++ b/src/auth/component.spec.ts @@ -62,7 +62,6 @@ describe('Auth component', () => { } as Configuration); }); - // eslint-disable-next-line @typescript-eslint/no-misused-promises it.skip('tries to login with wrong credentials', async () => { gmfAuthenticationService.load_(); expect(user.getState()).to.equal(UserState.NOT_INITIALIZED); @@ -81,7 +80,6 @@ describe('Auth component', () => { }); }); - // eslint-disable-next-line @typescript-eslint/no-misused-promises it.skip('logins successfully', async () => { gmfAuthenticationService.load_(); expect(user.getState()).to.equal(UserState.READY); @@ -95,7 +93,6 @@ describe('Auth component', () => { }); }); - // eslint-disable-next-line @typescript-eslint/no-misused-promises it.skip('logs out', async () => { expect(user.getState()).to.equal(UserState.LOGGED_IN); // eslint-disable-next-line @typescript-eslint/no-floating-promises diff --git a/src/auth/component.stories.ts b/src/auth/component.stories.ts index 31af7bd17067..a4a6da48d244 100644 --- a/src/auth/component.stories.ts +++ b/src/auth/component.stories.ts @@ -20,7 +20,6 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import './FormElement'; import './PanelElement'; diff --git a/src/canvas/Desktop.stories.ts b/src/canvas/Desktop.stories.ts index af143ba3c20b..f732ad3ff68c 100644 --- a/src/canvas/Desktop.stories.ts +++ b/src/canvas/Desktop.stories.ts @@ -20,7 +20,6 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import ToolButtonElement, {ToolButtonDefault} from 'gmfapi/elements/ToolButtonElement'; import {css, html, TemplateResult} from 'lit'; diff --git a/src/download/Csv.ts b/src/download/Csv.ts index cf0123f11f85..f5631e9096b5 100644 --- a/src/download/Csv.ts +++ b/src/download/Csv.ts @@ -101,7 +101,6 @@ export class DownloadCsvService { const rowValues = values.map((value) => { if (value !== undefined && value !== null) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions const strValue = `${value}`; // wrap each value into quotes and escape quotes with double quotes return `${this.quote_}${strValue.replace(matchAllQuotesRegex, doubleQuote)}${this.quote_}`; diff --git a/src/e2e/desktop.spec.ts b/src/e2e/desktop.spec.ts index e64000019455..3a1af860eba5 100644 --- a/src/e2e/desktop.spec.ts +++ b/src/e2e/desktop.spec.ts @@ -21,9 +21,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/unbound-method */ import olMap from 'ol/Map'; import path from 'path'; @@ -251,9 +248,9 @@ if (Cypress.browser.isHeaded) { */ function validateCsv(csv: string, validationObject: any) { cy.wrap(csv) - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + .then(stripBom) // Remove Byte order mark - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + .then(neatCSV) // Parse the CSV .then((list: any) => { expect(list, 'number of records').to.have.length(1); diff --git a/src/lidar/Manager.ts b/src/lidar/Manager.ts index 1ada2c4a8f57..f4eabc8228e6 100644 --- a/src/lidar/Manager.ts +++ b/src/lidar/Manager.ts @@ -561,7 +561,7 @@ export class LidarprofileManager { this.profilePoints.altitude.push(z); this.profilePoints.coords.push([x, y]); } - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + aoffset = aoffset + attribute.bytes; } } diff --git a/src/lidar/Measure.ts b/src/lidar/Measure.ts index 1213c5f24aa5..fe674adeb3a4 100644 --- a/src/lidar/Measure.ts +++ b/src/lidar/Measure.ts @@ -153,9 +153,9 @@ export default class { if (p !== null) { this.pStart_.distance = p.distance; this.pStart_.altitude = p.altitude; - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + this.pStart_.cx = sx(p.distance) + margin.left; - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + this.pStart_.cy = sy(p.altitude) + margin.top; } else { // @ts-ignore @@ -178,9 +178,9 @@ export default class { if (p !== null) { this.pEnd_.distance = p.distance; this.pEnd_.altitude = p.altitude; - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + this.pEnd_.cx = sx(p.distance) + margin.left; - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + this.pEnd_.cy = sy(p.altitude) + margin.top; } else { // @ts-ignore @@ -221,9 +221,9 @@ export default class { svg .append('text') .attr('id', 'text_m') - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + .attr('x', 10 + (this.pStart_.cx + this.pEnd_.cx) / 2) - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + .attr('y', (this.pStart_.cy + this.pEnd_.cy) / 2) .text(`${height} m`) .attr('font-family', 'sans-serif') diff --git a/src/lidar/Plot.ts b/src/lidar/Plot.ts index 62f52b86a30a..0d0f016bd5f5 100644 --- a/src/lidar/Plot.ts +++ b/src/lidar/Plot.ts @@ -245,9 +245,9 @@ export default class { const containerEl = container.node(); const containerWidth = containerEl.getBoundingClientRect().width; const containerHeight = containerEl.getBoundingClientRect().height; - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + this.width_ = containerWidth - (margin.left + margin.right); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + this.height_ = containerHeight - (margin.top + margin.bottom); this.material = this.manager_.config.serverConfig.default_attribute; @@ -322,7 +322,6 @@ export default class { svg.selectAll('*').remove(); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands svg.attr('width', this.width_ + margin.left).attr('height', this.height_ + margin.top + margin.bottom); svg.on('mousemove', (event: MouseEvent) => { @@ -340,9 +339,8 @@ export default class { // @ts-ignore svg.append('g').attr('class', 'x axis').call(xAxis); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands svg.select('.y.axis').attr('transform', `translate(${margin.left}, ${margin.top})`); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + svg.select('.x.axis').attr('transform', `translate(${margin.left}, ${this.height_ + margin.top})`); svg.select('.y.axis').selectAll('g.tick line').style('opacity', '0.5').style('stroke', '#b7cff7'); @@ -470,9 +468,8 @@ export default class { const source = this.manager_.lidarPointHighlight.getSource(); if (p != undefined) { - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands cx = this.updateScaleX(p.distance) + margin.left; - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + cy = this.updateScaleY(p.altitude) + margin.top; svg.selectAll('#highlightCircle').remove(); @@ -482,7 +479,7 @@ export default class { .attr('id', 'highlightCircle') .attr('cx', cx) .attr('cy', cy) - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + .attr('r', pointSize + 1) .style('fill', 'orange'); @@ -515,7 +512,7 @@ export default class { ); } - source.addFeature(lidarPointFeature); // eslint-disable-line @typescript-eslint/no-unsafe-call + source.addFeature(lidarPointFeature); } else { source.clear(); svg.select('#highlightCircle').remove(); @@ -544,22 +541,22 @@ export default class { if (distance !== undefined) { const distanceTxt = i18next.t('Distance: '); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + html.push(`${distanceTxt + this.formatDecimals(distance, distDecimal)}`); } if (altitude !== undefined) { const altitudeTxt = i18next.t('Altitude: '); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + html.push(`${altitudeTxt + this.formatDecimals(altitude, distDecimal)}`); } if (classification.length > 0) { const classificationTxt = i18next.t('Classification: '); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + html.push(`${classificationTxt + classification}`); } if (intensity !== undefined) { const intensityTxt = i18next.t('Intensity: '); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + html.push(`${intensityTxt + this.formatDecimals(intensity, 0)}`); } diff --git a/src/profile/d3Elevation.ts b/src/profile/d3Elevation.ts index 99f9c9c667db..459981cf96c4 100644 --- a/src/profile/d3Elevation.ts +++ b/src/profile/d3Elevation.ts @@ -22,7 +22,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable jsdoc/no-undefined-types */ import d3, { area as d3area, @@ -269,7 +268,7 @@ function d3Elevation( // eslint-disable-next-line @typescript-eslint/no-unused-vars const func = function (data: number[][], index: number, groups: d3.BaseType[] | ArrayLike) { // @ts-ignore - const element: ContainerElement = this; // eslint-disable-line @typescript-eslint/no-this-alias, @typescript-eslint/no-explicit-any + const element: ContainerElement = this; // eslint-disable-line @typescript-eslint/no-this-alias d3select(element).selectAll('svg').remove(); if (data === undefined) { return; From e03b7763a8a2cc704386eb1dd343bafa49d46343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 16:59:40 +0200 Subject: [PATCH 04/10] fix --- test/.eslintrc.yaml | 4 ---- test/eslint.config.mjs | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) delete mode 100644 test/.eslintrc.yaml create mode 100644 test/eslint.config.mjs diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml deleted file mode 100644 index 0b39c32e9c04..000000000000 --- a/test/.eslintrc.yaml +++ /dev/null @@ -1,4 +0,0 @@ -env: - jasmine: true -globals: - sinon: true diff --git a/test/eslint.config.mjs b/test/eslint.config.mjs new file mode 100644 index 000000000000..577b2f73e9a2 --- /dev/null +++ b/test/eslint.config.mjs @@ -0,0 +1,12 @@ +import globals from 'globals'; + +export default [ + { + languageOptions: { + globals: { + ...globals.jasmine, + sinon: true, + }, + }, + }, +]; From aa54deb46160f23e5bc2d97a2795f3e037c6afbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 17:08:03 +0200 Subject: [PATCH 05/10] fix --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 32edb90b6edf..692fe12edfb3 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ examples-hosted-apps: .build/gmf-apps.timestamp npm run build-gmf-apps touch $@ -.build/eslint.timestamp: eslint.config.mjs \ +.build/eslint.timestamp: eslint.config.mjs .build/eslint.test.timestamp \ $(API_JS_FILES) \ $(NGEO_JS_FILES) \ $(NGEO_TEST_JS_FILES) \ @@ -208,7 +208,14 @@ examples-hosted-apps: .build/gmf-apps.timestamp $(GMF_EXAMPLES_JS_FILES) \ $(GMF_APPS_JS_FILES) \ $(BUILD_JS_FILES) - ./node_modules/.bin/eslint $(filter-out eslint.config.mjs, $^) + ./node_modules/.bin/eslint $(filter-out eslint.config.mjs .build/eslint.test.timestamp, $^) + touch $@ + + +.build/eslint.test.timestamp: test/eslint.config.mjs \ + $(NGEO_TEST_JS_FILES) \ + $(GMF_TEST_JS_FILES) + ./node_modules/.bin/eslint --config= test/eslint.config.mjs $(filter-out test/eslint.config.mjs, $^) touch $@ .build/eslint-ts.timestamp: eslint.config.mjs \ From d853f29b5f9d0338f4459b8e4f98be52ceb1d116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 17:13:12 +0200 Subject: [PATCH 06/10] f --- Makefile | 2 +- test/eslint.config.mjs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 692fe12edfb3..7cd577dcb5f9 100644 --- a/Makefile +++ b/Makefile @@ -215,7 +215,7 @@ examples-hosted-apps: .build/gmf-apps.timestamp .build/eslint.test.timestamp: test/eslint.config.mjs \ $(NGEO_TEST_JS_FILES) \ $(GMF_TEST_JS_FILES) - ./node_modules/.bin/eslint --config= test/eslint.config.mjs $(filter-out test/eslint.config.mjs, $^) + ./node_modules/.bin/eslint --config=test/eslint.config.mjs $(filter-out test/eslint.config.mjs, $^) touch $@ .build/eslint-ts.timestamp: eslint.config.mjs \ diff --git a/test/eslint.config.mjs b/test/eslint.config.mjs index 577b2f73e9a2..68f56f17f0f5 100644 --- a/test/eslint.config.mjs +++ b/test/eslint.config.mjs @@ -8,5 +8,9 @@ export default [ sinon: true, }, }, + + rules: { + 'valid-jsdoc': 'off', + }, }, ]; From 87e2db9582eb826d41f881e64599b8fb068bbbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 17:21:43 +0200 Subject: [PATCH 07/10] f --- Makefile | 2 -- contribs/gmf/test/.eslintrc.yaml | 2 -- test/eslint.config.mjs | 4 ---- 3 files changed, 8 deletions(-) delete mode 100644 contribs/gmf/test/.eslintrc.yaml diff --git a/Makefile b/Makefile index 7cd577dcb5f9..2bb487a1e881 100644 --- a/Makefile +++ b/Makefile @@ -202,9 +202,7 @@ examples-hosted-apps: .build/gmf-apps.timestamp .build/eslint.timestamp: eslint.config.mjs .build/eslint.test.timestamp \ $(API_JS_FILES) \ $(NGEO_JS_FILES) \ - $(NGEO_TEST_JS_FILES) \ $(NGEO_EXAMPLES_JS_FILES) \ - $(GMF_TEST_JS_FILES) \ $(GMF_EXAMPLES_JS_FILES) \ $(GMF_APPS_JS_FILES) \ $(BUILD_JS_FILES) diff --git a/contribs/gmf/test/.eslintrc.yaml b/contribs/gmf/test/.eslintrc.yaml deleted file mode 100644 index 73255ae23afc..000000000000 --- a/contribs/gmf/test/.eslintrc.yaml +++ /dev/null @@ -1,2 +0,0 @@ -env: - jasmine: true diff --git a/test/eslint.config.mjs b/test/eslint.config.mjs index 68f56f17f0f5..577b2f73e9a2 100644 --- a/test/eslint.config.mjs +++ b/test/eslint.config.mjs @@ -8,9 +8,5 @@ export default [ sinon: true, }, }, - - rules: { - 'valid-jsdoc': 'off', - }, }, ]; From 78f4fb353041bc467db2baecf2a3f50495758190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 17:32:20 +0200 Subject: [PATCH 08/10] f --- test/spec/beforeeach.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/spec/beforeeach.js b/test/spec/beforeeach.js index 4aebad9743cb..09a1d086eae0 100644 --- a/test/spec/beforeeach.js +++ b/test/spec/beforeeach.js @@ -20,7 +20,6 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // @ts-nocheck -/* eslint valid-jsdoc: 0 */ import angular from 'angular'; import ngeoMainmodule from 'ngeo/mainmodule'; import i18next from 'i18next'; From bd92be97fb38254068afed215d7f8f2814668060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 17:54:05 +0200 Subject: [PATCH 09/10] f --- src/misc/php-date-formatter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/misc/php-date-formatter.js b/src/misc/php-date-formatter.js index 145634cb325c..d66dc152f242 100644 --- a/src/misc/php-date-formatter.js +++ b/src/misc/php-date-formatter.js @@ -37,7 +37,6 @@ */ /* eslint max-len: 0 */ -/* eslint valid-jsdoc: 0 */ /* eslint quotes: 0 */ /* eslint indent: 0 */ /* eslint default-case: 0 */ From d6f08ea91ff3dfe0d5c2a57a434e00efb84c1efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 26 Aug 2024 18:19:28 +0200 Subject: [PATCH 10/10] f --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2bb487a1e881..ee244851d82a 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ GMF_EXAMPLES_JS_FILES := $(GMF_EXAMPLES_HTML_FILES:.html=.js) GMF_APPS += mobile desktop desktop_alt iframe_api mobile_alt oeedit GMF_APPS_JS_FILES = $(shell find contribs/gmf/apps/ -type f -name '*.js') $(shell find contribs/gmf/apps/ -type f -name '*.ts') -BUILD_JS_FILES = $(shell ls -1 *.js) $(shell ls -1 utils/*.js) $(shell find buildtools/ -type f -name '*.js') $(shell find .storybook/ -type f -name '*.js') $(shell find cypress/ -type f -name '*.js') +BUILD_JS_FILES = $(shell ls -1 *.js) $(shell ls -1 utils/*.js) $(shell find buildtools/ -type f -name '*.js') $(shell find cypress/ -type f -name '*.js') GMF_APPS_PARTIALS_FILES = $(shell find contribs/gmf/apps/ -type f -name '*.html' -or -name '*.html.ejs') GMF_APPS_ALL_FILES = $(shell find contribs/gmf/apps/ -type f) $(NGEO_ALL_SRC_FILES)