diff --git a/.github/renovate.json b/.github/renovate.json index 42effde..285833d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -10,6 +10,10 @@ "schedule": ["every 3 months on the first day of the month"] }, "packageRules": [ + { + "matchDepTypes": ["engines"], + "enabled": false + }, { "matchDepTypes": ["devDependencies"], "automerge": true diff --git a/lib/index.spec.ts b/lib/index.spec.ts index e7f0500..5e1db76 100644 --- a/lib/index.spec.ts +++ b/lib/index.spec.ts @@ -22,7 +22,7 @@ describe("TypeScriptLoader", () => { }, }); const loadedCfg = cfg.load( - path.resolve(fixturesPath, "valid.fixture.ts") + path.resolve(fixturesPath, "valid.fixture.ts"), ); expect(typeof loadedCfg!.config).toStrictEqual("object"); @@ -54,7 +54,7 @@ describe("TypeScriptLoader", () => { }, }); const loadedCfg = await cfg.load( - path.resolve(fixturesPath, "valid.fixture.ts") + path.resolve(fixturesPath, "valid.fixture.ts"), ); expect(typeof loadedCfg!.config).toStrictEqual("object"); @@ -87,7 +87,7 @@ describe("TypeScriptLoader", () => { }, }); const loadedCfg = cfg.load( - path.resolve(fixturesPath, "valid.fixture.ts") + path.resolve(fixturesPath, "valid.fixture.ts"), ); expect(typeof loadedCfg!.config).toStrictEqual("object"); @@ -103,7 +103,7 @@ describe("TypeScriptLoader", () => { }); expect(() => - cfg.load(path.resolve(fixturesPath, "invalid.fixture.ts")) + cfg.load(path.resolve(fixturesPath, "invalid.fixture.ts")), ).toThrowError(); }); }); diff --git a/lib/loader.spec.ts b/lib/loader.spec.ts index 193edd9..11c289e 100644 --- a/lib/loader.spec.ts +++ b/lib/loader.spec.ts @@ -52,7 +52,7 @@ describe("TypeScriptLoader", () => { const filePath = path.resolve(fixturesPath, "invalid.fixture.ts"); loader(filePath, readFixtureContent(filePath)); fail( - "Error should be thrown upon failing to transpile an invalid TS file." + "Error should be thrown upon failing to transpile an invalid TS file.", ); } catch (error: unknown) { expect(error).toBeInstanceOf(TypeScriptCompileError); @@ -81,7 +81,7 @@ describe("TypeScriptLoader", () => { try { loader("filePath", "readFixtureContent(filePath)"); fail( - "Error should be thrown upon failing to transpile an invalid TS file." + "Error should be thrown upon failing to transpile an invalid TS file.", ); } catch (error: unknown) { expect(error).not.toBeInstanceOf(TypeScriptCompileError); diff --git a/lib/typescript-compile-error.spec.ts b/lib/typescript-compile-error.spec.ts index dc35769..1ab6c74 100644 --- a/lib/typescript-compile-error.spec.ts +++ b/lib/typescript-compile-error.spec.ts @@ -8,10 +8,10 @@ describe("TypeScriptCompileError", () => { const tscError = TypeScriptCompileError.fromError(testError); expect(tscError.name).toStrictEqual( - TypeScriptCompileError.prototype.constructor.name + TypeScriptCompileError.prototype.constructor.name, ); expect(tscError.message).toContain( - "TypeScriptLoader failed to compile TypeScript" + "TypeScriptLoader failed to compile TypeScript", ); expect(tscError.message).toContain("Test Error"); expect(tscError.stack).toBe(testError.stack); @@ -23,7 +23,7 @@ describe("TypeScriptCompileError", () => { const tscError = TypeScriptCompileError.fromError(legacyError); expect(tscError.message).toContain( - "TypeScriptLoader failed to compile TypeScript:" + "TypeScriptLoader failed to compile TypeScript:", ); }); }); diff --git a/package-lock.json b/package-lock.json index 04112f4..3589a10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,9 +23,9 @@ "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^5.0.0", "jest": "^29.6.1", - "prettier": "^2.8.8", + "prettier": "^3.0.0", "release-it": "^16.1.3", "typescript": "^5.1.6" }, @@ -2430,6 +2430,26 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@pnpm/config.env-replace": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", @@ -5056,21 +5076,29 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", + "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", "dev": true, "dependencies": { - "prettier-linter-helpers": "^1.0.0" + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" }, "engines": { - "node": ">=12.0.0" + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/prettier" }, "peerDependencies": { - "eslint": ">=7.28.0", - "prettier": ">=2.0.0" + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "prettier": ">=3.0.0" }, "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, "eslint-config-prettier": { "optional": true } @@ -9809,15 +9837,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -10927,6 +10955,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/synckit": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", + "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "dev": true, + "dependencies": { + "@pkgr/utils": "^2.3.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -13392,6 +13436,20 @@ "@octokit/openapi-types": "^18.0.0" } }, + "@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + } + }, "@pnpm/config.env-replace": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", @@ -15297,12 +15355,13 @@ } }, "eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", + "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", "dev": true, "requires": { - "prettier-linter-helpers": "^1.0.0" + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" } }, "eslint-visitor-keys": { @@ -18736,9 +18795,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true }, "prettier-linter-helpers": { @@ -19516,6 +19575,16 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, + "synckit": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", + "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "dev": true, + "requires": { + "@pkgr/utils": "^2.3.1", + "tslib": "^2.5.0" + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/package.json b/package.json index 0b555c8..d9bdc7d 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "build:sources": "node ./scripts/esbuild.config.mjs", "build:types": "tsc -p tsconfig.build.json", "check:types": "tsc -p tsconfig.json", + "format": "npm run format:check -- --write", "format:check": "prettier --check \"{**/*,*}.{js,cjs,mjs,ts}\"", - "format:write": "npm run format:check -- --write", "lint": "eslint --ext \".js,.cjs,.mjs,.ts\" .", "lint:fix": "npm run lint -- --fix", "release": "release-it", @@ -66,9 +66,9 @@ "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^5.0.0", "jest": "^29.6.1", - "prettier": "^2.8.8", + "prettier": "^3.0.0", "release-it": "^16.1.3", "typescript": "^5.1.6" }, diff --git a/scripts/esbuild.config.mjs b/scripts/esbuild.config.mjs index 0f4d570..7e67f87 100644 --- a/scripts/esbuild.config.mjs +++ b/scripts/esbuild.config.mjs @@ -77,8 +77,8 @@ async function getSourceEntryPoints() { const startTime = Date.now(); console.info( chalk.bold( - `๐Ÿš€ ${chalk.blueBright("cosmiconfig-typescript-loader")} Build\n` - ) + `๐Ÿš€ ${chalk.blueBright("cosmiconfig-typescript-loader")} Build\n`, + ), ); console.info("- Generate sources"); @@ -91,27 +91,27 @@ async function getSourceEntryPoints() { const result = await buildSources(sourceEntryPoints, format); const analysis = await analyzeMetafile( // @ts-ignore we know that the metafile will be emitted - result.metafile + result.metafile, ); console.info( `${analysis .trim() .split(/\n\r/) .map((line) => ` ${line}`) - .join()}` + .join()}`, ); console.info( `${chalk.bold.greenBright("โœ”")} Generating ${chalk.bold.greenBright( - format - )} sources completed!\n` + format, + )} sources completed!\n`, ); } console.info( chalk.bold.green( - `โœ” Generate sources completed! (${Date.now() - startTime}ms)` - ) + `โœ” Generate sources completed! (${Date.now() - startTime}ms)`, + ), ); } catch (error) { console.error(`๐Ÿงจ ${chalk.red.bold("Failed:")} ${error.message}`);