From def67d1a36c18df3fa19f5f894efe93d9ee3b5c8 Mon Sep 17 00:00:00 2001 From: John Gee Date: Tue, 19 Dec 2023 22:34:39 +1300 Subject: [PATCH 01/26] Separate into ESLint and Prettier, starting with JavaScript --- .eslintrc.js | 67 - .prettierignore | 6 + .prettierrc.js | 5 + eslint.config.js | 44 + package-lock.json | 1526 ++--------------- package.json | 15 +- tests/command.asterisk.test.js | 4 +- tests/command.configureOutput.test.js | 6 +- tests/command.positionalOptions.test.js | 9 +- tests/command.showHelpAfterError.test.js | 3 +- .../command.showSuggestionAfterError.test.js | 3 +- tests/help.suggestion.test.js | 3 +- 12 files changed, 195 insertions(+), 1496 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 .prettierignore create mode 100644 .prettierrc.js create mode 100644 eslint.config.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 07d28ed76..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,67 +0,0 @@ -const javascriptSettings = { - files: ['*.js', '*.mjs'], - extends: [ - 'standard', - 'plugin:jest/recommended' - ], - rules: { - 'no-else-return': ['error', { allowElseIf: false }], - 'space-before-function-paren': ['error', 'never'], - // manual "semistandard" settings - semi: ['error', 'always'], - 'no-extra-semi': 'error' - } -}; - -const typescriptSettings = { - files: ['*.ts', '*.mts'], - parserOptions: { - project: './tsconfig.ts.json' - }, - plugins: [ - '@typescript-eslint' - ], - extends: [ - 'standard-with-typescript' - ], - rules: { - 'no-else-return': ['error', { allowElseIf: false }], - 'space-before-function-paren': 'off', - '@typescript-eslint/space-before-function-paren': ['error', 'never'], - '@typescript-eslint/member-delimiter-style': [ - 'error', - { - multiline: { - delimiter: 'semi', - requireLast: true - }, - singleline: { - delimiter: 'semi', - requireLast: false - } - } - ], - // manual "semistandard" settings - semi: 'off', - '@typescript-eslint/semi': ['error', 'always'], - 'no-extra-semi': 'off', - '@typescript-eslint/no-extra-semi': ['error'] - } -}; - -module.exports = { - plugins: ['jest'], - parserOptions: { - ecmaVersion: 8 - }, - overrides: [ - javascriptSettings, - typescriptSettings, - { - files: ['*.mjs'], - parserOptions: { - sourceType: 'module' - } - } - ] -}; diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..9b59be7d8 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# opt-in, so exclude everything +**.* +# add back the filetypes we want to format +!**.js +!**.mjs +!**.cjs diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000..6da7e5777 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,5 @@ +const config = { + singleQuote: true, +}; + +module.exports = config; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..ec68c166e --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,44 @@ +const globals = require("globals"); +const esLintjs = require("@eslint/js"); +const jest = require("eslint-plugin-jest"); +const prettier = require("eslint-config-prettier"); + +// Jest is in process of updating for flat config support, so mixture of approaches. +// https://github.com/jest-community/eslint-plugin-jest/issues/1408 + +module.exports = [ + esLintjs.configs.recommended, + prettier, + { + files: ["**/*.js", "**/*.mjs", "*.cjs", "**/*.ts", "**/*.mts", "*.cts"], + rules: { + "no-unused-vars": "off", // lots in tests, minimise churn to start with + 'no-else-return': ['error', { allowElseIf: false }], + }, + languageOptions: { + globals: { + ...globals.node, + } + } + }, + { + files: ["**/*.test.js"], + plugins: { + jest: jest + }, + rules: { + ...jest.configs.recommended.rules, + }, + languageOptions: { + globals: { + ...globals.jest + } + } + }, + { + files: ["**/*.js"], + languageOptions: { + sourceType: "commonjs" + } + } +]; diff --git a/package-lock.json b/package-lock.json index a29166316..c511a3671 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,19 +8,20 @@ "name": "commander", "version": "12.0.0-0", "license": "MIT", + "dependencies": { + "@eslint/js": "^8.56.0", + "globals": "^13.24.0" + }, "devDependencies": { "@types/jest": "^29.2.4", "@types/node": "^20.2.5", - "@typescript-eslint/eslint-plugin": "^6.7.5", - "@typescript-eslint/parser": "^6.7.5", + "@typescript-eslint/eslint-plugin": "^6.14.0", + "@typescript-eslint/parser": "^6.14.0", "eslint": "^8.30.0", - "eslint-config-standard": "^17.0.0", - "eslint-config-standard-with-typescript": "^39.1.1", - "eslint-plugin-import": "^2.26.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", - "eslint-plugin-n": "^16.2.0", - "eslint-plugin-promise": "^6.1.1", "jest": "^29.3.1", + "prettier": "^3.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", "typescript": "^5.0.4" @@ -725,9 +726,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -748,10 +749,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", - "dev": true, + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -1332,16 +1332,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/eslint": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", - "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", - "dev": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.2.tgz", @@ -1397,12 +1387,6 @@ "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", "dev": true }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true - }, "node_modules/@types/minimist": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.3.tgz", @@ -1452,16 +1436,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", - "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.14.0.tgz", + "integrity": "sha512-1ZJBykBCXaSHG94vMMKmiHoL0MhNHKSVlcHVYZNw+BKxufhqQVTOawNpwwI1P5nIFZ/4jLVop0mcY6mJJDFNaw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/type-utils": "6.9.0", - "@typescript-eslint/utils": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.14.0", + "@typescript-eslint/type-utils": "6.14.0", + "@typescript-eslint/utils": "6.14.0", + "@typescript-eslint/visitor-keys": "6.14.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1487,15 +1471,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", - "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.14.0.tgz", + "integrity": "sha512-QjToC14CKacd4Pa7JK4GeB/vHmWFJckec49FR4hmIRf97+KXole0T97xxu9IFiPxVQ1DBWrQ5wreLwAGwWAVQA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.14.0", + "@typescript-eslint/types": "6.14.0", + "@typescript-eslint/typescript-estree": "6.14.0", + "@typescript-eslint/visitor-keys": "6.14.0", "debug": "^4.3.4" }, "engines": { @@ -1514,88 +1498,14 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", - "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", - "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", - "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", - "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.9.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", - "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.14.0.tgz", + "integrity": "sha512-VT7CFWHbZipPncAZtuALr9y3EuzY1b1t1AEkIq2bTXUPKw+pHoXflGNG5L+Gv6nKul1cz1VH8fz16IThIU0tdg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0" + "@typescript-eslint/types": "6.14.0", + "@typescript-eslint/visitor-keys": "6.14.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1606,13 +1516,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", - "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.14.0.tgz", + "integrity": "sha512-x6OC9Q7HfYKqjnuNu5a7kffIYs3No30isapRBJl1iCHLitD8O0lFbRcVGiOcuyN837fqXzPZ1NS10maQzZMKqw==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/typescript-estree": "6.14.0", + "@typescript-eslint/utils": "6.14.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1633,9 +1543,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", - "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.14.0.tgz", + "integrity": "sha512-uty9H2K4Xs8E47z3SnXEPRNDfsis8JO27amp2GNCnzGETEW3yTqEIVg5+AI7U276oGF/tw6ZA+UesxeQ104ceA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1646,13 +1556,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", - "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.14.0.tgz", + "integrity": "sha512-yPkaLwK0yH2mZKFE/bXkPAkkFgOv15GJAUzgUVonAbv0Hr4PK/N2yaA/4XQbTZQdygiDkpt5DkxPELqHguNvyw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/types": "6.14.0", + "@typescript-eslint/visitor-keys": "6.14.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1673,17 +1583,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", - "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.14.0.tgz", + "integrity": "sha512-XwRTnbvRr7Ey9a1NT6jqdKX8y/atWG+8fAIu3z73HSP8h06i3r/ClMhmaF/RGWGW1tHJEwij1uEg2GbEmPYvYg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/scope-manager": "6.14.0", + "@typescript-eslint/types": "6.14.0", + "@typescript-eslint/typescript-estree": "6.14.0", "semver": "^7.5.4" }, "engines": { @@ -1698,12 +1608,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", - "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.14.0.tgz", + "integrity": "sha512-fB5cw6GRhJUz03MrROVuj5Zm/Q+XWlVdIsFj+Zb1Hvqouc8t+XP2H5y53QYU/MGtd2dPg6/vJJlhoX3xc2ehfw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/types": "6.14.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1721,9 +1631,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1827,38 +1737,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/array-buffer-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", - "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "is-array-buffer": "^3.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -1868,82 +1746,6 @@ "node": ">=8" } }, - "node_modules/array.prototype.findlastindex": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", - "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flat": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", - "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", - "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-array-buffer": "^3.0.2", - "is-shared-array-buffer": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -1953,18 +1755,6 @@ "node": ">=0.10.0" } }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -2168,28 +1958,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dev": true, - "dependencies": { - "semver": "^7.0.0" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2466,37 +2234,6 @@ "node": ">=0.10.0" } }, - "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dev": true, - "dependencies": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2572,99 +2309,6 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-abstract": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", - "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "arraybuffer.prototype.slice": "^1.0.2", - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-set-tostringtag": "^2.0.1", - "es-to-primitive": "^1.2.1", - "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.1", - "get-symbol-description": "^1.0.0", - "globalthis": "^1.0.3", - "gopd": "^1.0.1", - "has": "^1.0.3", - "has-property-descriptors": "^1.0.0", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.5", - "is-array-buffer": "^3.0.2", - "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "is-string": "^1.0.7", - "is-typed-array": "^1.1.12", - "is-weakref": "^1.0.2", - "object-inspect": "^1.12.3", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.5.1", - "safe-array-concat": "^1.0.1", - "safe-regex-test": "^1.0.0", - "string.prototype.trim": "^1.2.8", - "string.prototype.trimend": "^1.0.7", - "string.prototype.trimstart": "^1.0.7", - "typed-array-buffer": "^1.0.0", - "typed-array-byte-length": "^1.0.0", - "typed-array-byte-offset": "^1.0.0", - "typed-array-length": "^1.0.4", - "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.11" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-set-tostringtag": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", - "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.3", - "has": "^1.0.3", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-shim-unscopables": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", - "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -2687,15 +2331,15 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -2741,51 +2385,16 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-config-standard": { - "version": "17.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.1.0.tgz", - "integrity": "sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "eslint": "^8.0.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", - "eslint-plugin-promise": "^6.0.0" - } - }, - "node_modules/eslint-config-standard-with-typescript": { - "version": "39.1.1", - "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-39.1.1.tgz", - "integrity": "sha512-t6B5Ep8E4I18uuoYeYxINyqcXb2UbC0SOOTxRtBSt2JUs+EzeXbfe2oaiPs71AIdnoWhXDO2fYOHz8df3kV84A==", + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, - "dependencies": { - "@typescript-eslint/parser": "^6.4.0", - "eslint-config-standard": "17.1.0" + "bin": { + "eslint-config-prettier": "bin/cli.js" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^6.4.0", - "eslint": "^8.0.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", - "eslint-plugin-promise": "^6.0.0", - "typescript": "*" + "eslint": ">=7.0.0" } }, "node_modules/eslint-formatter-pretty": { @@ -2810,153 +2419,37 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", - "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", - "dev": true, - "dependencies": { - "debug": "^3.2.7", - "is-core-module": "^2.13.0", - "resolve": "^1.22.4" - } - }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/eslint-formatter-pretty/node_modules/@types/eslint": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", + "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "@types/estree": "*", + "@types/json-schema": "*" } }, - "node_modules/eslint-module-utils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", - "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "node_modules/eslint-plugin-jest": { + "version": "27.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", + "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", "dev": true, "dependencies": { - "debug": "^3.2.7" + "@typescript-eslint/utils": "^5.10.0" }, "engines": { - "node": ">=4" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", + "eslint": "^7.0.0 || ^8.0.0", + "jest": "*" }, "peerDependenciesMeta": { - "eslint": { - "optional": true - } - } - }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-es-x": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz", - "integrity": "sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.1.2", - "@eslint-community/regexpp": "^4.6.0" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ota-meshi" - }, - "peerDependencies": { - "eslint": ">=8" - } - }, - "node_modules/eslint-plugin-import": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", - "integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", - "debug": "^3.2.7", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", - "semver": "^6.3.1", - "tsconfig-paths": "^3.14.2" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" - } - }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eslint-plugin-import/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/eslint-plugin-jest": { - "version": "27.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", - "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", - "dev": true, - "dependencies": { - "@typescript-eslint/utils": "^5.10.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", - "eslint": "^7.0.0 || ^8.0.0", - "jest": "*" - }, - "peerDependenciesMeta": { - "@typescript-eslint/eslint-plugin": { - "optional": true - }, - "jest": { + "@typescript-eslint/eslint-plugin": { + "optional": true + }, + "jest": { "optional": true } } @@ -3083,44 +2576,6 @@ "node": ">=4.0" } }, - "node_modules/eslint-plugin-n": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.2.0.tgz", - "integrity": "sha512-AQER2jEyQOt1LG6JkGJCCIFotzmlcCZFur2wdKrp1JX2cNotC7Ae0BcD/4lLv3lUAArM9uNS8z/fsvXTd0L71g==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "builtins": "^5.0.1", - "eslint-plugin-es-x": "^7.1.0", - "get-tsconfig": "^4.7.0", - "ignore": "^5.2.4", - "is-core-module": "^2.12.1", - "minimatch": "^3.1.2", - "resolve": "^1.22.2", - "semver": "^7.5.3" - }, - "engines": { - "node": ">=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-promise": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", - "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - } - }, "node_modules/eslint-rule-docs": { "version": "1.1.235", "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", @@ -3399,15 +2854,6 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.3" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3437,33 +2883,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/function.prototype.name": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", - "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "functions-have-names": "^1.2.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3482,21 +2901,6 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -3518,34 +2922,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-tsconfig": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", - "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", - "dev": true, - "dependencies": { - "resolve-pkg-maps": "^1.0.0" - }, - "funding": { - "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3579,10 +2955,9 @@ } }, "node_modules/globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", - "dev": true, + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dependencies": { "type-fest": "^0.20.2" }, @@ -3593,21 +2968,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globalthis": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", - "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", - "dev": true, - "dependencies": { - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -3628,18 +2988,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -3661,24 +3009,6 @@ "node": ">=6" } }, - "node_modules/has": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", - "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", - "dev": true, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3688,57 +3018,6 @@ "node": ">=8" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", @@ -3874,20 +3153,6 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "node_modules/internal-slot": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", - "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/irregular-plurals": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz", @@ -3897,66 +3162,12 @@ "node": ">=8" } }, - "node_modules/is-array-buffer": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", - "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.0", - "is-typed-array": "^1.1.10" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-core-module": { "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", @@ -3969,21 +3180,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -4023,18 +3219,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4044,21 +3228,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -4068,98 +3237,25 @@ "node": ">=8" } }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/is-typed-array": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", - "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, - "dependencies": { - "which-typed-array": "^1.1.11" - }, "engines": { - "node": ">= 0.4" + "node": ">=8" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-unicode-supported": { @@ -4174,24 +3270,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -5139,15 +4217,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", @@ -5222,88 +4291,6 @@ "node": ">=8" } }, - "node_modules/object-inspect": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.0.tgz", - "integrity": "sha512-HQ4J+ic8hKrgIt3mqk6cVOVrW2ozL4KdvHlqpBv9vDYWx9ysAgENAdvy4FoGF+KFdhR7nQTNm5J0ctAeOwn+3g==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.groupby": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", - "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1" - } - }, - "node_modules/object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5571,6 +4558,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -5611,9 +4613,9 @@ } }, "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "engines": { "node": ">=6" @@ -5812,23 +4814,6 @@ "node": ">=8" } }, - "node_modules/regexp.prototype.flags": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", - "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "set-function-name": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -5885,15 +4870,6 @@ "node": ">=4" } }, - "node_modules/resolve-pkg-maps": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", - "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, - "funding": { - "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" - } - }, "node_modules/resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -5951,38 +4927,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/safe-array-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", - "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", - "has-symbols": "^1.0.3", - "isarray": "^2.0.5" - }, - "engines": { - "node": ">=0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "is-regex": "^1.1.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -6016,20 +4960,6 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/set-function-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", - "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", - "dev": true, - "dependencies": { - "define-data-property": "^1.0.1", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6051,20 +4981,6 @@ "node": ">=8" } }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -6191,51 +5107,6 @@ "node": ">=8" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", - "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", - "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", - "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -6438,39 +5309,6 @@ } } }, - "node_modules/tsconfig-paths": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", - "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", - "dev": true, - "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - } - }, - "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, - "node_modules/tsconfig-paths/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/tsd": { "version": "0.29.0", "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.29.0.tgz", @@ -6538,7 +5376,6 @@ "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" }, @@ -6546,71 +5383,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typed-array-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", - "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/typed-array-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", - "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/typed-array-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", - "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/typed-array-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", - "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "is-typed-array": "^1.1.9" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/typescript": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", @@ -6624,21 +5396,6 @@ "node": ">=14.17" } }, - "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -6732,41 +5489,6 @@ "node": ">= 8" } }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/which-typed-array": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", - "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index f60bd9546..7279ce622 100644 --- a/package.json +++ b/package.json @@ -58,19 +58,18 @@ "devDependencies": { "@types/jest": "^29.2.4", "@types/node": "^20.2.5", - "@typescript-eslint/eslint-plugin": "^6.7.5", - "@typescript-eslint/parser": "^6.7.5", + "@typescript-eslint/eslint-plugin": "^6.14.0", + "@typescript-eslint/parser": "^6.14.0", "eslint": "^8.30.0", - "eslint-config-standard": "^17.0.0", - "eslint-config-standard-with-typescript": "^39.1.1", - "eslint-plugin-import": "^2.26.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", - "eslint-plugin-n": "^16.2.0", - "eslint-plugin-promise": "^6.1.1", "jest": "^29.3.1", + "prettier": "^3.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "@eslint/js": "^8.56.0", + "globals": "^13.24.0" }, "types": "typings/index.d.ts", "engines": { diff --git a/tests/command.asterisk.test.js b/tests/command.asterisk.test.js index 2afcb8a81..2e2b34005 100644 --- a/tests/command.asterisk.test.js +++ b/tests/command.asterisk.test.js @@ -21,9 +21,7 @@ describe(".command('*')", () => { .action(mockAction); try { program.parse(['node', 'test']); - } catch (err) { - - } + } catch (err) { /* empty */ } expect(mockAction).not.toHaveBeenCalled(); writeMock.mockRestore(); }); diff --git a/tests/command.configureOutput.test.js b/tests/command.configureOutput.test.js index 77b9c73a4..c0acba3e3 100644 --- a/tests/command.configureOutput.test.js +++ b/tests/command.configureOutput.test.js @@ -7,8 +7,7 @@ test('when default writeErr() then error on stderr', () => { try { program.parse(['--unknown'], { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } expect(writeSpy).toHaveBeenCalledTimes(1); writeSpy.mockRestore(); @@ -24,8 +23,7 @@ test('when custom writeErr() then error on custom output', () => { try { program.parse(['--unknown'], { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } expect(writeSpy).toHaveBeenCalledTimes(0); expect(customWrite).toHaveBeenCalledTimes(1); diff --git a/tests/command.positionalOptions.test.js b/tests/command.positionalOptions.test.js index 82011e136..0dd1adc6d 100644 --- a/tests/command.positionalOptions.test.js +++ b/tests/command.positionalOptions.test.js @@ -50,8 +50,7 @@ describe('program with passThrough', () => { .configureHelp({ formatHelp: mockHelp }); try { program.parse(['--help'], { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } expect(mockHelp).toHaveBeenCalled(); }); @@ -135,8 +134,7 @@ describe('program with positionalOptions and subcommand', () => { try { program.parse(userArgs, { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } expect(mockProgramHelp).toHaveBeenCalledTimes(expectProgramHelpCount); expect(mockSubHelp).toHaveBeenCalledTimes(expectSubHelpCount); }); @@ -203,8 +201,7 @@ describe('program with positionalOptions and default subcommand (called sub)', ( try { program.parse(userArgs, { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } expect(mockProgramHelp).toHaveBeenCalledTimes(expectProgramHelpCount); expect(mockSubHelp).toHaveBeenCalledTimes(expectSubHelpCount); }); diff --git a/tests/command.showHelpAfterError.test.js b/tests/command.showHelpAfterError.test.js index 98ad04426..b032194b3 100644 --- a/tests/command.showHelpAfterError.test.js +++ b/tests/command.showHelpAfterError.test.js @@ -116,7 +116,6 @@ test('when showHelpAfterError() and error and then shows full help', () => { try { program.parse(['--unknown-option'], { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } expect(writeMock).toHaveBeenLastCalledWith(program.helpInformation()); }); diff --git a/tests/command.showSuggestionAfterError.test.js b/tests/command.showSuggestionAfterError.test.js index db66dbc95..e5366fd2b 100644 --- a/tests/command.showSuggestionAfterError.test.js +++ b/tests/command.showSuggestionAfterError.test.js @@ -10,8 +10,7 @@ function getSuggestion(program, arg) { try { program.parse([arg], { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } const match = message.match(/Did you mean (one of )?(.*)\?/); return match ? match[2] : null; diff --git a/tests/help.suggestion.test.js b/tests/help.suggestion.test.js index dec6a0477..e88e74f84 100644 --- a/tests/help.suggestion.test.js +++ b/tests/help.suggestion.test.js @@ -19,8 +19,7 @@ function getSuggestion(program, arg) { // Passing in an array for a few of the tests. const args = Array.isArray(arg) ? arg : [arg]; program.parse(args, { from: 'user' }); - } catch (err) { - } + } catch (err) { /* empty */ } const match = message.match(/Did you mean (one of )?(.*)\?/); return match ? match[2] : null; From 6cf56ec2cffcf704385072f6461267175c783fae Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 20 Dec 2023 00:02:48 +1300 Subject: [PATCH 02/26] Add TypeScript back into linting --- .prettierignore | 5 ++--- eslint.config.js | 29 +++++++++++++++++++++-------- package-lock.json | 10 ++++++---- package.json | 7 ++++--- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.prettierignore b/.prettierignore index 9b59be7d8..4bd70c2a5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,5 @@ # opt-in, so exclude everything **.* # add back the filetypes we want to format -!**.js -!**.mjs -!**.cjs +!**.{js,mjs,cjs} +!**.{ts,mts,cts} diff --git a/eslint.config.js b/eslint.config.js index ec68c166e..472832d22 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,15 +2,20 @@ const globals = require("globals"); const esLintjs = require("@eslint/js"); const jest = require("eslint-plugin-jest"); const prettier = require("eslint-config-prettier"); +const { FlatCompat } = require("@eslint/eslintrc"); // For reading original (non-flat) configs into flat format. // Jest is in process of updating for flat config support, so mixture of approaches. // https://github.com/jest-community/eslint-plugin-jest/issues/1408 +// Likewise with TypeScript, recommended approach is compatibility layer for now. +// https://github.com/typescript-eslint/typescript-eslint/issues/7694 + +const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname }); + module.exports = [ esLintjs.configs.recommended, - prettier, { - files: ["**/*.js", "**/*.mjs", "*.cjs", "**/*.ts", "**/*.mts", "*.cts"], + files: ["**/*.{js,mjs,cjs}", "**/*.{ts,mts,cts}"], rules: { "no-unused-vars": "off", // lots in tests, minimise churn to start with 'no-else-return': ['error', { allowElseIf: false }], @@ -21,6 +26,19 @@ module.exports = [ } } }, + // Hack, restricting TypeScript config to TypeScript files. + ...compat.extends( + 'plugin:@typescript-eslint/recommended', + ).map(c => ({ + ...c, + files: ["**/*.{ts,mts,cts}"], + })), + { + files: ["**/*.js"], + languageOptions: { + sourceType: "commonjs" + } + }, { files: ["**/*.test.js"], plugins: { @@ -35,10 +53,5 @@ module.exports = [ } } }, - { - files: ["**/*.js"], - languageOptions: { - sourceType: "commonjs" - } - } + prettier, ]; diff --git a/package-lock.json b/package-lock.json index c511a3671..b82533c74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,11 +8,9 @@ "name": "commander", "version": "12.0.0-0", "license": "MIT", - "dependencies": { - "@eslint/js": "^8.56.0", - "globals": "^13.24.0" - }, "devDependencies": { + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "^8.56.0", "@types/jest": "^29.2.4", "@types/node": "^20.2.5", "@typescript-eslint/eslint-plugin": "^6.14.0", @@ -20,6 +18,7 @@ "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", + "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", "ts-jest": "^29.0.3", @@ -752,6 +751,7 @@ "version": "8.56.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -2958,6 +2958,7 @@ "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -5376,6 +5377,7 @@ "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" }, diff --git a/package.json b/package.json index 7279ce622..2a43429f9 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,8 @@ } }, "devDependencies": { + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "^8.56.0", "@types/jest": "^29.2.4", "@types/node": "^20.2.5", "@typescript-eslint/eslint-plugin": "^6.14.0", @@ -63,13 +65,12 @@ "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", + "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", - "typescript": "^5.0.4", - "@eslint/js": "^8.56.0", - "globals": "^13.24.0" + "typescript": "^5.0.4" }, "types": "typings/index.d.ts", "engines": { From e00fed36e6be7c0d14dbdf6bb139bf41d82e1fa8 Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 20 Dec 2023 17:38:28 +1300 Subject: [PATCH 03/26] Minor lint. Prepare eslint-plugin-jsdoc --- eslint.config.js | 3 ++ package-lock.json | 102 ++++++++++++++++++++++++++++++++++++++++ package.json | 1 + typings/index.test-d.ts | 2 + 4 files changed, 108 insertions(+) diff --git a/eslint.config.js b/eslint.config.js index 472832d22..2b66bb951 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,6 +2,7 @@ const globals = require("globals"); const esLintjs = require("@eslint/js"); const jest = require("eslint-plugin-jest"); const prettier = require("eslint-config-prettier"); +const jsdoc = require('eslint-plugin-jsdoc'); const { FlatCompat } = require("@eslint/eslintrc"); // For reading original (non-flat) configs into flat format. // Jest is in process of updating for flat config support, so mixture of approaches. @@ -14,11 +15,13 @@ const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname }); module.exports = [ esLintjs.configs.recommended, + // jsdoc.configs['flat/recommended'], { files: ["**/*.{js,mjs,cjs}", "**/*.{ts,mts,cts}"], rules: { "no-unused-vars": "off", // lots in tests, minimise churn to start with 'no-else-return': ['error', { allowElseIf: false }], + // 'jsdoc/tag-lines': ['warn', "always", {"startLines":1}] }, languageOptions: { globals: { diff --git a/package-lock.json b/package-lock.json index b82533c74..7ef06397f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", + "eslint-plugin-jsdoc": "^46.9.1", "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", @@ -700,6 +701,20 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.41.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.41.0.tgz", + "integrity": "sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==", + "dev": true, + "dependencies": { + "comment-parser": "1.4.1", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -1731,6 +1746,15 @@ "node": ">= 8" } }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1958,6 +1982,18 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2107,6 +2143,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2576,6 +2621,39 @@ "node": ">=4.0" } }, + "node_modules/eslint-plugin-jsdoc": { + "version": "46.9.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.9.1.tgz", + "integrity": "sha512-11Ox5LCl2wY7gGkp9UOyew70o9qvii1daAH+h/MFobRVRNcy7sVlH+jm0HQdgcvcru6285GvpjpUyoa051j03Q==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.41.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.5.4", + "spdx-expression-parse": "^4.0.0" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, "node_modules/eslint-rule-docs": { "version": "1.1.235", "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", @@ -3169,6 +3247,21 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-core-module": { "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", @@ -3916,6 +4009,15 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", diff --git a/package.json b/package.json index 2a43429f9..c93ffeea9 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", + "eslint-plugin-jsdoc": "^46.9.1", "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 22706982b..6fb465507 100644 --- a/typings/index.test-d.ts +++ b/typings/index.test-d.ts @@ -409,6 +409,7 @@ expectType(baseOption.mandatory); expectType(baseOption.short); expectType(baseOption.long); expectType(baseOption.negate); +// eslint-disable-next-line @typescript-eslint/no-explicit-any expectType(baseOption.defaultValue); expectType(baseOption.defaultValueDescription); expectType(baseOption.presetArg); @@ -470,6 +471,7 @@ const baseArgument = new commander.Argument('(baseArgument.description); expectType(baseArgument.required); expectType(baseArgument.variadic); +// eslint-disable-next-line @typescript-eslint/no-explicit-any expectType(baseArgument.defaultValue); expectType(baseArgument.defaultValueDescription); expectType(baseArgument.argChoices); From ce6423bb4193f312ec577b79a4d1f6e7641ba28e Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 20 Dec 2023 17:47:46 +1300 Subject: [PATCH 04/26] Apply prettier to lint config --- eslint.config.js | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 2b66bb951..6da3653c3 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,9 @@ -const globals = require("globals"); -const esLintjs = require("@eslint/js"); -const jest = require("eslint-plugin-jest"); -const prettier = require("eslint-config-prettier"); +const globals = require('globals'); +const esLintjs = require('@eslint/js'); +const jest = require('eslint-plugin-jest'); +const prettier = require('eslint-config-prettier'); const jsdoc = require('eslint-plugin-jsdoc'); -const { FlatCompat } = require("@eslint/eslintrc"); // For reading original (non-flat) configs into flat format. +const { FlatCompat } = require('@eslint/eslintrc'); // For reading original (non-flat) configs into flat format. // Jest is in process of updating for flat config support, so mixture of approaches. // https://github.com/jest-community/eslint-plugin-jest/issues/1408 @@ -17,44 +17,42 @@ module.exports = [ esLintjs.configs.recommended, // jsdoc.configs['flat/recommended'], { - files: ["**/*.{js,mjs,cjs}", "**/*.{ts,mts,cts}"], + files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], rules: { - "no-unused-vars": "off", // lots in tests, minimise churn to start with + 'no-unused-vars': 'off', // lots in tests, minimise churn to start with 'no-else-return': ['error', { allowElseIf: false }], // 'jsdoc/tag-lines': ['warn', "always", {"startLines":1}] }, languageOptions: { globals: { ...globals.node, - } - } + }, + }, }, // Hack, restricting TypeScript config to TypeScript files. - ...compat.extends( - 'plugin:@typescript-eslint/recommended', - ).map(c => ({ + ...compat.extends('plugin:@typescript-eslint/recommended').map((c) => ({ ...c, - files: ["**/*.{ts,mts,cts}"], + files: ['**/*.{ts,mts,cts}'], })), { - files: ["**/*.js"], + files: ['**/*.js'], languageOptions: { - sourceType: "commonjs" - } + sourceType: 'commonjs', + }, }, { - files: ["**/*.test.js"], + files: ['**/*.test.js'], plugins: { - jest: jest + jest: jest, }, rules: { ...jest.configs.recommended.rules, }, languageOptions: { globals: { - ...globals.jest - } - } + ...globals.jest, + }, + }, }, prettier, ]; From 374d5525d83f5f5867ff2f0ae44fdc15db647c54 Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 20 Dec 2023 18:35:43 +1300 Subject: [PATCH 05/26] Rework npm scripts --- .prettierignore | 12 ++++++++---- package.json | 11 +++++++---- tsconfig.js.json | 2 +- tsconfig.json | 3 ++- tsconfig.ts.json | 3 +-- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.prettierignore b/.prettierignore index 4bd70c2a5..322076c02 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,9 @@ -# opt-in, so exclude everything +# exclude everything, and opt-in to types we want to format **.* -# add back the filetypes we want to format -!**.{js,mjs,cjs} -!**.{ts,mts,cts} +# add the filetypes we want to format +!**.js +!**.mjs +!**.cjs +!**.ts +!**.mts +!**.cts diff --git a/package.json b/package.json index c93ffeea9..64309044e 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,14 @@ "lint": "npm run lint:javascript && npm run lint:typescript", "lint:javascript": "eslint index.js esm.mjs \"lib/*.js\" \"tests/**/*.js\"", "lint:typescript": "eslint typings/*.ts tests/*.ts", - "test": "jest && npm run typecheck-ts", + "check": "npm run check:format", + "check:format": "prettier --check .", + "test": "jest && npm run typecheck:ts", "test-esm": "node ./tests/esm-imports-test.mjs", - "typecheck-ts": "tsd && tsc -p tsconfig.ts.json", - "typecheck-js": "tsc -p tsconfig.js.json", - "test-all": "npm run test && npm run lint && npm run typecheck-js && npm run test-esm" + "typecheck": "npm run typecheck:ts && npm run typecheck:js", + "typecheck:ts": "tsd && tsc -p tsconfig.ts.json", + "typecheck:js": "tsc -p tsconfig.js.json", + "test-all": "jest && npm run test-esm && npm run lint && npm run typecheck && npm run check" }, "files": [ "index.js", diff --git a/tsconfig.js.json b/tsconfig.js.json index ccbd8f153..11adc0df7 100644 --- a/tsconfig.js.json +++ b/tsconfig.js.json @@ -1,6 +1,6 @@ { /* Simple override including just JavaScript files. - Used by npm run-script typecheck-js + Used by npm run-script typecheck:js */ /* Visit https://aka.ms/tsconfig to read more about tsconfig configuration. */ "extends": "./tsconfig.json", diff --git a/tsconfig.json b/tsconfig.json index 3a2893488..0e8b6853d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,7 +30,8 @@ "noEmit": true, /* just type checking and not emitting transpiled files */ "skipLibCheck": false, /* we want to check our hand crafted definitions */ "forceConsistentCasingInFileNames": true, - "esModuleInterop": true /* common TypeScript config */ + "esModuleInterop": true, /* common TypeScript config */ + "resolveJsonModule": true, /* needed for globals in node_modules?! */ }, "include": [ /* JavaScript. Should match includes in tsconfig.js.json. */ diff --git a/tsconfig.ts.json b/tsconfig.ts.json index c87484aaa..c181a89b3 100644 --- a/tsconfig.ts.json +++ b/tsconfig.ts.json @@ -1,8 +1,7 @@ { /* Override to include just TypeScript files and use stricter settings than we do with JavaScript. Used by: - - npm run-script typecheck-ts - - eslint + - npm run-script typecheck:ts */ /* Visit https://aka.ms/tsconfig to read more about tsconfig configuration. */ "extends": "./tsconfig.json", From c9eb4a16c8a83e515e5f3af1887cee50813664c5 Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 20 Dec 2023 21:16:36 +1300 Subject: [PATCH 06/26] ESLint and JSDoc experimentation --- eslint.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 6da3653c3..687d6378b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,7 +2,7 @@ const globals = require('globals'); const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); const prettier = require('eslint-config-prettier'); -const jsdoc = require('eslint-plugin-jsdoc'); +// const jsdoc = require('eslint-plugin-jsdoc'); const { FlatCompat } = require('@eslint/eslintrc'); // For reading original (non-flat) configs into flat format. // Jest is in process of updating for flat config support, so mixture of approaches. @@ -21,7 +21,8 @@ module.exports = [ rules: { 'no-unused-vars': 'off', // lots in tests, minimise churn to start with 'no-else-return': ['error', { allowElseIf: false }], - // 'jsdoc/tag-lines': ['warn', "always", {"startLines":1}] + // 'jsdoc/tag-lines': 'off', + // 'jsdoc/require-jsdoc': 'off', }, languageOptions: { globals: { From 8abde1cd7e05ed65768ec9a3c31b785f45e336f0 Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 20 Dec 2023 21:16:55 +1300 Subject: [PATCH 07/26] Add json to Prettier coverage --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 322076c02..78a5a22d2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,3 +7,4 @@ !**.ts !**.mts !**.cts +!**.json From db46519d8e12b08e6f889a283a7e544ffc06dfce Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 22 Dec 2023 20:50:28 +1300 Subject: [PATCH 08/26] Add prettier-plugin-jsdoc --- .prettierrc.js | 1 + package-lock.json | 591 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 593 insertions(+) diff --git a/.prettierrc.js b/.prettierrc.js index 6da7e5777..345f13d79 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,4 +1,5 @@ const config = { + "plugins": ["prettier-plugin-jsdoc"], singleQuote: true, }; diff --git a/package-lock.json b/package-lock.json index 7ef06397f..973fc3b25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", + "prettier-plugin-jsdoc": "^1.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", "typescript": "^5.0.4" @@ -1347,6 +1348,15 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "dependencies": { + "@types/ms": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.2.tgz", @@ -1402,12 +1412,27 @@ "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", "dev": true }, + "node_modules/@types/mdast": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz", + "integrity": "sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg==", + "dev": true, + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/minimist": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.3.tgz", "integrity": "sha512-ZYFzrvyWUNhaPomn80dsMNgMeXxNWZBdkuG/hWlUvXvbdUH8ZERNBGXnU87McuGcWDsyzX2aChCv/SVN348k3A==", "dev": true }, + "node_modules/@types/ms": { + "version": "0.7.34", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", + "dev": true + }, "node_modules/@types/node": { "version": "20.8.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", @@ -1435,6 +1460,12 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, + "node_modules/@types/unist": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", + "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==", + "dev": true + }, "node_modules/@types/yargs": { "version": "17.0.28", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.28.tgz", @@ -1901,6 +1932,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/binary-searching": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/binary-searching/-/binary-searching-2.0.5.tgz", + "integrity": "sha512-v4N2l3RxL+m4zDxyxz3Ne2aTmiPn8ZUpKFpdPtO+ItW1NcTCXA7JeHG5GMBSvoKSkQZ9ycS+EouDVxYB9ufKWA==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2074,6 +2111,16 @@ "node": ">=10" } }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -2250,6 +2297,19 @@ "node": ">=0.10.0" } }, + "node_modules/decode-named-character-reference": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "dev": true, + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/dedent": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", @@ -2279,6 +2339,15 @@ "node": ">=0.10.0" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2288,6 +2357,19 @@ "node": ">=8" } }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -4215,6 +4297,43 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz", + "integrity": "sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA==", + "dev": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "dev": true, + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/meow": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", @@ -4277,6 +4396,448 @@ "node": ">= 8" } }, + "node_modules/micromark": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.0.tgz", + "integrity": "sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.0.tgz", + "integrity": "sha512-jThOz/pVmAYUtkroV3D5c1osFXAMv9e0ypGDOIZuCeAe91/sD6BoE2Sjzt30yuXtwOYUmySOhMas/PVyh02itA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.0.tgz", + "integrity": "sha512-j9DGrQLm/Uhl2tCzcbLhy5kXsgkHUrjJHg4fFAeoMRwJmJerT9aw4FEhIbZStWN8A3qMwOp1uzHr4UL8AInxtA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.0.tgz", + "integrity": "sha512-RR3i96ohZGde//4WSe/dJsxOX6vxIg9TimLAS3i4EhBAFx8Sm5SmqVfR8E87DPSR31nEAjZfbt91OMZWcNgdZw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.0.tgz", + "integrity": "sha512-TKr+LIDX2pkBJXFLzpyPyljzYK3MtmllMUMODTQJIUfDGncESaqB90db9IAUcz4AZAJFdd8U9zOp9ty1458rxg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.0.tgz", + "integrity": "sha512-jY8CSxmpWLOxS+t8W+FG3Xigc0RDQA9bKMY/EwILvsesiRniiVMejYTE4wumNc2f4UbAa4WsHqe3J1QS1sli+A==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.0.tgz", + "integrity": "sha512-28kbwaBjc5yAI1XadbdPYHX/eDnqaUFVikLwrO7FDnKG7lpgxnvk/XGRhX/PN0mOZ+dBSZ+LgunHS+6tYQAzhA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.0.1.tgz", + "integrity": "sha512-3wgnrmEAJ4T+mGXAUfMvMAbxU9RDG43XmGce4j6CwPtVxB3vfwXSZ6KhFwDzZ3mZHhmPimMAXg71veiBGzeAZw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.0.tgz", + "integrity": "sha512-anK8SWmNphkXdaKgz5hJvGa7l00qmcaUQoMYsBwDlSKFKjc6gjGXPDw3FNL3Nbwq5L8gE+RCbGqTw49FK5Qyvg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.0.tgz", + "integrity": "sha512-S0ze2R9GH+fu41FA7pbSqNWObo/kzwf8rN/+IGlW/4tC6oACOs8B++bh+i9bVyNnwCcuksbFwsBme5OCKXCwIw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.0.tgz", + "integrity": "sha512-vZZio48k7ON0fVS3CUgFatWHoKbbLTK/rT7pzpJ4Bjp5JjkZeasRfrS9wsBdDJK2cJLHMckXZdzPSSr1B8a4oQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.1.tgz", + "integrity": "sha512-bmkNc7z8Wn6kgjZmVHOX3SowGmVdhYS7yBpMnuMnPzDq/6xwVA604DuOXMZTO1lvq01g+Adfa0pE2UKGlxL1XQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.0.tgz", + "integrity": "sha512-r4Sc6leeUTn3P6gk20aFMj2ntPwn6qpDZqWvYmAG6NgvFTIlj4WtrAudLi65qYoaGdXYViXYw2pkmn7QnIFasA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.0.tgz", + "integrity": "sha512-xNn4Pqkj2puRhKdKTm8t1YHC/BAjx6CEwRFXntTaRf/x16aqka6ouVoutm+QdkISTlT7e2zU7U4ZdlDLJd2Mcw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.0.tgz", + "integrity": "sha512-2xhYT0sfo85FMrUPtHcPo2rrp1lwbDEEzpx7jiH2xXJLqBuy4H0GgXk5ToU8IEwoROtXuL8ND0ttVa4rNqYK3w==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.0.tgz", + "integrity": "sha512-6KU6qO7DZ7GJkaCgwBNtplXCvGkJToU86ybBAUdavvgsCiG8lSSvYxr9MhwmQ+udpzywHsl4RpGJsYWG1pDOcA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.0.tgz", + "integrity": "sha512-vc93L1t+gpR3p8jxeVdaYlbV2jTYteDje19rNSS/H5dlhxUYll5Fy6vJ2cDwP8RnsXi818yGty1ayP55y3W6fg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -4676,6 +5237,23 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-jsdoc": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-1.1.1.tgz", + "integrity": "sha512-yA13k0StQ+g0RJBrmo2IldVSp3ANXlJdsNzQNhGtQ0LY7JFC+u01No/1Z9xp0ZhT4u98BXlPAc4SC0iambqy5A==", + "dev": true, + "dependencies": { + "binary-searching": "^2.0.5", + "comment-parser": "^1.4.0", + "mdast-util-from-markdown": "^2.0.0" + }, + "engines": { + "node": ">=14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "prettier": "^3.0.0" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -5506,6 +6084,19 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", diff --git a/package.json b/package.json index 64309044e..96646df1f 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", + "prettier-plugin-jsdoc": "^1.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", "typescript": "^5.0.4" From 45164efc685f7ead15f4f54a33b04e5b7d9c7a22 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 16 Feb 2024 19:07:14 +1300 Subject: [PATCH 09/26] Upgrade to typescript-eslint which supports eslint flat configs --- eslint.config.js | 12 +- package-lock.json | 330 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 7 +- 3 files changed, 326 insertions(+), 23 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 687d6378b..bab7ad16d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,17 +2,15 @@ const globals = require('globals'); const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); const prettier = require('eslint-config-prettier'); +const tseslint = require('typescript-eslint'); + + // const jsdoc = require('eslint-plugin-jsdoc'); const { FlatCompat } = require('@eslint/eslintrc'); // For reading original (non-flat) configs into flat format. // Jest is in process of updating for flat config support, so mixture of approaches. // https://github.com/jest-community/eslint-plugin-jest/issues/1408 -// Likewise with TypeScript, recommended approach is compatibility layer for now. -// https://github.com/typescript-eslint/typescript-eslint/issues/7694 - -const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname }); - module.exports = [ esLintjs.configs.recommended, // jsdoc.configs['flat/recommended'], @@ -30,8 +28,8 @@ module.exports = [ }, }, }, - // Hack, restricting TypeScript config to TypeScript files. - ...compat.extends('plugin:@typescript-eslint/recommended').map((c) => ({ + // Restricting TypeScript configs to TypeScript files. + ...tseslint.configs.recommended.map((c) => ({ ...c, files: ['**/*.{ts,mts,cts}'], })), diff --git a/package-lock.json b/package-lock.json index 973fc3b25..504902eeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,10 @@ "version": "12.0.0-0", "license": "MIT", "devDependencies": { - "@eslint/eslintrc": "^2.1.4", + "@eslint/eslintrc": "^3.0.1", "@eslint/js": "^8.56.0", "@types/jest": "^29.2.4", "@types/node": "^20.2.5", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "^6.14.0", "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", @@ -25,7 +23,8 @@ "prettier-plugin-jsdoc": "^1.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "typescript-eslint": "^7.0.1" }, "engines": { "node": ">=18" @@ -741,14 +740,14 @@ } }, "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.0.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.0.1.tgz", + "integrity": "sha512-xXm39r1RgOSmPCqlhn+E10KPJ7JKrpuBwsAVw/++5dS/Sa4GAi0smby0r0wfTN4gNpkk9iij2hssJMXHSmQ89w==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", + "espree": "^10.0.1", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -757,7 +756,36 @@ "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" + } + }, + "node_modules/@eslint/eslintrc/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/eslintrc/node_modules/espree": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.0.1.tgz", + "integrity": "sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==", + "dev": true, + "dependencies": { + "acorn": "^8.11.3", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1486,6 +1514,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.14.0.tgz", "integrity": "sha512-1ZJBykBCXaSHG94vMMKmiHoL0MhNHKSVlcHVYZNw+BKxufhqQVTOawNpwwI1P5nIFZ/4jLVop0mcY6mJJDFNaw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", "@typescript-eslint/scope-manager": "6.14.0", @@ -1521,6 +1551,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.14.0.tgz", "integrity": "sha512-QjToC14CKacd4Pa7JK4GeB/vHmWFJckec49FR4hmIRf97+KXole0T97xxu9IFiPxVQ1DBWrQ5wreLwAGwWAVQA==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "6.14.0", "@typescript-eslint/types": "6.14.0", @@ -1549,6 +1581,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.14.0.tgz", "integrity": "sha512-VT7CFWHbZipPncAZtuALr9y3EuzY1b1t1AEkIq2bTXUPKw+pHoXflGNG5L+Gv6nKul1cz1VH8fz16IThIU0tdg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@typescript-eslint/types": "6.14.0", "@typescript-eslint/visitor-keys": "6.14.0" @@ -1566,6 +1600,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.14.0.tgz", "integrity": "sha512-x6OC9Q7HfYKqjnuNu5a7kffIYs3No30isapRBJl1iCHLitD8O0lFbRcVGiOcuyN837fqXzPZ1NS10maQzZMKqw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@typescript-eslint/typescript-estree": "6.14.0", "@typescript-eslint/utils": "6.14.0", @@ -1593,6 +1629,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.14.0.tgz", "integrity": "sha512-uty9H2K4Xs8E47z3SnXEPRNDfsis8JO27amp2GNCnzGETEW3yTqEIVg5+AI7U276oGF/tw6ZA+UesxeQ104ceA==", "dev": true, + "optional": true, + "peer": true, "engines": { "node": "^16.0.0 || >=18.0.0" }, @@ -1606,6 +1644,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.14.0.tgz", "integrity": "sha512-yPkaLwK0yH2mZKFE/bXkPAkkFgOv15GJAUzgUVonAbv0Hr4PK/N2yaA/4XQbTZQdygiDkpt5DkxPELqHguNvyw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@typescript-eslint/types": "6.14.0", "@typescript-eslint/visitor-keys": "6.14.0", @@ -1633,6 +1673,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.14.0.tgz", "integrity": "sha512-XwRTnbvRr7Ey9a1NT6jqdKX8y/atWG+8fAIu3z73HSP8h06i3r/ClMhmaF/RGWGW1tHJEwij1uEg2GbEmPYvYg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", @@ -1658,6 +1700,8 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.14.0.tgz", "integrity": "sha512-fB5cw6GRhJUz03MrROVuj5Zm/Q+XWlVdIsFj+Zb1Hvqouc8t+XP2H5y53QYU/MGtd2dPg6/vJJlhoX3xc2ehfw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@typescript-eslint/types": "6.14.0", "eslint-visitor-keys": "^3.4.1" @@ -1677,9 +1721,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2770,6 +2814,29 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -6078,6 +6145,245 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.0.1.tgz", + "integrity": "sha512-aIquOfwHkGHrMSH57HxLT+1Qzp99YtGxEHXMRD+BXOc8fkuFBbA5BXsMYnoVXFuXOWBdXg8U2rN9Xe4p7LrPSQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "7.0.1", + "@typescript-eslint/parser": "7.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", + "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/type-utils": "7.0.1", + "@typescript-eslint/utils": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/parser": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", + "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/scope-manager": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", + "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/type-utils": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", + "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/utils": "7.0.1", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/types": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", + "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", + "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/utils": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", + "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.1", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", + "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typescript-eslint/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/package.json b/package.json index 96646df1f..f0e0e9a3a 100644 --- a/package.json +++ b/package.json @@ -59,12 +59,10 @@ } }, "devDependencies": { - "@eslint/eslintrc": "^2.1.4", + "@eslint/eslintrc": "^3.0.1", "@eslint/js": "^8.56.0", "@types/jest": "^29.2.4", "@types/node": "^20.2.5", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "^6.14.0", "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.1.7", @@ -75,7 +73,8 @@ "prettier-plugin-jsdoc": "^1.1.1", "ts-jest": "^29.0.3", "tsd": "^0.29.0", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "typescript-eslint": "^7.0.1" }, "types": "typings/index.d.ts", "engines": { From 2805ac568c603596565c32ebfd41f21784d3dcc2 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 17 Feb 2024 11:11:53 +1300 Subject: [PATCH 10/26] Update eslint-plugin-jest with flat config --- eslint.config.js | 47 ++++++++++------------------------------ package-lock.json | 10 ++++----- package.json | 2 +- tests/ts-imports.test.ts | 2 ++ 4 files changed, 20 insertions(+), 41 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index bab7ad16d..3a772c828 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -3,55 +3,32 @@ const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); const prettier = require('eslint-config-prettier'); const tseslint = require('typescript-eslint'); - - // const jsdoc = require('eslint-plugin-jsdoc'); -const { FlatCompat } = require('@eslint/eslintrc'); // For reading original (non-flat) configs into flat format. - -// Jest is in process of updating for flat config support, so mixture of approaches. -// https://github.com/jest-community/eslint-plugin-jest/issues/1408 module.exports = [ esLintjs.configs.recommended, // jsdoc.configs['flat/recommended'], - { - files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], - rules: { - 'no-unused-vars': 'off', // lots in tests, minimise churn to start with - 'no-else-return': ['error', { allowElseIf: false }], - // 'jsdoc/tag-lines': 'off', - // 'jsdoc/require-jsdoc': 'off', - }, - languageOptions: { - globals: { - ...globals.node, - }, - }, - }, + jest.configs['flat/recommended'], // Restricting TypeScript configs to TypeScript files. - ...tseslint.configs.recommended.map((c) => ({ - ...c, + ...tseslint.configs.recommended.map((config) => ({ + ...config, files: ['**/*.{ts,mts,cts}'], })), { - files: ['**/*.js'], - languageOptions: { - sourceType: 'commonjs', - }, - }, - { - files: ['**/*.test.js'], - plugins: { - jest: jest, - }, + files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], rules: { - ...jest.configs.recommended.rules, + 'no-unused-vars': 'off', // lots in tests, minimise churn for now + 'no-else-return': ['error', { allowElseIf: false }], + 'jsdoc/tag-lines': 'off', + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-param-description': 'off', + 'jsdoc/require-returns-description': 'off', }, languageOptions: { globals: { - ...globals.jest, + ...globals.node, }, }, }, - prettier, + prettier, // Do Prettier last so it can override previous configs. ]; diff --git a/package-lock.json b/package-lock.json index 9ad255ae4..ccdf2b9b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@types/node": "^20.2.5", "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-jest": "^27.1.7", + "eslint-plugin-jest": "^27.9.0", "eslint-plugin-jsdoc": "^46.9.1", "globals": "^13.24.0", "jest": "^29.3.1", @@ -2601,9 +2601,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", - "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", + "version": "27.9.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", + "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -2612,7 +2612,7 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", + "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0", "eslint": "^7.0.0 || ^8.0.0", "jest": "*" }, diff --git a/package.json b/package.json index 652fa9db5..8ead53cac 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@types/node": "^20.2.5", "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-jest": "^27.1.7", + "eslint-plugin-jest": "^27.9.0", "eslint-plugin-jsdoc": "^46.9.1", "globals": "^13.24.0", "jest": "^29.3.1", diff --git a/tests/ts-imports.test.ts b/tests/ts-imports.test.ts index e766bcb5f..8ccfd7b65 100644 --- a/tests/ts-imports.test.ts +++ b/tests/ts-imports.test.ts @@ -3,6 +3,8 @@ import { program, Command, Option, CommanderError, InvalidArgumentError, Invalid // Do some simple checks that expected imports are available at runtime. // Similar tests to esm-imports-test.js +/* eslint-disable jest/expect-expect */ + // eslint-disable-next-line @typescript-eslint/ban-types function checkClass(obj: object, name: string): void { expect(typeof obj).toEqual('object'); From d5dd13802de94cb97f3ac4db06a6fa241ee44483 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 17 Feb 2024 12:13:44 +1300 Subject: [PATCH 11/26] Use custom tsconfig for TypeScript eslint --- eslint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.js b/eslint.config.js index 3a772c828..11550a85b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,6 +12,7 @@ module.exports = [ // Restricting TypeScript configs to TypeScript files. ...tseslint.configs.recommended.map((config) => ({ ...config, + languageOptions: {parser: tseslint.parser, parserOptions: { project: './tsconfig.ts.json' }}, files: ['**/*.{ts,mts,cts}'], })), { From c1461f88cca224c4f9dc1eb71981880d521ff747 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 17 Feb 2024 12:29:32 +1300 Subject: [PATCH 12/26] Update eslint related dependencies --- package-lock.json | 89 ++++++++++------------------------------------- package.json | 5 ++- 2 files changed, 20 insertions(+), 74 deletions(-) diff --git a/package-lock.json b/package-lock.json index ccdf2b9b0..47ff52669 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,18 +9,17 @@ "version": "12.0.0", "license": "MIT", "devDependencies": { - "@eslint/eslintrc": "^3.0.1", "@eslint/js": "^8.56.0", "@types/jest": "^29.2.4", "@types/node": "^20.2.5", "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.9.0", - "eslint-plugin-jsdoc": "^46.9.1", + "eslint-plugin-jsdoc": "^48.1.0", "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", - "prettier-plugin-jsdoc": "^1.1.1", + "prettier-plugin-jsdoc": "^1.3.0", "ts-jest": "^29.0.3", "tsd": "^0.30.4", "typescript": "^5.0.4", @@ -702,9 +701,9 @@ "dev": true }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.41.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.41.0.tgz", - "integrity": "sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==", + "version": "0.42.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.42.0.tgz", + "integrity": "sha512-R1w57YlVA6+YE01wch3GPYn6bCsrOV3YW/5oGGE2tmX6JcL9Nr+b5IikrjMPF+v9CV3ay+obImEdsDhovhJrzw==", "dev": true, "dependencies": { "comment-parser": "1.4.1", @@ -739,58 +738,6 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@eslint/eslintrc": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.0.1.tgz", - "integrity": "sha512-xXm39r1RgOSmPCqlhn+E10KPJ7JKrpuBwsAVw/++5dS/Sa4GAi0smby0r0wfTN4gNpkk9iij2hssJMXHSmQ89w==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/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/eslintrc/node_modules/espree": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.0.1.tgz", - "integrity": "sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==", - "dev": true, - "dependencies": { - "acorn": "^8.11.3", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/@eslint/js": { "version": "8.56.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", @@ -2748,26 +2695,26 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "46.9.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.9.1.tgz", - "integrity": "sha512-11Ox5LCl2wY7gGkp9UOyew70o9qvii1daAH+h/MFobRVRNcy7sVlH+jm0HQdgcvcru6285GvpjpUyoa051j03Q==", + "version": "48.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.1.0.tgz", + "integrity": "sha512-g9S8ukmTd1DVcV/xeBYPPXOZ6rc8WJ4yi0+MVxJ1jBOrz5kmxV9gJJQ64ltCqIWFnBChLIhLVx3tbTSarqVyFA==", "dev": true, "dependencies": { - "@es-joy/jsdoccomment": "~0.41.0", + "@es-joy/jsdoccomment": "~0.42.0", "are-docs-informative": "^0.0.2", "comment-parser": "1.4.1", "debug": "^4.3.4", "escape-string-regexp": "^4.0.0", "esquery": "^1.5.0", "is-builtin-module": "^3.2.1", - "semver": "^7.5.4", + "semver": "^7.6.0", "spdx-expression-parse": "^4.0.0" }, "engines": { - "node": ">=16" + "node": ">=18" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, "node_modules/eslint-plugin-jsdoc/node_modules/spdx-expression-parse": { @@ -5305,9 +5252,9 @@ } }, "node_modules/prettier-plugin-jsdoc": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-1.1.1.tgz", - "integrity": "sha512-yA13k0StQ+g0RJBrmo2IldVSp3ANXlJdsNzQNhGtQ0LY7JFC+u01No/1Z9xp0ZhT4u98BXlPAc4SC0iambqy5A==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-1.3.0.tgz", + "integrity": "sha512-cQm8xIa0fN9ieJFMXACQd6JPycl+8ouOijAqUqu44EF/s4fXL3Wi9sKXuEaodsEWgCN42Xby/bNhqgM1iWx4uw==", "dev": true, "dependencies": { "binary-searching": "^2.0.5", @@ -5676,9 +5623,9 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" diff --git a/package.json b/package.json index 8ead53cac..751c4a5ad 100644 --- a/package.json +++ b/package.json @@ -59,18 +59,17 @@ } }, "devDependencies": { - "@eslint/eslintrc": "^3.0.1", "@eslint/js": "^8.56.0", "@types/jest": "^29.2.4", "@types/node": "^20.2.5", "eslint": "^8.30.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.9.0", - "eslint-plugin-jsdoc": "^46.9.1", + "eslint-plugin-jsdoc": "^48.1.0", "globals": "^13.24.0", "jest": "^29.3.1", "prettier": "^3.1.1", - "prettier-plugin-jsdoc": "^1.1.1", + "prettier-plugin-jsdoc": "^1.3.0", "ts-jest": "^29.0.3", "tsd": "^0.30.4", "typescript": "^5.0.4", From 5b51a14939c1e2f83826ee17193d5f5ddc0eec58 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sun, 18 Feb 2024 19:30:05 +1300 Subject: [PATCH 13/26] Rename "check" run-script --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 751c4a5ad..b395ad0a4 100644 --- a/package.json +++ b/package.json @@ -22,14 +22,13 @@ "lint": "npm run lint:javascript && npm run lint:typescript", "lint:javascript": "eslint index.js esm.mjs \"lib/*.js\" \"tests/**/*.js\"", "lint:typescript": "eslint typings/*.ts tests/*.ts", - "check": "npm run check:format", - "check:format": "prettier --check .", + "lint:format": "prettier --check .", "test": "jest && npm run typecheck:ts", "test-esm": "node ./tests/esm-imports-test.mjs", "typecheck": "npm run typecheck:ts && npm run typecheck:js", "typecheck:ts": "tsd && tsc -p tsconfig.ts.json", "typecheck:js": "tsc -p tsconfig.js.json", - "test-all": "jest && npm run test-esm && npm run lint && npm run typecheck && npm run check" + "test-all": "jest && npm run test-esm && npm run lint && npm run typecheck" }, "files": [ "index.js", From 511ad59f2d0c7e30066bb01d125712290f429d77 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sun, 18 Feb 2024 19:53:08 +1300 Subject: [PATCH 14/26] Add fix run-scripts --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b395ad0a4..c11c275fb 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,14 @@ "url": "git+https://github.com/tj/commander.js.git" }, "scripts": { + "fix": "npm run fix:javascript && npm run fix:typescript", + "fix:format": "prettier --write .", + "fix:javascript": "npm run lint:javascript -- --fix", + "fix:typescript": "npm run lint:typescript -- --fix", "lint": "npm run lint:javascript && npm run lint:typescript", + "lint:format": "prettier --check .", "lint:javascript": "eslint index.js esm.mjs \"lib/*.js\" \"tests/**/*.js\"", "lint:typescript": "eslint typings/*.ts tests/*.ts", - "lint:format": "prettier --check .", "test": "jest && npm run typecheck:ts", "test-esm": "node ./tests/esm-imports-test.mjs", "typecheck": "npm run typecheck:ts && npm run typecheck:js", From 7586f7f80fd94519bd2460c5e80504f8adb6f164 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 23 Feb 2024 21:44:27 +1300 Subject: [PATCH 15/26] Add typescript-eslint on javascript files, and rework how configured --- eslint.config.js | 58 +++++++++++++++++++++++++++++++++++++++++------- lib/command.js | 13 ++++++----- lib/help.js | 6 ++--- 3 files changed, 60 insertions(+), 17 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 11550a85b..2f24f534f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -5,21 +5,64 @@ const prettier = require('eslint-config-prettier'); const tseslint = require('typescript-eslint'); // const jsdoc = require('eslint-plugin-jsdoc'); +// Using tseslint config helper to customise its setup the tseslint way. +const tsconfigTsFiles = ['**/*.{ts,mts}']; // match "include" in tsconfig.ts.json; +const tsconfigJsFiles = ['*.{js,mjs}', 'lib/**/*.{js,mjs}']; // match "include" in tsconfig.js.json +const tsConfigs = tseslint.config({ + files: tsconfigJsFiles, + languageOptions: { + parserOptions: { project: './tsconfig.js.json' }, + }, + extends: [ + ...tseslint.configs.recommended, + ], + rules: { + '@typescript-eslint/no-var-requires': 'off', // otherwise complains about require (tselint defaults to sourceType:'module' ) + }, + }, { + files: tsconfigTsFiles, + languageOptions: { + parserOptions: { project: './tsconfig.ts.json' }, + }, + extends: [ + ...tseslint.configs.recommended, + ], + rules: { + }, + }, +); + module.exports = [ esLintjs.configs.recommended, // jsdoc.configs['flat/recommended'], jest.configs['flat/recommended'], - // Restricting TypeScript configs to TypeScript files. - ...tseslint.configs.recommended.map((config) => ({ - ...config, - languageOptions: {parser: tseslint.parser, parserOptions: { project: './tsconfig.ts.json' }}, - files: ['**/*.{ts,mts,cts}'], - })), + ...tsConfigs, + prettier, // Do Prettier last so it can override previous configs. + + // Customise rules. { - files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], + files: [...tsconfigTsFiles, ...tsconfigJsFiles], + rules: { + '@typescript-eslint/ban-ts-comment': ['error', { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': 'allow-with-description', + 'ts-nocheck': true, + 'ts-check': true, + }], + }, + }, + { + files: ['**/*.test.{js,mjs,cjs}'], rules: { 'no-unused-vars': 'off', // lots in tests, minimise churn for now + '@typescript-eslint/no-unused-vars': 'off', + } + }, + { + files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], + rules: { 'no-else-return': ['error', { allowElseIf: false }], + 'jsdoc/tag-lines': 'off', 'jsdoc/require-jsdoc': 'off', 'jsdoc/require-param-description': 'off', @@ -31,5 +74,4 @@ module.exports = [ }, }, }, - prettier, // Do Prettier last so it can override previous configs. ]; diff --git a/lib/command.js b/lib/command.js index 5b16e6031..93ae70d46 100644 --- a/lib/command.js +++ b/lib/command.js @@ -105,6 +105,7 @@ class Command extends EventEmitter { _getCommandAndAncestors() { const result = []; + // eslint-disable-next-line @typescript-eslint/no-this-alias for (let command = this; command; command = command.parent) { result.push(command); } @@ -929,7 +930,6 @@ Expecting one of '${allowedValues.join("', '")}'`); // Default to using process.argv if (argv === undefined) { argv = process.argv; - // @ts-ignore: unknown property if (process.versions && process.versions.electron) { parseOptions.from = 'electron'; } @@ -945,7 +945,7 @@ Expecting one of '${allowedValues.join("', '")}'`); userArgs = argv.slice(2); break; case 'electron': - // @ts-ignore: unknown property + // @ts-ignore: because defaultApp is an unknown property if (process.defaultApp) { this._scriptPath = argv[1]; userArgs = argv.slice(2); @@ -1097,7 +1097,6 @@ Expecting one of '${allowedValues.join("', '")}'`); if (!proc.killed) { // testing mainly to avoid leak warnings during unit tests with mocked spawn const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; signals.forEach((signal) => { - // @ts-ignore process.on(signal, () => { if (proc.killed === false && proc.exitCode === null) { proc.kill(signal); @@ -1108,7 +1107,7 @@ Expecting one of '${allowedValues.join("', '")}'`); // By default terminate process when spawned process terminates. const exitCallback = this._exitCallback; - proc.on('close', (code, _signal) => { + proc.on('close', (code) => { code = code ?? 1; // code is null if spawned process terminated due to a signal if (!exitCallback) { process.exit(code); @@ -1117,7 +1116,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } }); proc.on('error', (err) => { - // @ts-ignore + // @ts-ignore: because err.code is an unknown property if (err.code === 'ENOENT') { const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` @@ -1127,7 +1126,7 @@ Expecting one of '${allowedValues.join("', '")}'`); - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${executableDirMessage}`; throw new Error(executableMissing); - // @ts-ignore + // @ts-ignore: because err.code is an unknown property } else if (err.code === 'EACCES') { throw new Error(`'${executableFile}' not executable`); } @@ -1818,6 +1817,7 @@ Expecting one of '${allowedValues.join("', '")}'`); if (flag.startsWith('--') && this._showSuggestionAfterError) { // Looping to pick up the global options too let candidateFlags = []; + // eslint-disable-next-line @typescript-eslint/no-this-alias let command = this; do { const moreFlags = command.createHelp().visibleOptions(command) @@ -1944,6 +1944,7 @@ Expecting one of '${allowedValues.join("', '")}'`); if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility /** @type {Command} */ + // eslint-disable-next-line @typescript-eslint/no-this-alias let command = this; if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) { // assume adding alias for last added executable subcommand, rather than this diff --git a/lib/help.js b/lib/help.js index 64e358a0b..e92ac3ced 100644 --- a/lib/help.js +++ b/lib/help.js @@ -32,7 +32,7 @@ class Help { } if (this.sortSubcommands) { visibleCommands.sort((a, b) => { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return a.name().localeCompare(b.name()); }); } @@ -248,7 +248,7 @@ class Help { */ commandDescription(cmd) { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return cmd.description(); } @@ -261,7 +261,7 @@ class Help { */ subcommandDescription(cmd) { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return cmd.summary() || cmd.description(); } From be586ddf03a814aced8f253eb7d6df880589be3a Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 24 Feb 2024 10:07:52 +1300 Subject: [PATCH 16/26] Comment out jsdoc and prettier for later --- eslint.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 2f24f534f..6d912e051 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,8 +1,8 @@ const globals = require('globals'); const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); -const prettier = require('eslint-config-prettier'); const tseslint = require('typescript-eslint'); +// const prettier = require('eslint-config-prettier'); // const jsdoc = require('eslint-plugin-jsdoc'); // Using tseslint config helper to customise its setup the tseslint way. @@ -37,7 +37,7 @@ module.exports = [ // jsdoc.configs['flat/recommended'], jest.configs['flat/recommended'], ...tsConfigs, - prettier, // Do Prettier last so it can override previous configs. + // prettier, // Do Prettier last so it can override previous configs. // Customise rules. { @@ -63,10 +63,10 @@ module.exports = [ rules: { 'no-else-return': ['error', { allowElseIf: false }], - 'jsdoc/tag-lines': 'off', - 'jsdoc/require-jsdoc': 'off', - 'jsdoc/require-param-description': 'off', - 'jsdoc/require-returns-description': 'off', + // 'jsdoc/tag-lines': 'off', + // 'jsdoc/require-jsdoc': 'off', + // 'jsdoc/require-param-description': 'off', + // 'jsdoc/require-returns-description': 'off', }, languageOptions: { globals: { From 9f1f11603ce863a58bce54711ebfaba94600e555 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 24 Feb 2024 11:27:21 +1300 Subject: [PATCH 17/26] Reorder eslint configs --- eslint.config.js | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 6d912e051..4d13fa8a2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,13 +2,14 @@ const globals = require('globals'); const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); const tseslint = require('typescript-eslint'); -// const prettier = require('eslint-config-prettier'); -// const jsdoc = require('eslint-plugin-jsdoc'); +//const prettier = require('eslint-config-prettier'); +//const jsdoc = require('eslint-plugin-jsdoc'); // Using tseslint config helper to customise its setup the tseslint way. const tsconfigTsFiles = ['**/*.{ts,mts}']; // match "include" in tsconfig.ts.json; const tsconfigJsFiles = ['*.{js,mjs}', 'lib/**/*.{js,mjs}']; // match "include" in tsconfig.js.json -const tsConfigs = tseslint.config({ +const tseslintConfigs = tseslint.config( + { files: tsconfigJsFiles, languageOptions: { parserOptions: { project: './tsconfig.js.json' }, @@ -17,7 +18,7 @@ const tsConfigs = tseslint.config({ ...tseslint.configs.recommended, ], rules: { - '@typescript-eslint/no-var-requires': 'off', // otherwise complains about require (tselint defaults to sourceType:'module' ) + '@typescript-eslint/no-var-requires': 'off', // otherwise complains about require (tseslint defaults to sourceType:'module' ) }, }, { files: tsconfigTsFiles, @@ -27,8 +28,6 @@ const tsConfigs = tseslint.config({ extends: [ ...tseslint.configs.recommended, ], - rules: { - }, }, ); @@ -36,28 +35,10 @@ module.exports = [ esLintjs.configs.recommended, // jsdoc.configs['flat/recommended'], jest.configs['flat/recommended'], - ...tsConfigs, + ...tseslintConfigs, // prettier, // Do Prettier last so it can override previous configs. // Customise rules. - { - files: [...tsconfigTsFiles, ...tsconfigJsFiles], - rules: { - '@typescript-eslint/ban-ts-comment': ['error', { - 'ts-expect-error': 'allow-with-description', - 'ts-ignore': 'allow-with-description', - 'ts-nocheck': true, - 'ts-check': true, - }], - }, - }, - { - files: ['**/*.test.{js,mjs,cjs}'], - rules: { - 'no-unused-vars': 'off', // lots in tests, minimise churn for now - '@typescript-eslint/no-unused-vars': 'off', - } - }, { files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], rules: { @@ -74,4 +55,21 @@ module.exports = [ }, }, }, + { + files: ['**/*.test.{js,mjs,cjs}'], + rules: { + 'no-unused-vars': 'off', // lots in tests, minimise churn for now + } + }, + { + files: [...tsconfigTsFiles, ...tsconfigJsFiles], + rules: { + '@typescript-eslint/ban-ts-comment': ['error', { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': 'allow-with-description', + 'ts-nocheck': true, + 'ts-check': true, + }], + }, + }, ]; From 4fb3be4b182183bd141ec512a607842c0b5c92a7 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 24 Feb 2024 12:20:20 +1300 Subject: [PATCH 18/26] Simplify eslint run-scripts --- examples/arguments-custom-processing.js | 2 +- examples/custom-command-class.js | 4 ++-- examples/options-custom-processing.js | 4 ++-- package.json | 16 +++++++--------- tsconfig.js.json | 1 + tsconfig.json | 1 + 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/arguments-custom-processing.js b/examples/arguments-custom-processing.js index ac92855f6..fefb6fab6 100644 --- a/examples/arguments-custom-processing.js +++ b/examples/arguments-custom-processing.js @@ -8,7 +8,7 @@ const commander = require('../'); // include commander in git clone of commander repo const program = new commander.Command(); -function myParseInt(value, dummyPrevious) { +function myParseInt(value) { // parseInt takes a string and a radix const parsedValue = parseInt(value, 10); if (isNaN(parsedValue)) { diff --git a/examples/custom-command-class.js b/examples/custom-command-class.js index a5e40b00b..90e0759f6 100755 --- a/examples/custom-command-class.js +++ b/examples/custom-command-class.js @@ -12,14 +12,14 @@ class CommandWithTrace extends commander.Command { cmd.option('-t, --trace', 'display extra information when run command'); return cmd; } -}; +} function inpectCommand(command) { // The option value is stored as property on command because we called .storeOptionsAsProperties() console.log(`Called '${command.name()}'`); console.log(`args: ${command.args}`); console.log('opts: %o', command.opts()); -}; +} const program = new CommandWithTrace('program') .option('-v, ---verbose') diff --git a/examples/options-custom-processing.js b/examples/options-custom-processing.js index 1325fee3b..90885ca4b 100755 --- a/examples/options-custom-processing.js +++ b/examples/options-custom-processing.js @@ -8,7 +8,7 @@ const commander = require('../'); // include commander in git clone of commander repo const program = new commander.Command(); -function myParseInt(value, dummyPrevious) { +function myParseInt(value) { // parseInt takes a string and a radix const parsedValue = parseInt(value, 10); if (isNaN(parsedValue)) { @@ -25,7 +25,7 @@ function collect(value, previous) { return previous.concat([value]); } -function commaSeparatedList(value, dummyPrevious) { +function commaSeparatedList(value) { return value.split(','); } diff --git a/package.json b/package.json index c11c275fb..48027f81e 100644 --- a/package.json +++ b/package.json @@ -19,20 +19,18 @@ "url": "git+https://github.com/tj/commander.js.git" }, "scripts": { - "fix": "npm run fix:javascript && npm run fix:typescript", + "check": "npm run check:lint", + "check:format": "prettier --check .", + "check:lint": "eslint .", + "fix": "npm run fix:lint", "fix:format": "prettier --write .", - "fix:javascript": "npm run lint:javascript -- --fix", - "fix:typescript": "npm run lint:typescript -- --fix", - "lint": "npm run lint:javascript && npm run lint:typescript", - "lint:format": "prettier --check .", - "lint:javascript": "eslint index.js esm.mjs \"lib/*.js\" \"tests/**/*.js\"", - "lint:typescript": "eslint typings/*.ts tests/*.ts", + "fix:lint": "eslint --fix .", "test": "jest && npm run typecheck:ts", + "test-all": "jest && npm run test-esm && npm run check && npm run typecheck", "test-esm": "node ./tests/esm-imports-test.mjs", "typecheck": "npm run typecheck:ts && npm run typecheck:js", "typecheck:ts": "tsd && tsc -p tsconfig.ts.json", - "typecheck:js": "tsc -p tsconfig.js.json", - "test-all": "jest && npm run test-esm && npm run lint && npm run typecheck" + "typecheck:js": "tsc -p tsconfig.js.json" }, "files": [ "index.js", diff --git a/tsconfig.js.json b/tsconfig.js.json index 11adc0df7..87cfb0a99 100644 --- a/tsconfig.js.json +++ b/tsconfig.js.json @@ -7,6 +7,7 @@ "include": [ /* All JavaScript targets from tsconfig.json include. */ "*.js", + ".prettierrc.js", /* missed by above pattern */ "*.mjs", "lib/**/*.js" ], diff --git a/tsconfig.json b/tsconfig.json index 0e8b6853d..4c6328ce9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -36,6 +36,7 @@ "include": [ /* JavaScript. Should match includes in tsconfig.js.json. */ "*.js", + ".prettierrc.js", /* missed by above pattern */ "*.mjs", "lib/**/*.js", /* TypeScript. Should match includes in tsconfig.ts.json. */ From d8c371039582afcc99d26804991427943128632c Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 24 Feb 2024 12:25:04 +1300 Subject: [PATCH 19/26] Update tests and instructions for script name change --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- .github/workflows/tests.yml | 4 ++-- CONTRIBUTING.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1323b94ff..b901673ae 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,9 +6,9 @@ and can be deleted. Please submit pull requests against the develop branch. -Follow the existing code style. Check the tests succeed, including lint. +Follow the existing code style. Check the tests succeed, including format and lint. npm run test - npm run lint + npm run check Don't update the CHANGELOG or command version number. That gets done by maintainers when preparing the release. diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f836193d..1f0195d87 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,5 +27,5 @@ jobs: run: npm ci - name: npm test run: npm test - - name: npm run lint - run: npm run lint + - name: npm run check + run: npm run check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f11d40397..e00e59ac1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,10 +14,10 @@ or after six months otherwise. Pull Requests will be considered. Please submit pull requests against the develop branch. -Follow the existing code style. Check the tests succeed, including lint. +Follow the existing code style. Check the tests succeed, including format and lint. - `npm run test` -- `npm run lint` +- `npm run check` Don't update the CHANGELOG or command version number. That gets done by maintainers when preparing the release. From 57e7cad6b60af34db0542b6da5f8fa97b49e39e7 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 24 Feb 2024 14:23:40 +1300 Subject: [PATCH 20/26] Update comment --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 4d13fa8a2..09c111f92 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -18,7 +18,7 @@ const tseslintConfigs = tseslint.config( ...tseslint.configs.recommended, ], rules: { - '@typescript-eslint/no-var-requires': 'off', // otherwise complains about require (tseslint defaults to sourceType:'module' ) + '@typescript-eslint/no-var-requires': 'off', // (tseslint does not autodetect commonjs context ) }, }, { files: tsconfigTsFiles, From 87c64a5abaa21ed5fadc7475463d831a1d000a38 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 1 Mar 2024 17:13:13 +1300 Subject: [PATCH 21/26] Add explicit (missing) @example --- lib/command.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/command.js b/lib/command.js index 93ae70d46..f896cdc7a 100644 --- a/lib/command.js +++ b/lib/command.js @@ -362,6 +362,7 @@ class Command extends EventEmitter { /** * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * + * @example * program.helpCommand('help [cmd]'); * program.helpCommand('help [cmd]', 'show help'); * program.helpCommand(false); // suppress default help command From b47d056e9b121fa0af633baeddc1d1ab8085af0b Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 1 Mar 2024 18:21:07 +1300 Subject: [PATCH 22/26] Using comments in tsconfig*.json so be explicit that they are jsonc for Prettier --- .prettierrc.js | 8 +++++++- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index 345f13d79..30eb528d1 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,6 +1,12 @@ const config = { - "plugins": ["prettier-plugin-jsdoc"], + plugins: ['prettier-plugin-jsdoc'], singleQuote: true, + overrides: [ + { + files: ['tsconfig*.json'], + options: { parser: 'jsonc' }, + }, + ], }; module.exports = config; diff --git a/package-lock.json b/package-lock.json index 47ff52669..6a1a48b81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "eslint-plugin-jsdoc": "^48.1.0", "globals": "^13.24.0", "jest": "^29.3.1", - "prettier": "^3.1.1", + "prettier": "^3.2.5", "prettier-plugin-jsdoc": "^1.3.0", "ts-jest": "^29.0.3", "tsd": "^0.30.4", @@ -5237,9 +5237,9 @@ } }, "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 48027f81e..c8503d6cd 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "eslint-plugin-jsdoc": "^48.1.0", "globals": "^13.24.0", "jest": "^29.3.1", - "prettier": "^3.1.1", + "prettier": "^3.2.5", "prettier-plugin-jsdoc": "^1.3.0", "ts-jest": "^29.0.3", "tsd": "^0.30.4", From a36df74ff8a889a465ea06469f7af192744bdfc2 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 8 Mar 2024 12:41:27 +1300 Subject: [PATCH 23/26] Activate all the checks --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index c8503d6cd..106760ae1 100644 --- a/package.json +++ b/package.json @@ -19,18 +19,18 @@ "url": "git+https://github.com/tj/commander.js.git" }, "scripts": { - "check": "npm run check:lint", + "check": "npm run check:type && npm run check:lint && npm run check:format", "check:format": "prettier --check .", "check:lint": "eslint .", - "fix": "npm run fix:lint", + "check:type": "npm run check:type:js && npm run check:type:ts", + "check:type:ts": "tsd && tsc -p tsconfig.ts.json", + "check:type:js": "tsc -p tsconfig.js.json", + "fix": "npm run fix:lint && npm run fix:format", "fix:format": "prettier --write .", "fix:lint": "eslint --fix .", - "test": "jest && npm run typecheck:ts", - "test-all": "jest && npm run test-esm && npm run check && npm run typecheck", - "test-esm": "node ./tests/esm-imports-test.mjs", - "typecheck": "npm run typecheck:ts && npm run typecheck:js", - "typecheck:ts": "tsd && tsc -p tsconfig.ts.json", - "typecheck:js": "tsc -p tsconfig.js.json" + "test": "jest && npm run check:type:ts", + "test-all": "jest && npm run test-esm && npm run check", + "test-esm": "node ./tests/esm-imports-test.mjs" }, "files": [ "index.js", From 487620e32c54f3cf9ad9201fc7be898db1a599b1 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 8 Mar 2024 12:53:26 +1300 Subject: [PATCH 24/26] Do not run format checks yet --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f0195d87..5c70079b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,5 +27,6 @@ jobs: run: npm ci - name: npm test run: npm test - - name: npm run check - run: npm run check + - name: npm run check:lint + # switch to full check when have run prettier on all files + run: npm run check:lint From 18eb11b9e0476c7c069a3bd17109d44c6c02c661 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 8 Mar 2024 13:06:25 +1300 Subject: [PATCH 25/26] Turn on eslint-config-prettier --- eslint.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 09c111f92..ef0c187dd 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,7 +2,7 @@ const globals = require('globals'); const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); const tseslint = require('typescript-eslint'); -//const prettier = require('eslint-config-prettier'); +const prettier = require('eslint-config-prettier'); //const jsdoc = require('eslint-plugin-jsdoc'); // Using tseslint config helper to customise its setup the tseslint way. @@ -36,7 +36,7 @@ module.exports = [ // jsdoc.configs['flat/recommended'], jest.configs['flat/recommended'], ...tseslintConfigs, - // prettier, // Do Prettier last so it can override previous configs. + prettier, // Do Prettier last so it can override previous configs. // Customise rules. { From 552eb26425a3792dd012727ad5c3294b3da28fa4 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 8 Mar 2024 15:28:46 +1300 Subject: [PATCH 26/26] Reformat files with Prettier --- eslint.config.js | 28 +- esm.mjs | 2 +- examples/action-this.js | 2 +- examples/arguments-extra.js | 15 +- examples/configure-help.js | 12 +- examples/configure-output.js | 20 +- examples/custom-command-class.js | 8 +- examples/custom-help | 10 +- examples/custom-help-text.js | 7 +- examples/deploy | 16 +- examples/global-options-added.js | 6 +- examples/global-options-nested.js | 6 +- examples/help-subcommands-usage.js | 15 +- examples/hook.js | 17 +- examples/nestedCommands.js | 32 +- examples/options-boolean-or-value.js | 3 +- examples/options-conflicts.js | 46 +- examples/options-custom-processing.js | 10 +- examples/options-defaults.js | 7 +- examples/options-env.js | 22 +- examples/options-extra.js | 31 +- examples/options-implies.js | 19 +- examples/options-negatable.js | 3 +- examples/options-required.js | 3 +- examples/pizza | 4 +- examples/pm | 10 +- examples/pm-install | 5 +- examples/positional-options.js | 4 +- examples/split.js | 4 +- examples/string-util.js | 6 +- index.js | 4 +- jest.config.js | 6 +- lib/argument.js | 47 +- lib/command.js | 988 +++++++++++------- lib/error.js | 17 +- lib/help.js | 169 ++- lib/option.js | 122 ++- lib/suggestSimilar.js | 9 +- tests/args.variadic.test.js | 27 +- tests/argument.chain.test.js | 2 +- tests/argument.choices.test.js | 8 +- tests/argument.custom-processing.test.js | 64 +- tests/argument.variadic.test.js | 36 +- tests/command.action.test.js | 143 +-- tests/command.addCommand.test.js | 7 +- tests/command.addHelpOption.test.js | 19 +- tests/command.addHelpText.test.js | 53 +- tests/command.alias.test.js | 37 +- tests/command.allowExcessArguments.test.js | 233 ++--- tests/command.allowUnknownOption.test.js | 12 +- tests/command.argumentVariations.test.js | 169 +-- tests/command.asterisk.test.js | 64 +- tests/command.chain.test.js | 8 +- tests/command.commandHelp.test.js | 6 +- tests/command.configureHelp.test.js | 14 +- tests/command.configureOutput.test.js | 126 ++- tests/command.default.test.js | 15 +- tests/command.error.test.js | 21 +- ...mmand.executableSubcommand.inspect.test.js | 58 +- ...ommand.executableSubcommand.lookup.test.js | 52 +- .../command.executableSubcommand.mock.test.js | 18 +- ...ommand.executableSubcommand.search.test.js | 140 ++- ...mmand.executableSubcommand.signals.test.js | 52 +- tests/command.executableSubcommand.test.js | 8 +- tests/command.exitOverride.test.js | 185 +++- tests/command.help.test.js | 139 +-- tests/command.helpCommand.test.js | 41 +- tests/command.helpOption.test.js | 51 +- tests/command.hook.test.js | 184 ++-- tests/command.name.test.js | 7 +- tests/command.nested.test.js | 5 +- tests/command.onCommand.test.js | 11 +- tests/command.option-misuse.test.js | 3 +- tests/command.parse.test.js | 14 +- tests/command.parseOptions.test.js | 47 +- tests/command.positionalOptions.test.js | 128 ++- tests/command.showHelpAfterError.test.js | 7 +- .../command.showSuggestionAfterError.test.js | 14 +- tests/command.unknownCommand.test.js | 27 +- tests/command.unknownOption.test.js | 10 +- tests/command.usage.test.js | 27 +- tests/commander.configureCommand.test.js | 25 +- tests/deprecated.test.js | 9 +- tests/esm-imports-test.mjs | 14 +- tests/fixtures/inspect.js | 4 +- tests/fixtures/pm | 41 +- tests/fixtures/pm-listen | 12 +- tests/help.argumentDescription.test.js | 21 +- tests/help.commandTerm.test.js | 13 +- tests/help.commandUsage.test.js | 14 +- tests/help.longestArgumentTermLength.test.js | 8 +- tests/help.longestCommandTermLength.test.js | 27 +- tests/help.longestOptionTermLength.test.js | 8 +- tests/help.optionDescription.test.js | 29 +- tests/help.padWidth.test.js | 24 +- tests/help.showGlobalOptions.test.js | 22 +- tests/help.sortCommands.test.js | 8 +- tests/help.sortOptions.test.js | 24 +- tests/help.suggestion.test.js | 99 +- tests/help.visibleArguments.test.js | 20 +- tests/help.visibleCommands.test.js | 14 +- tests/help.visibleGlobalOptions.test.js | 30 +- tests/help.visibleOptions.test.js | 12 +- tests/help.wrap.test.js | 46 +- tests/incrementNodeInspectorPort.test.js | 6 +- tests/option.chain.test.js | 2 +- tests/options.bool.combo.test.js | 6 +- tests/options.bool.test.js | 40 +- tests/options.camelcase.test.js | 18 +- tests/options.choices.test.js | 12 +- tests/options.conflicts.test.js | 72 +- tests/options.custom-processing.test.js | 52 +- tests/options.dual-options.test.js | 12 +- tests/options.env.test.js | 187 ++-- tests/options.flags.test.js | 30 +- tests/options.getset.test.js | 54 +- tests/options.implies.test.js | 35 +- tests/options.mandatory.test.js | 39 +- tests/options.optional.test.js | 25 +- tests/options.opts.test.js | 96 +- tests/options.optsWithGlobals.test.js | 29 +- tests/options.preset.test.js | 4 +- tests/options.registerClash.test.js | 9 +- tests/options.required.test.js | 18 +- tests/options.values.test.js | 18 +- tests/options.variadic.test.js | 59 +- tests/options.version.test.js | 15 +- tests/program.test.js | 5 +- tests/ts-imports.test.ts | 14 +- tsconfig.js.json | 7 +- tsconfig.json | 25 +- tsconfig.ts.json | 7 +- typings/index.d.ts | 669 ++++++------ typings/index.test-d.ts | 388 +++++-- 134 files changed, 3728 insertions(+), 2776 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index ef0c187dd..79a37bd19 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -14,20 +14,17 @@ const tseslintConfigs = tseslint.config( languageOptions: { parserOptions: { project: './tsconfig.js.json' }, }, - extends: [ - ...tseslint.configs.recommended, - ], + extends: [...tseslint.configs.recommended], rules: { '@typescript-eslint/no-var-requires': 'off', // (tseslint does not autodetect commonjs context ) }, - }, { + }, + { files: tsconfigTsFiles, languageOptions: { parserOptions: { project: './tsconfig.ts.json' }, }, - extends: [ - ...tseslint.configs.recommended, - ], + extends: [...tseslint.configs.recommended], }, ); @@ -59,17 +56,20 @@ module.exports = [ files: ['**/*.test.{js,mjs,cjs}'], rules: { 'no-unused-vars': 'off', // lots in tests, minimise churn for now - } + }, }, { files: [...tsconfigTsFiles, ...tsconfigJsFiles], rules: { - '@typescript-eslint/ban-ts-comment': ['error', { - 'ts-expect-error': 'allow-with-description', - 'ts-ignore': 'allow-with-description', - 'ts-nocheck': true, - 'ts-check': true, - }], + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': 'allow-with-description', + 'ts-nocheck': true, + 'ts-check': true, + }, + ], }, }, ]; diff --git a/esm.mjs b/esm.mjs index e7190a1b8..796ec3a58 100644 --- a/esm.mjs +++ b/esm.mjs @@ -12,5 +12,5 @@ export const { Command, Argument, Option, - Help + Help, } = commander; diff --git a/examples/action-this.js b/examples/action-this.js index 1ff286c4e..45c7efa3c 100644 --- a/examples/action-this.js +++ b/examples/action-this.js @@ -10,7 +10,7 @@ program .command('serve') .argument('