Skip to content

fix(eslint-plugin-sdk): build the plugin at install time - #2001

Open
toiroakr wants to merge 3 commits into
mainfrom
fix/eslint-plugin-build-followup
Open

fix(eslint-plugin-sdk): build the plugin at install time#2001
toiroakr wants to merge 3 commits into
mainfrom
fix/eslint-plugin-build-followup

Conversation

@toiroakr

@toiroakr toiroakr commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1986, which moved the plugin from committed JS to a TypeScript build. The build product is gitignored, but only pretest and prepack produced it, so several entry points loaded a stale bundle or none at all.

Build lifecycle

  • Add a prepare script so pnpm install produces dist/. Without it, a fresh clone had no plugin entry point and the lefthook pre-commit hook failed while linting the create-sdk templates (Failed to load JS plugin: @tailor-platform/eslint-plugin-sdk), blocking every commit. prepare also runs before pack/publish, so prepack is now redundant and was dropped. It invokes tsdown directly rather than pnpm run build, because prepare also runs for git dependencies installed with npm or yarn.
  • Build from a vitest globalSetup and drop pretest, so npx vitest, watch mode and the IDE extension exercise the code under test rather than a previously built bundle. The build spawns tsdown's JS bin through node rather than the .bin/ shim, which is .cmd/.ps1 on Windows — matching what src/rules/test-helpers.ts already does for oxlint.

Test discovery and type coverage

  • Widen the vitest include to src/**/*.test.ts. The previous list enumerated files and directories and did not cover src/lib/, where ast.ts and sdk-bindings.ts live, so tests added there would have been skipped silently.
  • Widen the tsconfig include to cover the root-level config scripts, so a type error in vitest.global-setup.ts fails typecheck instead of passing silently.

Checks

  • Restore publint to the bare publint --strict used by every other package. It had grown a clean rebuild that ran a second tsdown mid-check, plus a type check hidden behind a name that did not describe it.
  • Remove tsconfig.dist.json and test-dist/. Type-checking the generated dist/index.d.ts only guards against a dts bundler regression: the declaration is derived from sources that tsc --noEmit already checks, src/index.test-d.ts covers the same public type contract at the source level, and tsconfig.dist.json resolved through moduleResolution: bundler rather than the way a consumer would, so it never tested what set it apart. No other package here checks its build output this way.

Cleanup

  • Derive configs.recommended.rules from the rules map instead of re-listing every rule name.
  • Collapse the three copies of the named-import lookup in ImportTracker into importedName(), and drop the duplicate specifier walk in no-unconditional-permit.
  • Reuse the exported AstNode instead of a third local copy of the OptionalMemberExpression shape, and name node types with the Extract idiom already used in lib/ast.ts.
  • Remove package.test.ts, which asserted package.json verbatim. publint --strict covers the entry points.

…umer

The package now resolves its entry point from the gitignored dist/, but
nothing built it outside the pretest hook and prepack. A fresh clone had
no plugin to load, so the lefthook pre-commit hook failed to lint the
create-sdk templates, and any vitest invocation that skipped pretest
linted a stale bundle or none at all.

Build from prepare so an install produces the entry point, build from a
vitest globalSetup so every test entry point covers it, and build the
plugin in the lefthook checks hook alongside the SDK.

Also stop skipping the library check for the published declaration, so
tsconfig.dist.json verifies dist/index.d.ts itself instead of only its
usage sites, and widen the vitest include so tests under src/lib run.
@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5dc81f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tailor-platform/eslint-plugin-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@toiroakr toiroakr assigned dqn and unassigned dqn Aug 6, 2026
The generated dist/index.d.ts is derived from sources that tsc --noEmit
already checks, so type-checking the artifact only guards against a dts
bundler regression. src/index.test-d.ts covers the same public type
contract at the source level, test-dist/index.test-d.ts was a near copy
of it, and tsconfig.dist.json resolved through moduleResolution bundler
rather than the way a consumer would, so it never tested what set it
apart. No other package here checks its build output this way.

Reverting the pre-commit hook change for the same reason: prepare covers
the fresh clone that motivated it, and building the plugin on every
commit only guards against dist being deleted while node_modules stays.

Collapse the three copies of the named-import lookup in ImportTracker
into importedName(), and build through tsdown via node rather than the
pnpm shim, which is a .cmd on Windows.
@toiroakr toiroakr changed the title fix(eslint-plugin-sdk): make the built plugin available to every consumer fix(eslint-plugin-sdk): build the plugin at install time Aug 6, 2026
@toiroakr
toiroakr requested a lite review from Copilot August 6, 2026 15:38
@pkg-pr-new

pkg-pr-new Bot commented Aug 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tailor-platform/create-sdk

pnpm add https://pkg.pr.new/tailor-platform/sdk/@tailor-platform/create-sdk@5dc81f9

@tailor-platform/eslint-plugin-sdk

pnpm add https://pkg.pr.new/tailor-platform/sdk/@tailor-platform/eslint-plugin-sdk@5dc81f9

@tailor-platform/sdk

pnpm add https://pkg.pr.new/tailor-platform/sdk/@tailor-platform/sdk@5dc81f9

@tailor-platform/sdk-plugin-seed

pnpm add https://pkg.pr.new/tailor-platform/sdk/@tailor-platform/sdk-plugin-seed@5dc81f9

@tailor-platform/sdk-plugin-tailordb-erd

pnpm add https://pkg.pr.new/tailor-platform/sdk/@tailor-platform/sdk-plugin-tailordb-erd@5dc81f9

commit: 5dc81f9

This comment was marked as resolved.

…gnostic

prepare also runs when the package is installed as a git dependency,
where the installing package manager may be npm or yarn and pnpm is not
guaranteed to exist. Call tsdown through its node_modules/.bin entry
instead, which every package manager provides.

Surface the spawn failure reason from the vitest globalSetup: a build
that fails to start (ENOENT) or dies on a signal reported only a generic
message before.

Cover the root-level config scripts in tsconfig, so a type error in
vitest.global-setup.ts fails typecheck instead of passing silently.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Code Metrics Report (packages/sdk)

main (f90f24e) #2001 (460c7dc) +/-
Coverage 78.7% 78.7% -0.1%
Code to Test Ratio 1:0.4 1:0.4 0.0
Details
  |                    | main (f90f24e) | #2001 (460c7dc) |  +/-  |
  |--------------------|----------------|-----------------|-------|
- | Coverage           |          78.7% |           78.7% | -0.1% |
  |   Files            |            464 |             464 |     0 |
  |   Lines            |          17817 |           17817 |     0 |
- |   Covered          |          14026 |           14024 |    -2 |
  | Code to Test Ratio |          1:0.4 |           1:0.4 |   0.0 |
  |   Code             |         128029 |          128029 |     0 |
  |   Test             |          62942 |           62942 |     0 |

Code coverage of files in pull request scope (75.0% → 72.8%)

Files Coverage +/- Status
packages/sdk/src/cli/commands/workflow/waiter.ts 72.8% -2.2% affected

SDK Configure Bundle Size

main (f90f24e) #2001 (460c7dc) +/-
configure-index-size 39.25KB 39.25KB 0KB
dependency-chunks-size 24.96KB 24.96KB 0KB
total-bundle-size 64.22KB 64.22KB 0KB

Runtime Performance

main (f90f24e) #2001 (460c7dc) +/-
Generate Median 2,277ms 2,279ms 2ms
Generate Max 2,304ms 2,344ms 40ms
Apply Build Median 2,334ms 2,362ms 28ms
Apply Build Max 2,391ms 2,445ms 54ms

Type Performance (instantiations)

main (f90f24e) #2001 (460c7dc) +/-
tailordb-basic 40,450 40,450 0
tailordb-optional 4,535 4,535 0
tailordb-relation 3,854 3,854 0
tailordb-validate 666 666 0
tailordb-hooks 5,499 5,499 0
tailordb-object 16,345 16,345 0
tailordb-enum 1,538 1,538 0
resolver-basic 12,120 12,120 0
resolver-nested 35,419 35,419 0
resolver-array 24,056 24,056 0
executor-schedule 4,489 4,489 0
executor-webhook 1,130 1,130 0
executor-record 4,542 4,542 0
executor-resolver 5,808 5,808 0
executor-operation-function 1,118 1,118 0
executor-operation-gql 1,126 1,126 0
executor-operation-webhook 1,137 1,137 0
executor-operation-workflow 1,931 1,931 0

Reported by octocov

@toiroakr
toiroakr marked this pull request as ready for review August 7, 2026 03:11
@toiroakr
toiroakr requested review from a team as code owners August 7, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants