diff --git a/package-lock.json b/package-lock.json index c349ea9..4dc76f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.7.6", "license": "MIT", "dependencies": { - "@hyper-tuner/types": "^0.4.2", + "@hyper-tuner/types": "git+https://github.com/hyper-tuner/types.git", "js-yaml": "^4.1.0", "parsimmon": "^1.18.1" }, @@ -18,22 +18,21 @@ }, "devDependencies": { "@types/js-yaml": "^4.0.5", - "@types/node": "^18.14.4", + "@types/node": "^20.6.0", "@types/parsimmon": "^1.10.6", - "rome": "^11.0.0", - "typescript": "^4.9.5" + "rome": "^12.1.3", + "typescript": "^5.2.2" } }, "node_modules/@hyper-tuner/types": { "version": "0.4.2", - "resolved": "https://npm.pkg.github.com/download/@hyper-tuner/types/0.4.2/05d62b0f9d876b4ba411c892e27af41ae097abb9", - "integrity": "sha512-jHspEqVLBufTPbkf3rZx+xm4w4U6D8CxZ1ZKad/sP2c+7QW7LbsXbLeVmGQNVEEUg178GjtQ/+g6HZx1XbYIOA==", + "resolved": "git+ssh://git@github.com/hyper-tuner/types.git#ce82322cf79b1a4c569723932b06f514a53a2e09", "license": "MIT" }, "node_modules/@rometools/cli-darwin-arm64": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rometools/cli-darwin-arm64/-/cli-darwin-arm64-11.0.0.tgz", - "integrity": "sha512-F3vkdY+s3FLIEnAjSbyHTuIPB88cLpccimW4ecid5I7S6GzGG3iUJI4xT00JhH73K4P/qW20/9r+kH1T9Du8Xg==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-darwin-arm64/-/cli-darwin-arm64-12.1.3.tgz", + "integrity": "sha512-AmFTUDYjBuEGQp/Wwps+2cqUr+qhR7gyXAUnkL5psCuNCz3807TrUq/ecOoct5MIavGJTH6R4aaSL6+f+VlBEg==", "cpu": [ "arm64" ], @@ -44,9 +43,9 @@ ] }, "node_modules/@rometools/cli-darwin-x64": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rometools/cli-darwin-x64/-/cli-darwin-x64-11.0.0.tgz", - "integrity": "sha512-X6jhtS6Iml4GOzgNtnLwIp/KXXhSdqeVyfv69m/AHnIzx3gQAjPZ7BPnJLvTCbhe4SKHL+uTZYFSCJpkUUKE6w==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-darwin-x64/-/cli-darwin-x64-12.1.3.tgz", + "integrity": "sha512-k8MbWna8q4LRlb005N2X+JS1UQ+s3ZLBBvwk4fP8TBxlAJXUz17jLLu/Fi+7DTTEmMhM84TWj4FDKW+rNar28g==", "cpu": [ "x64" ], @@ -57,9 +56,9 @@ ] }, "node_modules/@rometools/cli-linux-arm64": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rometools/cli-linux-arm64/-/cli-linux-arm64-11.0.0.tgz", - "integrity": "sha512-dktTJJlTpmycBZ2TwhJBcAO8ztK8DdevdyZnFFxdYRvtmJgTjIsC2UFayf/SbKew8B8q1IhI0it+D6ihAeIpeg==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-linux-arm64/-/cli-linux-arm64-12.1.3.tgz", + "integrity": "sha512-X/uLhJ2/FNA3nu5TiyeNPqiD3OZoFfNfRvw6a3ut0jEREPvEn72NI7WPijH/gxSz55znfQ7UQ6iM4DZumUknJg==", "cpu": [ "arm64" ], @@ -70,9 +69,9 @@ ] }, "node_modules/@rometools/cli-linux-x64": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rometools/cli-linux-x64/-/cli-linux-x64-11.0.0.tgz", - "integrity": "sha512-WVcnXPNdWGUWo0p4NU8YzuthjYR7q+b4vRcjdxtP1DlpphZmSsoC/RSE85nEqRAz8hChcKUansVzOPM8BSsuGA==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-linux-x64/-/cli-linux-x64-12.1.3.tgz", + "integrity": "sha512-csP17q1eWiUXx9z6Jr/JJPibkplyKIwiWPYNzvPCGE8pHlKhwZj3YHRuu7Dm/4EOqx0XFIuqqWZUYm9bkIC8xg==", "cpu": [ "x64" ], @@ -83,9 +82,9 @@ ] }, "node_modules/@rometools/cli-win32-arm64": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rometools/cli-win32-arm64/-/cli-win32-arm64-11.0.0.tgz", - "integrity": "sha512-tPj6RThQzS7Q45jqQll7NlTYvNcsg/BEP3LYiiazqSh9FAFnMkrV6ewUcMPKWyAfiyLs7jlz4rRvdNRUSygzfQ==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-win32-arm64/-/cli-win32-arm64-12.1.3.tgz", + "integrity": "sha512-RymHWeod57EBOJY4P636CgUwYA6BQdkQjh56XKk4pLEHO6X1bFyMet2XL7KlHw5qOTalzuzf5jJqUs+vf3jdXQ==", "cpu": [ "arm64" ], @@ -96,9 +95,9 @@ ] }, "node_modules/@rometools/cli-win32-x64": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rometools/cli-win32-x64/-/cli-win32-x64-11.0.0.tgz", - "integrity": "sha512-bmBai8WHxYjsGk1+je7ZTfCUCWq30WJI3pQM8pzTA674lfGTZ9ymJoZwTaIMSO4rL5V9mlO6uLunsBKso9VqOg==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-win32-x64/-/cli-win32-x64-12.1.3.tgz", + "integrity": "sha512-yHSKYidqJMV9nADqg78GYA+cZ0hS1twANAjiFibQdXj9aGzD+s/IzIFEIi/U/OBLvWYg/SCw0QVozi2vTlKFDQ==", "cpu": [ "x64" ], @@ -115,9 +114,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.14.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.4.tgz", - "integrity": "sha512-VhCw7I7qO2X49+jaKcAUwi3rR+hbxT5VcYF493+Z5kMLI0DL568b7JI4IDJaxWFH0D/xwmGJNoXisyX+w7GH/g==", + "version": "20.6.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz", + "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==", "dev": true }, "node_modules/@types/parsimmon": { @@ -148,9 +147,9 @@ "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==" }, "node_modules/rome": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/rome/-/rome-11.0.0.tgz", - "integrity": "sha512-rRo6JOwpMLc3OkeTDRXkrmrDqnxDvZ75GS4f0jLDBNmRgDXWbu0F8eVnJoRn+VbK2AE7vWvhVOMBjnWowcopkQ==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/rome/-/rome-12.1.3.tgz", + "integrity": "sha512-e+ff72hxDpe/t5/Us7YRBVw3PBET7SeczTQNn6tvrWdrCaAw3qOukQQ+tDCkyFtS4yGsnhjrJbm43ctNbz27Yg==", "dev": true, "hasInstallScript": true, "bin": { @@ -160,25 +159,25 @@ "node": ">=14.*" }, "optionalDependencies": { - "@rometools/cli-darwin-arm64": "11.0.0", - "@rometools/cli-darwin-x64": "11.0.0", - "@rometools/cli-linux-arm64": "11.0.0", - "@rometools/cli-linux-x64": "11.0.0", - "@rometools/cli-win32-arm64": "11.0.0", - "@rometools/cli-win32-x64": "11.0.0" + "@rometools/cli-darwin-arm64": "12.1.3", + "@rometools/cli-darwin-x64": "12.1.3", + "@rometools/cli-linux-arm64": "12.1.3", + "@rometools/cli-linux-x64": "12.1.3", + "@rometools/cli-win32-arm64": "12.1.3", + "@rometools/cli-win32-x64": "12.1.3" } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } } } diff --git a/package.json b/package.json index 2cd491a..c231f4c 100644 --- a/package.json +++ b/package.json @@ -21,19 +21,20 @@ "start": "tsc --watch", "generate": "npm run build && node test/test.js generate", "test": "npm run build && node test/test.js", - "lint": "tsc && rome ci src", + "lint": "tsc && npm run lint:rome", + "lint:rome": "rome ci src", "lint:fix": "rome format --write src && rome check --apply src", - "lint:fix:suggested": "rome check --apply-suggested src" + "lint:fix:unsafe": "rome check --apply-unsafe src" }, "devDependencies": { "@types/js-yaml": "^4.0.5", - "@types/node": "^18.14.4", + "@types/node": "^20.6.0", "@types/parsimmon": "^1.10.6", - "rome": "^11.0.0", - "typescript": "^4.9.5" + "rome": "^12.1.3", + "typescript": "^5.2.2" }, "dependencies": { - "@hyper-tuner/types": "^0.4.2", + "@hyper-tuner/types": "git+https://github.com/hyper-tuner/types.git", "js-yaml": "^4.1.0", "parsimmon": "^1.18.1" } diff --git a/rome.json b/rome.json index e2440dd..747fcde 100644 --- a/rome.json +++ b/rome.json @@ -18,12 +18,25 @@ "linter": { "enabled": true, "rules": { - "recommended": true, + "all": true, + "correctness": { + "all": true, + "noUnusedVariables": "warn" + }, "style": { - "noImplicitBoolean": "off" + "all": true, + "noImplicitBoolean": "off", + "useEnumInitializers": "off", + "noNonNullAssertion": "off" }, "suspicious": { + "all": true, "noExplicitAny": "off" + }, + "nursery": { + "all": true, + "useExhaustiveDependencies": "off", + "noForEach": "off" } } } diff --git a/src/cli.ts b/src/cli.ts index 92d8803..5c266a3 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -64,10 +64,11 @@ switch (command) { break; } - default: + default: { console.info( `❗️ Unknown command: ${command}, please use one of: [${Object.values(Commands).join(', ')}]`, ); process.exit(1); break; + } } diff --git a/src/ini.ts b/src/ini.ts index 6e71807..7d4c4d3 100644 --- a/src/ini.ts +++ b/src/ini.ts @@ -483,9 +483,9 @@ export class INI implements ParserInterface { if (!this.currentCurve) { throw new Error('Curve not set'); } - this.result.curves[this.currentCurve].xAxis = xAxisResult.value.values.map((val: string) => - INI.isNumber(val) ? Number(val) : INI.sanitize(val), - ); + this.result.curves[this.currentCurve].xAxis = xAxisResult.value.values.map((val: string) => { + return INI.isNumber(val) ? Number(val) : INI.sanitize(val); + }); return; } @@ -495,9 +495,9 @@ export class INI implements ParserInterface { if (!this.currentCurve) { throw new Error('Curve not set'); } - this.result.curves[this.currentCurve].yAxis = yAxisResult.value.values.map((val: string) => - INI.isNumber(val) ? Number(val) : INI.sanitize(val), - ); + this.result.curves[this.currentCurve].yAxis = yAxisResult.value.values.map((val: string) => { + return INI.isNumber(val) ? Number(val) : INI.sanitize(val); + }); return; } @@ -507,9 +507,9 @@ export class INI implements ParserInterface { if (!this.currentCurve) { throw new Error('Curve not set'); } - this.result.curves[this.currentCurve].xBins = xBinsResult.value.values.map((val: string) => - INI.isNumber(val) ? Number(val) : INI.sanitize(val), - ); + this.result.curves[this.currentCurve].xBins = xBinsResult.value.values.map((val: string) => { + return INI.isNumber(val) ? Number(val) : INI.sanitize(val); + }); return; } @@ -519,9 +519,9 @@ export class INI implements ParserInterface { if (!this.currentCurve) { throw new Error('Curve not set'); } - this.result.curves[this.currentCurve].yBins = yBinsResult.value.values.map((val: string) => - INI.isNumber(val) ? Number(val) : INI.sanitize(val), - ); + this.result.curves[this.currentCurve].yBins = yBinsResult.value.values.map((val: string) => { + return INI.isNumber(val) ? Number(val) : INI.sanitize(val); + }); return; } @@ -531,9 +531,9 @@ export class INI implements ParserInterface { if (!this.currentCurve) { throw new Error('Curve not set'); } - this.result.curves[this.currentCurve].size = size.value.values.map((val: string) => - INI.isNumber(val) ? Number(val) : INI.sanitize(val), - ); + this.result.curves[this.currentCurve].size = size.value.values.map((val: string) => { + return INI.isNumber(val) ? Number(val) : INI.sanitize(val); + }); } } @@ -870,9 +870,9 @@ export class INI implements ParserInterface { this.result.defines[result.name] = result.values.map(INI.sanitize); - const resolved = this.result.defines[result.name].flatMap((val) => - val.startsWith('$') ? this.result.defines[val.slice(1)] : val, - ); + const resolved = this.result.defines[result.name].flatMap((val) => { + return val.startsWith('$') ? this.result.defines[val.slice(1)] : val; + }); this.result.defines[result.name] = resolved; } @@ -1154,11 +1154,13 @@ export class INI implements ParserInterface { .tryParse(line); } - private static numberOrExpression = (val: string | undefined | null) => - INI.isNumber(val || '0') ? Number(val || 0) : INI.sanitize(`${val}`); + private static numberOrExpression = (val: string | undefined | null) => { + return INI.isNumber(val || '0') ? Number(val || 0) : INI.sanitize(`${val}`); + }; - private static sanitize = (val: any) => - val === undefined ? '' : `${val}`.replace(/"/g, '').replace(/\s+/g, ' ').trim(); + private static sanitize = (val: any) => { + return val === undefined ? '' : `${val}`.replace(/"/g, '').replace(/\s+/g, ' ').trim(); + }; private static isNumber = (val: any) => !Number.isNaN(Number(val));