fix(editor): repair columns.spec.tsx type errors + run typecheck on CI (#3539)

This commit is contained in:
Lucas da Costa
2026-05-25 16:26:53 -03:00
committed by GitHub
parent a79acd1f19
commit 32cb16c5ff
6 changed files with 52 additions and 6 deletions
+33
View File
@@ -0,0 +1,33 @@
name: Typecheck
on:
push:
branches:
- main
- canary
pull_request:
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
typecheck:
timeout-minutes: 20
runs-on: depot-ubuntu-22.04-2
container:
image: node:24-slim
steps:
- name: Checkout Repo
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
fetch-depth: 1
- name: pnpm setup
uses: pnpm/action-setup@738f428026a1f5a72398de22aeed83d859c4a660
- name: Install packages
run: pnpm install --frozen-lockfile --prefer-offline
- name: Run Typecheck
run: pnpm typecheck
env:
TURBO_TOKEN: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && secrets.TURBO_TOKEN || '' }}
TURBO_TEAM: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && secrets.TURBO_TEAM || '' }}
@@ -1,7 +1,6 @@
import { existsSync } from 'node:fs';
import path from 'node:path';
import { parse, stringify } from 'html-to-ast';
import type { Attr, IDoc as Doc } from 'html-to-ast/dist/types';
import postcss from 'postcss';
import { pretty, render } from 'react-email';
import { getComponentElement } from '../src/app/components/get-imported-components-for';
@@ -9,6 +8,8 @@ import { Layout } from './_components/layout';
import { componentsStructure, getComponentPathFromSlug } from './structure';
type MaybeDoc = ReturnType<typeof parse>[number];
type Doc = Parameters<typeof stringify>[0][number];
type Attr = NonNullable<MaybeDoc['attrs']>;
const walkAst = <T extends MaybeDoc>(ast: T[], callback: (doc: T) => void) => {
for (const doc of ast) {
+1
View File
@@ -11,6 +11,7 @@
"release": "turbo run build --filter=./packages/* && pnpm changeset publish",
"test": "turbo run test",
"test:watch": "turbo run test:watch",
"typecheck": "turbo run typecheck",
"version": "changeset version && pnpm install --no-frozen-lockfile && pnpm lint:fix"
},
"devDependencies": {
@@ -195,11 +195,14 @@ describe('Column Variants', () => {
});
it('reflects column spacing in editor HTML without inventing a default gap', () => {
const renderHTML = TwoColumns.config.renderHTML;
type RenderHTMLFn = NonNullable<typeof TwoColumns.config.renderHTML>;
const renderHTML = TwoColumns.config.renderHTML as
| OmitThisParameter<RenderHTMLFn>
| undefined;
const defaultHtml = renderHTML?.({
HTMLAttributes: {},
} as Parameters<NonNullable<typeof renderHTML>>[0]) as [
} as unknown as Parameters<RenderHTMLFn>[0]) as [
string,
Record<string, unknown>,
number,
@@ -208,7 +211,7 @@ describe('Column Variants', () => {
const spacedHtml = renderHTML?.({
HTMLAttributes: { cellspacing: '12', style: 'padding: 10px;' },
} as Parameters<NonNullable<typeof renderHTML>>[0]) as [
} as unknown as Parameters<RenderHTMLFn>[0]) as [
string,
Record<string, unknown>,
number,
@@ -259,7 +262,7 @@ describe('Column Deletion', () => {
}
function findColDepth(
$from: ReturnType<typeof Editor.prototype.state.selection.$from>,
$from: typeof Editor.prototype.state.selection.$from,
): number | undefined {
for (let d = $from.depth; d >= 0; d--) {
if ($from.node(d).type.name === 'columnsColumn') return d;
+6 -1
View File
@@ -35,5 +35,10 @@
"outDir": "dist"
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["dist", "node_modules"]
"exclude": [
"dist",
"node_modules",
"src/cli/utils/preview/hot-reloading/test",
"src/components/tailwind/e2e"
]
}
+3
View File
@@ -50,6 +50,9 @@
"outputs": ["dist/**"]
},
"lint": {},
"typecheck": {
"dependsOn": ["^build"]
},
"//#format": {},
"//#format:check": {},
"test:e2e": {