From fedebeeda60ec3dc7ce5ef5c0282ead4f3122a7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 07:31:35 +0000 Subject: [PATCH] chore: bump eslint and eslint-config-mia to v10 with flat config migration Agent-Logs-Url: https://github.com/mia-platform/custom-plugin-lib/sessions/365468ad-49f9-4b3d-8d35-d6d3dca2cbac Co-authored-by: ThisIsDemetrio <5429953+ThisIsDemetrio@users.noreply.github.com> --- eslint.config.js | 3 +++ index.js | 1 - lib/httpClient.js | 4 ++-- lib/util.js | 2 +- package.json | 9 +++------ tests/getHttpClient.test.js | 2 +- tests/httpClient.test.js | 16 ++-------------- tests/index.test.js | 1 - tests/oas.test.js | 1 - 9 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..ad31d585 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('@mia-platform/eslint-config-mia') diff --git a/index.js b/index.js index 0a6c16d2..caca8530 100644 --- a/index.js +++ b/index.js @@ -286,7 +286,6 @@ async function decorateRequestAndFastifyInstance(fastify, { asyncInitFunction, s }) } - function initCustomServiceEnvironment(envSchema) { return function customService(asyncInitFunction, serviceOptions) { async function index(fastify, opts) { diff --git a/lib/httpClient.js b/lib/httpClient.js index d022ae1a..73c7fe75 100644 --- a/lib/httpClient.js +++ b/lib/httpClient.js @@ -147,7 +147,7 @@ class HttpClient { } const errToReturn = new Error(error.message) errToReturn.code = error.code - // eslint-disable-next-line id-blacklist + // eslint-disable-next-line id-denylist logger.error({ err: errToReturn }, 'generic request error') throw errToReturn } @@ -196,7 +196,7 @@ function getErrorMessage(response, returnAs, errorMessageKey) { case 'BUFFER': try { return JSON.parse(data)[errorMessageKey] - } catch (error) { + } catch { return DEFAULT_ERROR_MESSAGE } case 'JSON': diff --git a/lib/util.js b/lib/util.js index 8ce91f1b..02c820fb 100644 --- a/lib/util.js +++ b/lib/util.js @@ -33,7 +33,7 @@ function getUserProperties(userPropertiesAsString) { try { return JSON.parse(userPropertiesAsString) - } catch (error) { + } catch { return null } } diff --git a/package.json b/package.json index 9400bd0e..e54b56e7 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "checkonly": "! grep -R '\\.only' tests/", "coverage": "npm run unit && tap report --allow-incomplete-coverage text-summary", "postcoverage": "tap report --allow-incomplete-coverage html --no-browser", - "lint": "eslint . --ignore-path .gitignore", + "lint": "eslint .", "start": "echo 'unable to start the library directly' && exit 1", "test": "npm run lint && npm run unit && npm run checkonly && npm run typescript", "typescript": "tsc --project ./tests/types/tsconfig.json", @@ -55,9 +55,9 @@ }, "devDependencies": { "@fastify/routes": "^6.0.2", - "@mia-platform/eslint-config-mia": "^9.0.0", + "@mia-platform/eslint-config-mia": "^10.0.0", "@types/node": "^24.1.0", - "eslint": "^9.0.0", + "eslint": "^10.0.0", "fastify": "^5.6.1", "hpagent": "^1.2.0", "nock": "^13.3.1", @@ -69,8 +69,5 @@ }, "engines": { "node": ">=22" - }, - "eslintConfig": { - "extends": "@mia-platform/eslint-config-mia" } } diff --git a/tests/getHttpClient.test.js b/tests/getHttpClient.test.js index b7ca6808..d36f9f80 100644 --- a/tests/getHttpClient.test.js +++ b/tests/getHttpClient.test.js @@ -139,7 +139,7 @@ tap.test('getHttpClient throws on invalid url', async t => { const invalidUrl = 'httpnot-a-complete-url' try { getHttpClient.call(fastifyMock, invalidUrl) - } catch (error) { + } catch { t.notOk(true, 'The function should not throw anymore if the url is not a valid one, bet return the standard proxy') } }) diff --git a/tests/httpClient.test.js b/tests/httpClient.test.js index 67989440..a9ed9b4b 100644 --- a/tests/httpClient.test.js +++ b/tests/httpClient.test.js @@ -1,4 +1,3 @@ -/* eslint-disable no-sync */ 'use strict' const cp = require('child_process') @@ -1242,7 +1241,6 @@ tap.test('httpClient', test => { assert.end() }) - innerTest.end() }) @@ -1321,7 +1319,7 @@ tap.test('httpClient', test => { try { await service.get('/foo') assert.fail() - } catch (error) { + } catch { assert.pass() } @@ -1681,7 +1679,6 @@ tap.test('httpClient', test => { }) }, expectedError) - myServiceNameScope.done() assert.end() }) @@ -1831,7 +1828,6 @@ tap.test('httpClient', test => { assert.end() }) - test.test('tls options', async assert => { nock.enableNetConnect('localhost:3200') assert.teardown(() => { @@ -1846,16 +1842,11 @@ tap.test('httpClient', test => { const caPath = cp.execSync(`mkcert -CAROOT`).toString() .trim() - // eslint-disable-next-line no-sync const serverCa = fs.readFileSync(path.join(caPath, 'rootCA.pem')) - // eslint-disable-next-line no-sync const serverKey = fs.readFileSync('tests/fixtures/keys/key.pem') - // eslint-disable-next-line no-sync const serverCert = fs.readFileSync('tests/fixtures/keys/cert.pem') - // eslint-disable-next-line no-sync const clientKey = fs.readFileSync('tests/fixtures/keys/client-key.pem') - // eslint-disable-next-line no-sync const clientCert = fs.readFileSync('tests/fixtures/keys/client-cert.pem') async function createServer() { @@ -1903,7 +1894,6 @@ tap.test('httpClient', test => { assert.end() }) - assert.test('returnAs: BUFFER', async assert => { const server = await createServer() @@ -1935,7 +1925,6 @@ tap.test('httpClient', test => { assert.end() }) - assert.test('returnAs: STREAM', async assert => { const server = await createServer() @@ -2223,7 +2212,6 @@ tap.test('httpClient', test => { assert.equal(error.statusCode, 500) } - myServiceNameScope.done() }) @@ -2249,7 +2237,7 @@ tap.test('httpClient', test => { assert.match(afterRequest, { level: 50, msg: /^generic request error$/, - // eslint-disable-next-line id-blacklist + // eslint-disable-next-line id-denylist err: { type: 'Error', message: 'timeout of 100ms exceeded', diff --git a/tests/index.test.js b/tests/index.test.js index 18663125..fdea5639 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -18,7 +18,6 @@ const tap = require('tap') const lc39 = require('@mia-platform/lc39') - const fs = require('fs') const { promisify } = require('util') diff --git a/tests/oas.test.js b/tests/oas.test.js index 31068dfb..5300cdae 100644 --- a/tests/oas.test.js +++ b/tests/oas.test.js @@ -38,7 +38,6 @@ tap.test('create a valid docs with the support of $ref schema', async t => { t.end() }) - tap.test('create a valid docs with custom vocabulary', async t => { const fastify = await setupFastify('./tests/services/service-with-formats.js', baseEnv)