fix(generators): wire lint+typecheck into pipeline and fix uncovered errors
The turbo/generators package shipped without `lint` or `typecheck` scripts,
so `pnpm lint` / `pnpm typecheck` at the root silently skipped it. This
masked 2 ESLint errors (unused imports) and 11 TypeScript errors (relative
imports missing the `.js` extension required by `moduleResolution: NodeNext`,
plus JSON imports missing the `with { type: "json" }` attribute).
- Add `lint` and `typecheck` scripts to turbo/generators/package.json so the
turbo pipeline picks them up (lint: 14/14, was 13/13).
- Add `.js` extensions to 7 relative imports across config.test.ts,
lib/core-package-utils.test.ts, lib/snapshot.test.ts, and the 4 e2e tests.
- Add `with { type: "json" }` attributes to 4 snapshot JSON imports in the
e2e tests.
- Remove unused `existsSync` and `splicePluginImportsAt` imports from
lib/core-package-utils.test.ts.
- Declare `@repo/core-typescript` + `typescript` devDependencies so the
generators package can run `tsc --noEmit` for typecheck.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -751,6 +751,12 @@ importers:
|
|||||||
'@repo/core-eslint':
|
'@repo/core-eslint':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/core-eslint
|
version: link:../../packages/core-eslint
|
||||||
|
'@repo/core-typescript':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/core-typescript
|
||||||
|
typescript:
|
||||||
|
specifier: ^5.8.0
|
||||||
|
version: 5.9.3
|
||||||
vitest:
|
vitest:
|
||||||
specifier: ^3.1.0
|
specifier: ^3.1.0
|
||||||
version: 3.2.4(@types/debug@4.1.13)(@types/node@25.5.2)(happy-dom@20.8.9)(jiti@2.6.1)(jsdom@25.0.1)(lightningcss@1.32.0)(sass@1.99.0)(terser@5.46.2)(tsx@4.21.0)
|
version: 3.2.4(@types/debug@4.1.13)(@types/node@25.5.2)(happy-dom@20.8.9)(jiti@2.6.1)(jsdom@25.0.1)(lightningcss@1.32.0)(sass@1.99.0)(terser@5.46.2)(tsx@4.21.0)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { tmpdir } from "node:os";
|
|||||||
import { execSync } from "node:child_process";
|
import { execSync } from "node:child_process";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { computeSnapshot } from "../lib/snapshot";
|
import { computeSnapshot } from "../lib/snapshot.js";
|
||||||
import expectedSnapshot from "../__snapshots__/core-package/events.snapshot.json";
|
import expectedSnapshot from "../__snapshots__/core-package/events.snapshot.json" with { type: "json" };
|
||||||
|
|
||||||
// Repo root is 2 levels up from turbo/generators/__tests__
|
// Repo root is 2 levels up from turbo/generators/__tests__
|
||||||
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { tmpdir } from "node:os";
|
|||||||
import { execSync } from "node:child_process";
|
import { execSync } from "node:child_process";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { computeSnapshot } from "../lib/snapshot";
|
import { computeSnapshot } from "../lib/snapshot.js";
|
||||||
import expectedSnapshot from "../__snapshots__/core-package/realtime.snapshot.json";
|
import expectedSnapshot from "../__snapshots__/core-package/realtime.snapshot.json" with { type: "json" };
|
||||||
|
|
||||||
// Repo root is 2 levels up from turbo/generators/__tests__
|
// Repo root is 2 levels up from turbo/generators/__tests__
|
||||||
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { tmpdir } from "node:os";
|
|||||||
import { execSync } from "node:child_process";
|
import { execSync } from "node:child_process";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { computeSnapshot } from "../lib/snapshot";
|
import { computeSnapshot } from "../lib/snapshot.js";
|
||||||
import expectedSnapshot from "../__snapshots__/core-package/trpc.snapshot.json";
|
import expectedSnapshot from "../__snapshots__/core-package/trpc.snapshot.json" with { type: "json" };
|
||||||
|
|
||||||
// Repo root is 2 levels up from turbo/generators/__tests__
|
// Repo root is 2 levels up from turbo/generators/__tests__
|
||||||
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { tmpdir } from "node:os";
|
|||||||
import { execSync } from "node:child_process";
|
import { execSync } from "node:child_process";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { computeSnapshot } from "../lib/snapshot";
|
import { computeSnapshot } from "../lib/snapshot.js";
|
||||||
import expectedSnapshot from "../__snapshots__/core-package/ui.snapshot.json";
|
import expectedSnapshot from "../__snapshots__/core-package/ui.snapshot.json" with { type: "json" };
|
||||||
|
|
||||||
// Repo root is 2 levels up from turbo/generators/__tests__
|
// Repo root is 2 levels up from turbo/generators/__tests__
|
||||||
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
const REPO_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import type { PlopTypes } from "@turbo/gen";
|
import type { PlopTypes } from "@turbo/gen";
|
||||||
import generator from "./config";
|
import generator from "./config.js";
|
||||||
|
|
||||||
describe("core-package generator", () => {
|
describe("core-package generator", () => {
|
||||||
it("is registered with realtime and events in choices list", () => {
|
it("is registered with realtime and events in choices list", () => {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import {
|
import {
|
||||||
existsSync,
|
|
||||||
mkdtempSync,
|
mkdtempSync,
|
||||||
mkdirSync,
|
mkdirSync,
|
||||||
writeFileSync,
|
writeFileSync,
|
||||||
@@ -12,10 +11,9 @@ import {
|
|||||||
assertOptionalPackageNotPresent,
|
assertOptionalPackageNotPresent,
|
||||||
addToTranspilePackages,
|
addToTranspilePackages,
|
||||||
splicePluginRulesAt,
|
splicePluginRulesAt,
|
||||||
splicePluginImportsAt,
|
|
||||||
addBoundariesEntry,
|
addBoundariesEntry,
|
||||||
emitTemplateTree,
|
emitTemplateTree,
|
||||||
} from "./core-package-utils";
|
} from "./core-package-utils.js";
|
||||||
|
|
||||||
describe("assertOptionalPackageNotPresent", () => {
|
describe("assertOptionalPackageNotPresent", () => {
|
||||||
it("throws if packages/<name>/ exists in cwd", () => {
|
it("throws if packages/<name>/ exists in cwd", () => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest";
|
|||||||
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
|
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { computeSnapshot } from "./snapshot";
|
import { computeSnapshot } from "./snapshot.js";
|
||||||
|
|
||||||
describe("computeSnapshot", () => {
|
describe("computeSnapshot", () => {
|
||||||
it("returns sorted file paths + sha256 hashes", () => {
|
it("returns sorted file paths + sha256 hashes", () => {
|
||||||
|
|||||||
@@ -4,13 +4,17 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run"
|
"lint": "eslint .",
|
||||||
|
"test": "vitest run",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@turbo/gen": "^2.4.0"
|
"@turbo/gen": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@repo/core-eslint": "workspace:*",
|
"@repo/core-eslint": "workspace:*",
|
||||||
|
"@repo/core-typescript": "workspace:*",
|
||||||
|
"typescript": "^5.8.0",
|
||||||
"vitest": "^3.1.0"
|
"vitest": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user