diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 2ec78ea4e..000000000 --- a/.eslintignore +++ /dev/null @@ -1,16 +0,0 @@ - -# /node_modules/* in the project root is ignored by default -# build artefacts -dist/* -coverage/* -build*/* -# data definition files -**/*.d.ts -# 3rd party libs -/src/public/ -# custom definition files -/src/types/ -# regression output -/regression/output* -# generated source code -**/generated diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 4c744688e..000000000 --- a/.eslintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "extends": [ - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "rules": { - "semi": ["error", "always"], - "quotes": ["error", "single", { "avoidEscape": true }], - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unsafe-declaration-merging": "off" - } -} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..575f4066b --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,54 @@ +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 [ + { + ignores: [ + 'dist/*', + 'coverage/*', + 'build*/*', + '**/*.d.ts', + 'src/public/', + 'src/types/', + 'regression/output*', + '**/generated' + ] + }, + ...compat.extends('plugin:@typescript-eslint/recommended', 'prettier'), + { + languageOptions: { + parser: tsParser, + ecmaVersion: 2018, + sourceType: 'module' + }, + + rules: { + semi: ['error', 'always'], + + quotes: [ + 'error', + 'single', + { + avoidEscape: true + } + ], + + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-declaration-merging': 'off' + } + } +]; diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f2a8ecfff..ba01488b0 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -36,6 +36,8 @@ "sushi": "dist/app.js" }, "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.7.0", "@types/diff": "^5.2.1", "@types/fs-extra": "^11.0.4", "@types/html-minifier-terser": "5.1.1", @@ -50,14 +52,14 @@ "@types/temp": "^0.9.4", "@types/text-table": "^0.2.5", "@types/valid-url": "^1.0.7", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", + "@typescript-eslint/eslint-plugin": "^8.0.0-alpha.51", + "@typescript-eslint/parser": "^8.0.0-alpha.51", "acorn": "^8.12.0", "copyfiles": "^2.4.1", "del-cli": "^5.1.0", "diff": "^5.2.0", "diff2html-cli": "^5.2.15", - "eslint": "^8.57.0", + "eslint": "^9.7.0", "eslint-config-prettier": "^9.1.0", "extract-zip": "^2.0.1", "jest": "^29.7.0", @@ -65,7 +67,7 @@ "json-diff": "^1.0.6", "nock": "^13.5.4", "opener": "^1.5.2", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "ts-jest": "^29.1.5", "ts-node": "^10.9.2", "typescript": "^5.4.5" @@ -705,24 +707,60 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.1.tgz", - "integrity": "sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/config-array": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", + "integrity": "sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==", + "dev": true, + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -730,7 +768,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -781,12 +819,21 @@ } }, "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.7.0.tgz", + "integrity": "sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@ewoudenberg/difflib": { @@ -798,43 +845,6 @@ "heap": ">= 0.2.0" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "deprecated": "Use @eslint/config-array instead", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -848,12 +858,18 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", - "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "deprecated": "Use @eslint/object-schema instead", - "dev": true + "node_modules/@humanwhocodes/retry": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", + "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -1653,31 +1669,31 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.13.1.tgz", - "integrity": "sha512-kZqi+WZQaZfPKnsflLJQCz6Ze9FFSMfXrrIOcyargekQxG37ES7DJNpJUE9Q/X5n3yTIP/WPutVNzgknQ7biLg==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.0-alpha.51.tgz", + "integrity": "sha512-989dk3/IA2HNdfl8T1Tj0+AEAtqHN5Cdac7Ff1N367Lh5e5xKi3nXWMkptbZaAEo/wi5+CZD8jngQ70wnCRweA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.13.1", - "@typescript-eslint/type-utils": "7.13.1", - "@typescript-eslint/utils": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1", + "@typescript-eslint/scope-manager": "8.0.0-alpha.51", + "@typescript-eslint/type-utils": "8.0.0-alpha.51", + "@typescript-eslint/utils": "8.0.0-alpha.51", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.51", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1686,26 +1702,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.13.1.tgz", - "integrity": "sha512-1ELDPlnLvDQ5ybTSrMhRTFDfOQEOXNM+eP+3HT/Yq7ruWpciQw+Avi73pdEbA4SooCawEWo3dtYbF68gN7Ed1A==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.0-alpha.51.tgz", + "integrity": "sha512-UPMhWLqkP/wBGB3/eI9fRG8UFFmT8tTLlBUQFN01xtsRNhYlMYS5FQHDMkfPynnKp62AqLRrwkrI49cZN3aDUA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.13.1", - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/typescript-estree": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1", + "@typescript-eslint/scope-manager": "8.0.0-alpha.51", + "@typescript-eslint/types": "8.0.0-alpha.51", + "@typescript-eslint/typescript-estree": "8.0.0-alpha.51", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.51", "debug": "^4.3.4" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1714,16 +1730,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.13.1.tgz", - "integrity": "sha512-adbXNVEs6GmbzaCpymHQ0MB6E4TqoiVbC0iqG3uijR8ZYfpAXMGttouQzF4Oat3P2GxDVIrg7bMI/P65LiQZdg==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.0-alpha.51.tgz", + "integrity": "sha512-zT8Ib31deJCqRVJepZOMFoHiFAsSHOh5TmedcFeqyiMuzrqBMtF95iv6mPJqFDIXNgxmTkahpRan1z043ckBnA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1" + "@typescript-eslint/types": "8.0.0-alpha.51", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.51" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -1731,26 +1747,23 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.13.1.tgz", - "integrity": "sha512-aWDbLu1s9bmgPGXSzNCxELu+0+HQOapV/y+60gPXafR8e2g1Bifxzevaa+4L2ytCWm+CHqpELq4CSoN9ELiwCg==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.0-alpha.51.tgz", + "integrity": "sha512-KqU2e3KITMGlRfG4ehfO2zS0GutDWc+zV2nwbRDQdUfh1izgFDAh5UqiJ8YafXVzY1v0dnRggnmvjOMotjQa1w==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.13.1", - "@typescript-eslint/utils": "7.13.1", + "@typescript-eslint/typescript-estree": "8.0.0-alpha.51", + "@typescript-eslint/utils": "8.0.0-alpha.51", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependencies": { - "eslint": "^8.56.0" - }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -1758,12 +1771,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.13.1.tgz", - "integrity": "sha512-7K7HMcSQIAND6RBL4kDl24sG/xKM13cA85dc7JnmQXw2cBDngg7c19B++JzvJHRG3zG36n9j1i451GBzRuHchw==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.0-alpha.51.tgz", + "integrity": "sha512-joqeu3jITe9BbgXAggKKg9mBIGDL6mAf2JVlo00zWP50u4qnsa3NWKMwWp77pjtI9E2DPU0vlTEdL+v/3aTPJA==", "dev": true, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -1771,13 +1784,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.13.1.tgz", - "integrity": "sha512-uxNr51CMV7npU1BxZzYjoVz9iyjckBduFBP0S5sLlh1tXYzHzgZ3BR9SVsNed+LmwKrmnqN3Kdl5t7eZ5TS1Yw==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.0-alpha.51.tgz", + "integrity": "sha512-p3kD3rVdqmr4Iga86xzUR5wTsIKof/GsqnUMWZbmFpD3fmMXs1VLoXJegTqVMtWncu14dZUohRV2xPSScBAnxg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1", + "@typescript-eslint/types": "8.0.0-alpha.51", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.51", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1786,7 +1799,7 @@ "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -1799,50 +1812,44 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.13.1.tgz", - "integrity": "sha512-h5MzFBD5a/Gh/fvNdp9pTfqJAbuQC4sCN2WzuXme71lqFJsZtLbjxfSk4r3p02WIArOF9N94pdsLiGutpDbrXQ==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.0-alpha.51.tgz", + "integrity": "sha512-OJac7/t6M/jQlgAQSM2yffKXZL8d/6vTbQPChC5v4oGHFuKHF2dEFeevNJlIS9iR6EtquRsHup2GDwqw6bWyrw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.13.1", - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/typescript-estree": "7.13.1" + "@typescript-eslint/scope-manager": "8.0.0-alpha.51", + "@typescript-eslint/types": "8.0.0-alpha.51", + "@typescript-eslint/typescript-estree": "8.0.0-alpha.51" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.13.1.tgz", - "integrity": "sha512-k/Bfne7lrP7hcb7m9zSsgcBmo+8eicqqfNAJ7uUY+jkTFpKeH2FSkWpFRtimBxgkyvqfu9jTPRbYOvud6isdXA==", + "version": "8.0.0-alpha.51", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.0.0-alpha.51.tgz", + "integrity": "sha512-bOLfR14nLfhO9BBD1YpmnQSTNTapAIegKsb4Ms1RAQXkJRKIeuLS42AEYRM8uvLiNLk0hDIBjCnMPTAyDAWLbw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.13.1", + "@typescript-eslint/types": "8.0.0-alpha.51", "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true - }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -3009,18 +3016,6 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dot-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", @@ -3111,41 +3106,37 @@ } }, "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.7.0.tgz", + "integrity": "sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint-community/regexpp": "^4.11.0", + "@eslint/config-array": "^0.17.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "9.7.0", "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^8.0.2", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.1.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", @@ -3159,10 +3150,10 @@ "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" } }, "node_modules/eslint-config-prettier": { @@ -3178,16 +3169,16 @@ } }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", + "integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3231,6 +3222,18 @@ "concat-map": "0.0.1" } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -3259,17 +3262,29 @@ } }, "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", "dev": true, "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3620,15 +3635,15 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/fill-range": { @@ -3660,17 +3675,16 @@ } }, "node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16" } }, "node_modules/flatted": { @@ -3888,15 +3902,12 @@ } }, "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5596,9 +5607,9 @@ } }, "node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -6163,9 +6174,9 @@ } }, "node_modules/prettier": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", - "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -7253,18 +7264,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "5.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", diff --git a/package.json b/package.json index 159a57349..05e21706f 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,8 @@ ], "license": "Apache-2.0", "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.7.0", "@types/diff": "^5.2.1", "@types/fs-extra": "^11.0.4", "@types/html-minifier-terser": "5.1.1", @@ -65,14 +67,14 @@ "@types/temp": "^0.9.4", "@types/text-table": "^0.2.5", "@types/valid-url": "^1.0.7", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", + "@typescript-eslint/eslint-plugin": "^8.0.0-alpha.51", + "@typescript-eslint/parser": "^8.0.0-alpha.51", "acorn": "^8.12.0", "copyfiles": "^2.4.1", "del-cli": "^5.1.0", "diff": "^5.2.0", "diff2html-cli": "^5.2.15", - "eslint": "^8.57.0", + "eslint": "^9.7.0", "eslint-config-prettier": "^9.1.0", "extract-zip": "^2.0.1", "jest": "^29.7.0", @@ -80,7 +82,7 @@ "json-diff": "^1.0.6", "nock": "^13.5.4", "opener": "^1.5.2", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "ts-jest": "^29.1.5", "ts-node": "^10.9.2", "typescript": "^5.4.5" diff --git a/regression/cli.ts b/regression/cli.ts index 21d96c392..f679ba160 100644 --- a/regression/cli.ts +++ b/regression/cli.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ import path from 'path'; import fs from 'fs-extra'; import readlineSync from 'readline-sync'; diff --git a/regression/find.ts b/regression/find.ts index 086c5a8b7..06c6f536f 100644 --- a/regression/find.ts +++ b/regression/find.ts @@ -198,7 +198,7 @@ async function guessDefaultBranch( if (res.status === 200) { return branch; } - } catch (e) { + } catch { // The branch does not exist. Continue. } } @@ -215,7 +215,7 @@ async function getReposWithFSHFolder(repos: GHRepo[]): Promise { await axios.head(`${repo.html_url}/tree/${repo.default_branch}/${fshyPath}`); fshRepos.push(repo); break; - } catch (e) { + } catch { // 404: fshy path not found } } diff --git a/src/fhirtypes/ElementDefinition.ts b/src/fhirtypes/ElementDefinition.ts index ec1bfdeb8..8f75c8434 100644 --- a/src/fhirtypes/ElementDefinition.ts +++ b/src/fhirtypes/ElementDefinition.ts @@ -79,7 +79,8 @@ import { } from '../utils'; import { InstanceDefinition } from './InstanceDefinition'; import { idRegex } from './primitiveTypes'; -import sax = require('sax'); +import sax from 'sax'; + const PROFILE_ELEMENT_EXTENSION = 'http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element'; @@ -1576,7 +1577,7 @@ export class ElementDefinition { try { match = this.findTypeMatch({ type: typeToTry }, rightTypes, fisher); matches.push(match); - } catch (ex) { + } catch { // it's okay if a given type doesn't have any matches. } }); @@ -1788,7 +1789,7 @@ export class ElementDefinition { if (vsURI == ce.binding?.valueSet) { try { ce.bindToVS(vsURI, strength, null, fisher); - } catch (ex) { + } catch { // receiving a BindingStrengthError on a slice is not a problem, because // it is fine if the slice has a stronger binding than the list element. } @@ -2092,7 +2093,7 @@ export class ElementDefinition { try { this.checkAssignedValueAgainstChild(slice, fhirValue); this.checkAssignedValueAgainstChildren(slice, fhirValue); - } catch (e) { + } catch { numInvalid += 1; } }); @@ -2321,7 +2322,7 @@ export class ElementDefinition { } } return sax.parser(true).write(value).error == null; - } catch (ex) { + } catch { return false; } } diff --git a/src/fhirtypes/InstanceDefinition.ts b/src/fhirtypes/InstanceDefinition.ts index 70f3a1c2d..97eb1e85c 100644 --- a/src/fhirtypes/InstanceDefinition.ts +++ b/src/fhirtypes/InstanceDefinition.ts @@ -63,6 +63,6 @@ type InstanceMeta = { instanceOfUrl?: string; }; -// eslint-disable-next-line @typescript-eslint/no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface InstanceDefinition extends HasId {} applyMixins(InstanceDefinition, [HasId]); diff --git a/src/import/importConfiguration.ts b/src/import/importConfiguration.ts index e6da2cd03..0db2e8d4d 100644 --- a/src/import/importConfiguration.ts +++ b/src/import/importConfiguration.ts @@ -139,7 +139,7 @@ export function importConfiguration(yaml: YAMLConfiguration | string, file: stri title: yaml.title, // Default status to 'draft' on FSHOnly IGs so exported resources inherit the property status: parseCodeWithRequiredValues( - yaml.FSHOnly ? yaml.status ?? 'draft' : required(yaml.status, 'status', file) ?? 'draft', + yaml.FSHOnly ? (yaml.status ?? 'draft') : (required(yaml.status, 'status', file) ?? 'draft'), ['draft', 'active', 'retired', 'unknown'], 'status', file @@ -742,10 +742,10 @@ function parseParameters( const parameters: ImplementationGuideDefinitionParameter[] = []; // copyrightYear and releaseLabel are only required when generating an IG const copyrightYear = FSHOnly - ? yamlConfig.copyrightYear ?? yamlConfig.copyrightyear + ? (yamlConfig.copyrightYear ?? yamlConfig.copyrightyear) : required(yamlConfig.copyrightYear ?? yamlConfig.copyrightyear, 'copyrightYear', file); const releaseLabel = FSHOnly - ? yamlConfig.releaseLabel ?? yamlConfig.releaselabel + ? (yamlConfig.releaseLabel ?? yamlConfig.releaselabel) : required(yamlConfig.releaseLabel ?? yamlConfig.releaselabel, 'releaseLabel', file); if (copyrightYear) { parameters.push({ diff --git a/src/utils/Processing.ts b/src/utils/Processing.ts index 353dd38ab..23cdbc274 100644 --- a/src/utils/Processing.ts +++ b/src/utils/Processing.ts @@ -104,7 +104,7 @@ export function hasFshFiles(path: string): boolean { fs.statSync(path); const files = getFilesRecursive(path).filter(file => file.endsWith('.fsh')); return files.length > 0; - } catch (error) { + } catch { return false; } } @@ -264,7 +264,7 @@ export async function updateExternalDependencies(config: Configuration): Promise try { res = await axiosGet(`${process.env.FPL_REGISTRY}/${dep.packageId}`); latestVersion = res?.data?.['dist-tags']?.latest; - } catch (e) { + } catch { logger.warn( `Could not get version info for package ${dep.packageId} from custom FHIR package registry ${process.env.FPL_REGISTRY}.` ); @@ -274,11 +274,11 @@ export async function updateExternalDependencies(config: Configuration): Promise try { res = await axiosGet(`https://packages.fhir.org/${dep.packageId}`); latestVersion = res?.data?.['dist-tags']?.latest; - } catch (e) { + } catch { try { res = await axiosGet(`https://packages2.fhir.org/packages/${dep.packageId}`); latestVersion = res?.data?.['dist-tags']?.latest; - } catch (e) { + } catch { logger.warn(`Could not get version info for package ${dep.packageId}`); return; } @@ -484,7 +484,7 @@ export function fillTank(rawFSHes: RawFSH[], config: Configuration): FSHTank { } export function checkNullValuesOnArray(resource: any, parentName = '', priorPath = ''): void { - const resourceName = parentName ? parentName : resource.id ?? resource.name; + const resourceName = parentName ? parentName : (resource.id ?? resource.name); for (const propertyKey in resource) { const property = resource[propertyKey]; const currentPath = !priorPath ? propertyKey : priorPath.concat(`.${propertyKey}`); diff --git a/test/export/InstanceExporter.test.ts b/test/export/InstanceExporter.test.ts index 67f2b0a61..2ff78d280 100644 --- a/test/export/InstanceExporter.test.ts +++ b/test/export/InstanceExporter.test.ts @@ -785,7 +785,7 @@ describe('InstanceExporter', () => { patientInstance.usage = 'Definition'; const exported = exportInstance(patientInstance); - expect(exported.url).toBeUndefined; + expect(exported.url).toBeUndefined(); }); it('should set an extension on meta.profile when no rules set values on meta.profile', () => { diff --git a/test/fhirtypes/ElementDefinition.assignFshQuantity.test.ts b/test/fhirtypes/ElementDefinition.assignFshQuantity.test.ts index bc501dd42..933c02ccd 100644 --- a/test/fhirtypes/ElementDefinition.assignFshQuantity.test.ts +++ b/test/fhirtypes/ElementDefinition.assignFshQuantity.test.ts @@ -244,13 +244,11 @@ describe('ElementDefinition', () => { // with units expect(() => { status.assignValue(fshQuantity2); - // eslint-disable-next-line }).toThrow( "Cannot assign Quantity value: 1.24 'mm'. Value does not match element type: code" ); expect(() => { status.assignValue(fshQuantity2, true); - // eslint-disable-next-line }).toThrow( "Cannot assign Quantity value: 1.24 'mm'. Value does not match element type: code" ); diff --git a/test/fhirtypes/ElementDefinition.assignFshRatio.test.ts b/test/fhirtypes/ElementDefinition.assignFshRatio.test.ts index ceaa28d79..97fbcad81 100644 --- a/test/fhirtypes/ElementDefinition.assignFshRatio.test.ts +++ b/test/fhirtypes/ElementDefinition.assignFshRatio.test.ts @@ -200,13 +200,11 @@ describe('ElementDefinition', () => { expect(() => { status.assignValue(fshRatio); }).toThrow( - // eslint-disable-next-line "Cannot assign Ratio value: 1.2 'mm' : 3.4 'cm'. Value does not match element type: code" ); expect(() => { status.assignValue(fshRatio, true); }).toThrow( - // eslint-disable-next-line "Cannot assign Ratio value: 1.2 'mm' : 3.4 'cm'. Value does not match element type: code" ); // without units diff --git a/test/fhirtypes/ElementDefinition.assignString.test.ts b/test/fhirtypes/ElementDefinition.assignString.test.ts index 262555d04..003a4d6da 100644 --- a/test/fhirtypes/ElementDefinition.assignString.test.ts +++ b/test/fhirtypes/ElementDefinition.assignString.test.ts @@ -1189,7 +1189,7 @@ describe('ElementDefinition', () => { const narrativeDiv = patient.findElementByPath('text.div', fisher); try { narrativeDiv.assignValue('Twas brillig'); - } catch (error) { + } catch { didThrow = true; expect(loggerSpy.getLastMessage('warn')).toMatch( 'xhtml div elements should start and end with
tags for Patient.text.div' diff --git a/test/ig/IGExporter.IG.test.ts b/test/ig/IGExporter.IG.test.ts index a4c47cc59..b1f83ca1d 100644 --- a/test/ig/IGExporter.IG.test.ts +++ b/test/ig/IGExporter.IG.test.ts @@ -2025,7 +2025,6 @@ describe('IGExporter', () => { reference: { reference: 'ValueSet/MyVS' }, - // eslint-disable-next-line name: "Yes/No/Don't Know", // Use name over ID exampleBoolean: false }); diff --git a/test/import/FSHTank.test.ts b/test/import/FSHTank.test.ts index 40b12a171..43f9100f0 100644 --- a/test/import/FSHTank.test.ts +++ b/test/import/FSHTank.test.ts @@ -1023,7 +1023,7 @@ describe('FSHTank', () => { profile.id = 'ip4'; profile.parent = 'Patient'; addNamedImposeProfileExtension(profile, 'http://example.org/imposedProfileA', 0, '$IMPOSE'); - addNamedImposeProfileExtension(profile, 'http://example.org/imposedProfileB', 1), '$IMPOSE'; + addNamedImposeProfileExtension(profile, 'http://example.org/imposedProfileB', 1, '$IMPOSE'); const doc4 = new FSHDocument('doc4.fsh'); doc4.aliases.set( '$IMPOSE', diff --git a/test/utils/PathUtils.test.ts b/test/utils/PathUtils.test.ts index 5f89347b2..bc8225024 100644 --- a/test/utils/PathUtils.test.ts +++ b/test/utils/PathUtils.test.ts @@ -3,9 +3,13 @@ import { readJSONSync } from 'fs-extra'; import { InstanceDefinition } from '../../src/fhirtypes'; import { CaretValueRule, Rule, AssignmentRule } from '../../src/fshtypes/rules'; import { resolveSoftIndexing, parseFSHPath, collectValuesAtElementIdOrPath } from '../../src/utils'; -import '../testhelpers/loggerSpy'; // side-effect: suppresses logs +import { loggerSpy } from '../testhelpers/loggerSpy'; describe('PathUtils', () => { + beforeEach(() => { + loggerSpy.reset(); + }); + describe('#resolveSoftIndexing', () => { it('should resolve simple (non-nested) soft indexing', () => { const rules = ['name[+]', 'name[=]', 'name[=]', 'name[+]', 'name[=]'].map(r => new Rule(r)); @@ -136,11 +140,8 @@ describe('PathUtils', () => { ]); }); - it('should resolve improper soft indexing, but throw an error', () => { + it('should resolve improper soft indexing, but log an error', () => { const rules = ['name[=]', 'name[=]', 'name[=]', 'name[+]', 'name[=]'].map(r => new Rule(r)); - expect(() => { - resolveSoftIndexing(rules); - }).toThrowError; resolveSoftIndexing(rules); expect(rules.map(r => r.path)).toEqual([ 'name[0]', @@ -149,6 +150,9 @@ describe('PathUtils', () => { 'name[1]', 'name[1]' ]); + expect(loggerSpy.getLastMessage('error')).toMatch( + 'The first index in a Soft Indexing sequence must be "+", an actual index of "0" has been assumed' + ); }); it('should resolve soft indexing beginning with a non-zero index', () => { diff --git a/test/utils/Processing.test.ts b/test/utils/Processing.test.ts index a5461f4a9..9c4553b62 100644 --- a/test/utils/Processing.test.ts +++ b/test/utils/Processing.test.ts @@ -2773,7 +2773,7 @@ describe('Processing', () => { mockedAxios.get.mockImplementationOnce(() => Promise.resolve(data)); const version = await getLatestSushiVersion(); - expect(version).toBeUndefined; + expect(version).toBeUndefined(); // Loosely match message since it differs slightly between npm 6 and npm 8 expect(loggerSpy.getLastMessage('warn')).toMatch( /Unable to determine the latest version of sushi: Cannot read .*'dist-tags'.*/