From 484713e3c56734aa65866ed7e32b7c854b952b7b Mon Sep 17 00:00:00 2001 From: dhmlau Date: Wed, 13 May 2026 16:17:41 -0400 Subject: [PATCH] chore: upgrade eslint to v10 Signed-off-by: dhmlau --- eslint.config.js | 87 ++++++++++ package-lock.json | 274 ++++++++++++++---------------- package.json | 6 +- src/base.js | 2 +- src/client.js | 4 +- src/parser/element.js | 2 +- src/parser/nscontext.js | 2 +- src/parser/soap/fault.js | 2 +- src/parser/soap12/fault.js | 2 +- src/parser/wsdl.js | 6 +- src/parser/wsdl/binding.js | 2 +- src/parser/wsdl/part.js | 2 +- src/parser/wsdl/portType.js | 2 +- src/parser/wsdl/types.js | 2 +- src/parser/xmlHandler.js | 26 +-- src/parser/xsd/attributeGroup.js | 2 +- src/parser/xsd/complexType.js | 2 +- src/security/BasicAuthSecurity.js | 2 +- src/security/ClientSSLSecurity.js | 2 +- src/security/WSSecurity.js | 6 +- src/security/WSSecurityCert.js | 2 +- src/security/security.js | 2 +- src/server.js | 8 +- src/strip-bom.js | 6 +- test/client-attachment-test.js | 2 +- test/client-test.js | 4 +- test/security/WSSecurity.js | 28 +-- test/server-options-test.js | 10 +- test/wsdl-test.js | 2 +- test/xs-date-format-test.js | 12 +- 30 files changed, 293 insertions(+), 218 deletions(-) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..9736edec --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,87 @@ +// ESLint flat config for strong-soap +// Migrated from JSHint configuration + +module.exports = [ + { + ignores: [ + 'node_modules/**', + 'lib/**', + 'coverage/**', + '.nyc_output/**', + ], + }, + { + files: ['**/*.js'], + languageOptions: { + ecmaVersion: 2020, + sourceType: 'commonjs', + globals: { + // Node.js globals + console: 'readonly', + process: 'readonly', + Buffer: 'readonly', + __dirname: 'readonly', + __filename: 'readonly', + module: 'readonly', + require: 'readonly', + exports: 'writable', + global: 'readonly', + setTimeout: 'readonly', + setInterval: 'readonly', + clearTimeout: 'readonly', + clearInterval: 'readonly', + setImmediate: 'readonly', + clearImmediate: 'readonly', + crypto: 'readonly', + // Mocha test globals + describe: 'readonly', + it: 'readonly', + xit: 'readonly', + before: 'readonly', + beforeEach: 'readonly', + after: 'readonly', + afterEach: 'readonly', + // Test-specific globals + lastReqAddress: 'writable', + root: 'writable', + }, + }, + rules: { + // Core rules matching JSHint config + 'eqeqeq': 'off', // JSHint had this on, but codebase uses == extensively + 'no-undef': 'error', + 'no-unused-vars': ['warn', { args: 'none', varsIgnorePattern: '^_' }], + 'strict': 'off', // Relax strict mode requirement + 'no-trailing-spaces': 'warn', + 'no-bitwise': 'off', + 'curly': 'off', + 'camelcase': 'off', + + // Additional recommended rules + 'no-console': 'off', + 'no-debugger': 'warn', + 'no-constant-condition': 'warn', + 'no-empty': 'warn', + 'no-extra-semi': 'warn', + 'no-irregular-whitespace': 'error', + 'no-unreachable': 'warn', + 'valid-typeof': 'error', + + // Best practices + 'no-eval': 'error', + 'no-implied-eval': 'error', + 'no-with': 'error', + 'no-caller': 'error', + 'no-extend-native': 'error', + + // Style (relaxed to match existing codebase) + 'indent': 'off', // Too many violations, disable for now + 'quotes': 'off', + 'semi': 'off', + 'comma-dangle': 'off', + 'no-mixed-spaces-and-tabs': 'warn', + }, + }, +]; + +// Made with Bob diff --git a/package-lock.json b/package-lock.json index cd97444c..772f80e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "strong-soap", - "version": "5.0.9", + "version": "5.0.10", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -34,8 +34,7 @@ "diff": "^8.0.4", "doctoc": "^2.4.1", "duplexer": "^0.1.2", - "eslint": "^9.39.4", - "eslint-config-google": "^0.14.0", + "eslint": "^10.3.0", "express": "^5.2.1", "express-ntlm": "2.7.0", "glob": "^13.0.6", @@ -2048,129 +2047,107 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz", - "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==", + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^2.1.7", + "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", - "minimatch": "^3.1.5" + "minimatch": "^10.2.4" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/config-helpers": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", - "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "node_modules/@eslint/config-array/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0" - }, + "license": "MIT", "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "18 || 20 || >=22" } }, - "node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.15" + "balanced-match": "^4.0.2" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "18 || 20 || >=22" } }, - "node_modules/@eslint/eslintrc": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz", - "integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==", + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", "dev": true, - "license": "MIT", + "license": "BlueOak-1.0.0", "dependencies": { - "ajv": "^6.14.0", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.1", - "minimatch": "^3.1.5", - "strip-json-comments": "^3.1.1" + "brace-expansion": "^5.0.5" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "18 || 20 || >=22" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@eslint/eslintrc/node_modules/ajv": { - "version": "6.15.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", - "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "node_modules/@eslint/config-helpers": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.5.tgz", + "integrity": "sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==", "dev": true, - "license": "MIT", + "license": "Apache-2.0", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "@eslint/core": "^1.2.1" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@eslint/js": { - "version": "9.39.4", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz", - "integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==", + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" }, - "funding": { - "url": "https://eslint.org/donate" + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@eslint/object-schema": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", - "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", "dev": true, "license": "Apache-2.0", "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@eslint/plugin-kit": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", - "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.1.tgz", + "integrity": "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^0.17.0", + "@eslint/core": "^1.2.1", "levn": "^0.4.1" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@humanfs/core": { @@ -2573,6 +2550,13 @@ "unified": "^9.2.2" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", @@ -4125,33 +4109,30 @@ } }, "node_modules/eslint": { - "version": "9.39.4", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz", - "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.3.0.tgz", + "integrity": "sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.2", - "@eslint/config-helpers": "^0.4.2", - "@eslint/core": "^0.17.0", - "@eslint/eslintrc": "^3.3.5", - "@eslint/js": "9.39.4", - "@eslint/plugin-kit": "^0.4.1", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.5.5", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", - "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.4.0", - "eslint-visitor-keys": "^4.2.1", - "espree": "^10.4.0", - "esquery": "^1.5.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", @@ -4161,8 +4142,7 @@ "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.5", + "minimatch": "^10.2.4", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, @@ -4170,7 +4150,7 @@ "eslint": "bin/eslint.js" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://eslint.org/donate" @@ -4184,44 +4164,33 @@ } } }, - "node_modules/eslint-config-google": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz", - "integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "eslint": ">=5.16.0" - } - }, "node_modules/eslint-scope": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", "dev": true, "license": "Apache-2.0", "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -4244,6 +4213,29 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/eslint/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -4264,19 +4256,35 @@ "dev": true, "license": "MIT" }, + "node_modules/eslint/node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/espree": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.15.0", + "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.1" + "eslint-visitor-keys": "^5.0.1" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -5046,19 +5054,6 @@ "cldrjs": "^0.5.4" } }, - "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -6170,13 +6165,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", diff --git a/package.json b/package.json index b9c91982..fc2418c1 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "prepublishOnly": "pinst --disable && npm run build", "postpublish": "pinst --enable", "toc": "doctoc Readme.md --github --maxlevel 3", - "_pretest": "jshint index.js lib test", + "lint": "eslint .", + "pretest": "npm run lint", "test": "nyc --reporter=lcov mocha --exit --timeout 60000 test/*-test.js test/security/*.js" }, "keywords": [ @@ -51,8 +52,7 @@ "diff": "^8.0.4", "doctoc": "^2.4.1", "duplexer": "^0.1.2", - "eslint": "^9.39.4", - "eslint-config-google": "^0.14.0", + "eslint": "^10.3.0", "express": "^5.2.1", "express-ntlm": "2.7.0", "glob": "^13.0.6", diff --git a/src/base.js b/src/base.js index 7c04d316..1e6ef8e3 100644 --- a/src/base.js +++ b/src/base.js @@ -10,7 +10,7 @@ var NamespaceContext = require('./parser/nscontext'); var SOAPElement = require('./soapModel').SOAPElement; var xmlBuilder = require('xmlbuilder'); var XMLHandler = require('./parser/xmlHandler'); - + class Base extends EventEmitter { constructor(wsdl, options) { super(); diff --git a/src/client.js b/src/client.js index beecdd42..3a292fee 100644 --- a/src/client.js +++ b/src/client.js @@ -174,13 +174,13 @@ class Client extends Base { } // Clear and Add new SOAP Headers - if (!_.isEmpty(dynamicSoapHeaders)) { + if (!_.isEmpty(dynamicSoapHeaders)) { this.clearSoapHeaders(); for (var attr in dynamicSoapHeaders) { this.addSoapHeader(dynamicSoapHeaders[attr]); } } - + debug('client request. headers: %j', headers); //Unlike other security objects, NTLMSecurity is passed in through client options rather than client.setSecurity(ntlmSecurity) as some diff --git a/src/parser/element.js b/src/parser/element.js index 6e472b0b..db1433fd 100644 --- a/src/parser/element.js +++ b/src/parser/element.js @@ -90,7 +90,7 @@ class Element { this.constructor.allowedChildren.indexOf('any') === -1) { debug('Element %s is not allowed within %j', qname, this.nsName); } - + if (ElementType) { child = new ElementType(nsName, attrs, options); child.nsURI = qname.nsURI; diff --git a/src/parser/nscontext.js b/src/parser/nscontext.js index 305f2f4a..251ae1f0 100644 --- a/src/parser/nscontext.js +++ b/src/parser/nscontext.js @@ -297,7 +297,7 @@ class NamespaceContext { this.currentScope.namespaces[mapping.prefix] = mapping; } return mapping; - }; + } } module.exports = NamespaceContext; diff --git a/src/parser/soap/fault.js b/src/parser/soap/fault.js index a621f03d..c2fca850 100644 --- a/src/parser/soap/fault.js +++ b/src/parser/soap/fault.js @@ -9,7 +9,7 @@ var SOAPElement = require('./soapElement'); var helper = require('../helper'); /** - * */ class Fault extends SOAPElement { diff --git a/src/parser/soap12/fault.js b/src/parser/soap12/fault.js index 07e4dbd3..ad7724b1 100644 --- a/src/parser/soap12/fault.js +++ b/src/parser/soap12/fault.js @@ -9,7 +9,7 @@ var SOAPElement = require('./soapElement'); var helper = require('../helper'); /** - * */ class Fault extends SOAPElement { diff --git a/src/parser/wsdl.js b/src/parser/wsdl.js index a78f2240..60c63995 100644 --- a/src/parser/wsdl.js +++ b/src/parser/wsdl.js @@ -169,7 +169,7 @@ class WSDL { if (options.httpClient) { this.options.httpClient = options.httpClient; } - + if (options.request) { this.options.request = options.request; } @@ -357,7 +357,7 @@ class WSDL { p.write(xml).close(); return root; - }; + } _fromXML(xml) { this.definitions = this._parse(xml); @@ -392,7 +392,7 @@ class WSDL { str += ' xmlns:' + prefix + '="' + ns + '"'; } return str; - }; + } /* * Have another function to load previous WSDLs as we diff --git a/src/parser/wsdl/binding.js b/src/parser/wsdl/binding.js index 935c82da..e1943d0e 100644 --- a/src/parser/wsdl/binding.js +++ b/src/parser/wsdl/binding.js @@ -80,7 +80,7 @@ class Binding extends WSDLElement { operations[name] = operation.describe(definitions); } return operations; - }; + } } Binding.elementName = 'binding'; diff --git a/src/parser/wsdl/part.js b/src/parser/wsdl/part.js index 01fd7838..44b71995 100644 --- a/src/parser/wsdl/part.js +++ b/src/parser/wsdl/part.js @@ -11,7 +11,7 @@ class Part extends WSDLElement { constructor(nsName, attrs, options) { super(nsName, attrs, options); } - + postProcess(definitions) { if (this.$element) { this.element = this.resolveSchemaObject( diff --git a/src/parser/wsdl/portType.js b/src/parser/wsdl/portType.js index 49b18a96..e8a5a8ea 100644 --- a/src/parser/wsdl/portType.js +++ b/src/parser/wsdl/portType.js @@ -33,7 +33,7 @@ class PortType extends WSDLElement { operations[name] = method.describe(definitions); } return operations; - }; + } } PortType.elementName = 'portType'; diff --git a/src/parser/wsdl/types.js b/src/parser/wsdl/types.js index fb2db3ad..453ee2bd 100644 --- a/src/parser/wsdl/types.js +++ b/src/parser/wsdl/types.js @@ -31,7 +31,7 @@ class Types extends WSDLElement { this.schemas[targetNamespace].merge(child, true); } } - }; + } } Types.elementName = 'types'; diff --git a/src/parser/xmlHandler.js b/src/parser/xmlHandler.js index 2a2e7044..5ed4ae20 100644 --- a/src/parser/xmlHandler.js +++ b/src/parser/xmlHandler.js @@ -22,7 +22,7 @@ var NamespaceContext = require('./nscontext'); class XMLHandler { /** - * @param {Object} [schemas] + * @param {Object} [schemas] * @param {Object} [options] * @param {boolean} [options.enforceRestrictions] * @param {string} [options.valueKey] @@ -864,7 +864,7 @@ function parseValue(text, descriptor) { var jsType = descriptor && descriptor.jsType; if (jsType === Date) { var dateText = text; - // Checks for xs:date with tz, drops the tz + // Checks for xs:date with tz, drops the tz // because xs:date doesn't have a time to offset // and JS Date object doesn't store an arbitrary tz if(dateText.length === 16){ @@ -884,12 +884,12 @@ function parseValue(text, descriptor) { } /** - * - * @param {string | Date} date - * @param {Object} [options] + * + * @param {string | Date} date + * @param {Object} [options] * @param {Object} [options.timezone] * @param {boolean} [options.timezone.enabled] - * @returns + * @returns */ function toXmlDate(date, options) { try { @@ -899,7 +899,7 @@ function toXmlDate(date, options) { if (!withTimezone) { return formattedDate; } - return formattedDate + 'Z'; + return formattedDate + 'Z'; } catch (err) { return date; } @@ -908,7 +908,7 @@ function toXmlDate(date, options) { function toXmlTime(date) { try { const isoStr = new Date(date).toISOString(); - return isoStr.split('T')[1]; + return isoStr.split('T')[1]; } catch (err) { return date; } @@ -916,16 +916,16 @@ function toXmlTime(date) { function toXmlDateTime(date) { try { - return new Date(date).toISOString(); + return new Date(date).toISOString(); } catch (err) { - return date; + return date; } } /** - * - * @param {object} descriptor - * @param {* | null} val + * + * @param {object} descriptor + * @param {* | null} val * @param {Object} options * @param {Object} options.timezone * @param {boolean} options.timezone.enabled diff --git a/src/parser/xsd/attributeGroup.js b/src/parser/xsd/attributeGroup.js index c5df943b..71caeeea 100644 --- a/src/parser/xsd/attributeGroup.js +++ b/src/parser/xsd/attributeGroup.js @@ -11,7 +11,7 @@ class AttributeGroup extends XSDElement { constructor(nsName, attrs, options) { super(nsName, attrs, options); } - + resolve(schemas) { if (this.$ref) { this.ref = this.resolveSchemaObject(schemas, 'attributeGroup', this.$ref); diff --git a/src/parser/xsd/complexType.js b/src/parser/xsd/complexType.js index 02514b9e..26341136 100644 --- a/src/parser/xsd/complexType.js +++ b/src/parser/xsd/complexType.js @@ -64,7 +64,7 @@ class ComplexType extends XSDElement { } } } - } + } } } } diff --git a/src/security/BasicAuthSecurity.js b/src/security/BasicAuthSecurity.js index 8c942e7f..fdcb8924 100644 --- a/src/security/BasicAuthSecurity.js +++ b/src/security/BasicAuthSecurity.js @@ -19,7 +19,7 @@ class BasicAuthSecurity extends Security { var cred = Buffer.from((this.username + ':' + this.password) || '') .toString('base64'); headers.Authorization = 'Basic ' + cred; - }; + } } module.exports = BasicAuthSecurity; diff --git a/src/security/ClientSSLSecurity.js b/src/security/ClientSSLSecurity.js index 09f61cb6..8f3bcf7d 100644 --- a/src/security/ClientSSLSecurity.js +++ b/src/security/ClientSSLSecurity.js @@ -63,7 +63,7 @@ class ClientSSLSecurity extends Security { options.ca = this.ca; _.merge(options, this.options); options.agent = new https.Agent(options); - }; + } } module.exports = ClientSSLSecurity; diff --git a/src/security/WSSecurity.js b/src/security/WSSecurity.js index bd711745..9584428e 100644 --- a/src/security/WSSecurity.js +++ b/src/security/WSSecurity.js @@ -17,9 +17,9 @@ class WSSecurity extends Security { super(options); this._username = username; this._password = password; - //must account for backward compatibility for passwordType String param as - // well as object options defaults: passwordType = 'PasswordText', - // hasTimeStamp = true + //must account for backward compatibility for passwordType String param as + // well as object options defaults: passwordType = 'PasswordText', + // hasTimeStamp = true if (typeof options === 'string') { this._passwordType = options ? options : 'PasswordText'; options = {}; diff --git a/src/security/WSSecurityCert.js b/src/security/WSSecurityCert.js index 608858b3..9c726aa6 100644 --- a/src/security/WSSecurityCert.js +++ b/src/security/WSSecurityCert.js @@ -41,7 +41,7 @@ function generateId() { class WSSecurityCert extends Security { constructor(privatePEM, publicP12PEM, password) { super(); - + this.publicP12PEM = publicP12PEM.toString() .replace('-----BEGIN CERTIFICATE-----', '') .replace('-----END CERTIFICATE-----', '') diff --git a/src/security/security.js b/src/security/security.js index c037b3f0..2f4c9522 100644 --- a/src/security/security.js +++ b/src/security/security.js @@ -17,7 +17,7 @@ class Security { addOptions(options) { _.merge(options, this.options); - }; + } addHttpHeaders(headers) { } diff --git a/src/server.js b/src/server.js index 38f0db1b..e9b12a4a 100644 --- a/src/server.js +++ b/src/server.js @@ -135,7 +135,7 @@ class Server extends Base { else { res.end(); } - }; + } _process(input, req, callback) { var self = this, @@ -260,7 +260,7 @@ class Server extends Base { //Revisit - is this needed? throw error; } - }; + } _executeMethod(options, req, callback) { options = options || {}; @@ -345,7 +345,7 @@ class Server extends Base { if (typeof result !== 'undefined') { handleResult(null, result); } - }; + } _addWSSecurityHeader(headerElement) { var secElement = headerElement.element('wsse:Security') @@ -381,7 +381,7 @@ class Server extends Base { //add soapHeaders to envelope. Header can be xml, or JSON object which may or may not be described in WSDL/XSD. this.addSoapHeadersToEnvelope(soapHeaderElement, this.xmlHandler); return env; - }; + } _sendError(operation, error, callback, includeTimestamp) { var self = this, diff --git a/src/strip-bom.js b/src/strip-bom.js index bfe770bd..2d782772 100644 --- a/src/strip-bom.js +++ b/src/strip-bom.js @@ -4,9 +4,9 @@ // License text available at https://opensource.org/licenses/MIT /* -strip the BOM characters in the beginning of UTF-8 +strip the BOM characters in the beginning of UTF-8 or other unicode encoded strings -http://en.wikipedia.org/wiki/Byte_order_mark +http://en.wikipedia.org/wiki/Byte_order_mark */ 'use strict'; module.exports = stripBom; @@ -29,4 +29,4 @@ function stripBom(str){ value = transformed.toString(); } return value; -}; +} diff --git a/test/client-attachment-test.js b/test/client-attachment-test.js index 446716a8..123ed091 100644 --- a/test/client-attachment-test.js +++ b/test/client-attachment-test.js @@ -19,7 +19,7 @@ describe('SOAP Http attachment', function() { it('attachment length 1', function(done){ var httpClient = new http({}) const optionEx = { - attachments:[{ + attachments:[{ name: 'teste', contentId: '123445555', mimetype: 'jpeg', diff --git a/test/client-test.js b/test/client-test.js index 7538e029..42ac0678 100644 --- a/test/client-test.js +++ b/test/client-test.js @@ -339,7 +339,7 @@ describe('SOAP Client', function() { 'EventEmitter': true, 'Promise': true } - }; + }; var lastRequest = "\n\n \n" + " false\n true\n true\n true\n true\n \n true\n true\n \n" + " \n \n"; @@ -367,7 +367,7 @@ describe('SOAP Client', function() { 'EventEmitter': true, 'Promise': true } - }; + }; var lastRequest = "\n\n \n" + " false\n true\n true\n true\n true\n \n true\n true\n \n" + " \n \n"; diff --git a/test/security/WSSecurity.js b/test/security/WSSecurity.js index 4e351d7e..62995ef0 100644 --- a/test/security/WSSecurity.js +++ b/test/security/WSSecurity.js @@ -94,32 +94,32 @@ describe('WSSecurity', function () { xml.should.containEql(''); }); - + it('test WSSecurity digest against SoapUI 5.4 output', function () { var username = 'myUser'; var password = 'myPass'; var created = ''; var nonce = ''; var digest = ''; - + /** * example passwordDigest created using SoapUI version 5.4.0 * UsernameToken generated by SoapUI with given username/password: - + myUser yangN8zaHDO1j9wLGjwzWTaY/6o= hdk9vWPwQ37Y5O2hICiOgQ== 2017-12-12T18:17:39.348Z - + */ created = '2017-12-12T18:17:39.348Z'; nonce = 'hdk9vWPwQ37Y5O2hICiOgQ==' digest = 'yangN8zaHDO1j9wLGjwzWTaY/6o=' - + passwordDigest(nonce, created, password).should.containEql(digest); - + }); @@ -129,30 +129,30 @@ describe('WSSecurity', function () { var created = ''; var nonce = ''; var digest = ''; - + /** * example passwordDigest created using Boomerang 3.4.1 * UsernameToken generated by boomerang with given username/password: https://chrome.google.com/webstore/detail/boomerang-soap-rest-clien/eipdnjedkpcnlmmdfdkgfpljanehloah/reviews - + myUser 5gHmXk5jplZPkcFFkvp0MBowUbg= MTUxMzEwNDAyNDEwODAwMA== 2017-12-12T18:40:24.108Z - + */ created = '2017-12-12T18:40:24.108Z'; nonce = 'MTUxMzEwNDAyNDEwODAwMA==' digest = '5gHmXk5jplZPkcFFkvp0MBowUbg=' - + passwordDigest(nonce, created, password).should.containEql(digest); - + }); - - + + it('Original WSSecurity digest method failing against SoapUI 5.4 output', function () { var username = 'myUser'; var password = 'myPass'; @@ -163,7 +163,7 @@ describe('WSSecurity', function () { /** * example passwordDigest created using SoapUI version 5.4.0 * UsernameToken generated by SoapUI with given username/password: - + myUser yangN8zaHDO1j9wLGjwzWTaY/6o= diff --git a/test/server-options-test.js b/test/server-options-test.js index 28bfc3a9..b158af81 100644 --- a/test/server-options-test.js +++ b/test/server-options-test.js @@ -159,8 +159,8 @@ describe('SOAP Server with Options', function() { }); }); }); - - + + it('should return correct stock price in response body', function(done) { var responseData = '\n\n \n \n \n 19.56\n \n \n'; test.server.listen(15099, null, null, function() { @@ -178,7 +178,7 @@ describe('SOAP Server with Options', function() { if (test.server.address().address === '0.0.0.0' || test.server.address().address === '::') { test.baseUrl = 'http://127.0.0.1:' + test.server.address().port; } - + soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) { assert.ok(!err); client.GetLastTradePrice({TradePriceRequest: { tickerSymbol: 'ACME' }}, function(err, response, body) { @@ -239,7 +239,7 @@ describe('SOAP Server with Options', function() { if (test.server.address().address === '0.0.0.0' || test.server.address().address === '::') { test.baseUrl = 'http://127.0.0.1:' + test.server.address().port; } - + soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) { assert.ok(!err); client.GetLastTradePrice({ tickerSymbol: 'xml response' }, function(err, response, body) { @@ -250,5 +250,5 @@ describe('SOAP Server with Options', function() { }); }); }); - + }); diff --git a/test/wsdl-test.js b/test/wsdl-test.js index 57a138b5..60649583 100644 --- a/test/wsdl-test.js +++ b/test/wsdl-test.js @@ -198,7 +198,7 @@ describe('wsdl-tests', function() { ) { var operation = def.definitions.bindings.RestrictionsBinding.operations.TestRestrictions; var operationDesc = operation.describe(def); - + var requestElements = operationDesc.input.body.elements[0].elements; // second element in the operation request is an element with anonymous type diff --git a/test/xs-date-format-test.js b/test/xs-date-format-test.js index 2b89b160..93d89391 100644 --- a/test/xs-date-format-test.js +++ b/test/xs-date-format-test.js @@ -20,25 +20,25 @@ describe('xs-date-format-tests', function() { var parsed = xmlHandler.parseValue(inputDate, {jsType: Date}); assert.equal(parsed.toISOString(), new Date('2019-03-27').toISOString(), 'expected parsed date'); }); - + it('parses a xs:date string with Z at the end', function () { var inputDate = '2019-03-27Z'; var parsed = xmlHandler.parseValue(inputDate, {jsType: Date}); assert.equal(parsed.toISOString(), new Date(inputDate).toISOString(), 'expected parsed date'); }); - + it('parses a xs:date string without tz', function () { var inputDate = '2019-03-27'; var parsed = xmlHandler.parseValue(inputDate, {jsType: Date}); assert.equal(parsed.toISOString(), new Date(inputDate).toISOString(), 'expected parsed date'); }); - + it('parses a xs:dateTime string with tz', function () { var inputDate = '2019-03-27T01:01:01-03:00'; var parsed = xmlHandler.parseValue(inputDate, {jsType: Date}); assert.equal(parsed.toISOString(), new Date(inputDate).toISOString(), 'expected parsed date'); }); - + it('parses a xs:dateTime string without tz', function () { var inputDate = '2019-03-27T01:01:01'; var parsed = xmlHandler.parseValue(inputDate, {jsType: Date}); @@ -98,11 +98,11 @@ describe('xs-date-format-tests', function() { var xmlDateTime = xmlHandler.toXmlDateTime(inputDateStr); assert.equal(xmlDateTime, '2019-03-27T04:01:01.000Z'); }); - + it('returns invalid date string as is', function () { var xmlDateTime = xmlHandler.toXmlDateTime('23091990'); assert.equal(xmlDateTime, '23091990'); }); }); - + });