create-rsc-kit 0.30.3 → 0.30.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/templates.js +21 -4
  2. package/package.json +1 -1
package/dist/templates.js CHANGED
@@ -121,7 +121,7 @@ export function scripts(o) {
121
121
  // typecheck run without one read the last start's - a route added since
122
122
  // was not a Route yet.
123
123
  typecheck: 'rsc-kit-typegen && tsc --noEmit',
124
- ...(o.lint ? { lint: 'oxlint src --fix', 'lint:check': 'oxlint src --deny-warnings' } : {}),
124
+ ...(o.lint ? { lint: 'oxlint src --type-aware --fix', 'lint:check': 'oxlint src --type-aware --deny-warnings' } : {}),
125
125
  // Laravel returned above: its pages call into PHP that createTestApp does
126
126
  // not run, and its tests are Pest, on the other side.
127
127
  ...testScripts(o),
@@ -133,7 +133,7 @@ function testScripts(o) {
133
133
  test,
134
134
  // The one command an agent runs before saying it is done. Each part exists
135
135
  // on its own; this is so nothing has to remember the list.
136
- check: ['rsc-kit-typegen', 'tsc --noEmit', ...(o.lint ? ['oxlint src --deny-warnings'] : []), test].join(' && '),
136
+ check: ['rsc-kit-typegen', 'tsc --noEmit', ...(o.lint ? ['oxlint src --type-aware --deny-warnings'] : []), test].join(' && '),
137
137
  };
138
138
  }
139
139
  export function packageJson(o) {
@@ -187,8 +187,11 @@ export function packageJson(o) {
187
187
  dev['tailwindcss'] = '^4.0.0';
188
188
  dev['@tailwindcss/vite'] = '^4.0.0';
189
189
  }
190
- if (o.lint)
190
+ // Type-aware, for the rules below that read what an expression's type is.
191
+ if (o.lint) {
191
192
  dev['oxlint'] = '^1.81.0';
193
+ dev['oxlint-tsgolint'] = '^7.0.2003';
194
+ }
192
195
  if (o.validation === 'zod')
193
196
  deps['zod'] = '^4.0.0';
194
197
  if (o.validation === 'valibot')
@@ -562,6 +565,13 @@ export function oxlintConfig(o) {
562
565
  'typescript/no-explicit-any': 'error',
563
566
  'typescript/ban-ts-comment': 'error',
564
567
  'typescript/no-unsafe-function-type': 'error',
568
+ // Type-aware, and here for one reason: a call to a backend action
569
+ // is typed `T | Redirected`, and a redirected call resolves with
570
+ // `{ redirected }`. Read as text - `/t/${id}`, `String(id)`, `id + x`
571
+ // - it is "[object Object]", and the page navigates there.
572
+ 'typescript/restrict-template-expressions': 'error',
573
+ 'typescript/no-base-to-string': 'error',
574
+ 'typescript/restrict-plus-operands': 'error',
565
575
  'no-unused-vars': 'error',
566
576
  'prefer-const': 'error',
567
577
  'no-var': 'error',
@@ -666,7 +676,14 @@ ${o.host === 'laravel' || o.backend
666
676
  : `- **Every action and query is built from the client in \`${o.sourceDir}/server/client.ts\`**,
667
677
  and authorisation is its \`.use()\` middleware - never a check written in a
668
678
  component, and never a bare \`'use server'\` function for anything that writes.`}
669
- - **Links and redirects are typed**: \`\`<Link href={\`/posts/\${slug}\`}>\`\`, a template
679
+ ${o.host === 'laravel' || o.backend
680
+ ? `- **A call to a backend action can be redirected** (an expired session, a guard),
681
+ and then resolves \`{ redirected }\` instead of its result. Narrow with
682
+ \`isRedirected\` from \`@rsc-kit/core/errors\` before reading the value, and before
683
+ any success toast or navigation after an \`await\` of a stub that returns nothing.
684
+ \`<Form>\` and \`useAction\` already skip \`onSuccess\` for it.
685
+ `
686
+ : ''}- **Links and redirects are typed**: \`\`<Link href={\`/posts/\${slug}\`}>\`\`, a template
670
687
  literal, so a renamed route fails the typecheck. Never build urls by
671
688
  concatenation.
672
689
  - **Metadata is \`export const metadata\`** (or \`generateMetadata\`), never tags in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rsc-kit",
3
- "version": "0.30.3",
3
+ "version": "0.30.5",
4
4
  "type": "module",
5
5
  "description": "Scaffold an RSC app on Bun, Hono, Elysia or Node.",
6
6
  "bin": {