Skip to content

Commit 0c2f4c0

Browse files
ammarioclaude
andcommitted
Merge PR #10: Add schema and shell formatting script
Resolves merge conflicts from PR #10 which adds: - Type imports for better code organization - Array<T> syntax for complex array types - Prettier schema configuration - ESLint rules for type imports and array syntax - Shell formatting script and configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 parents a4b0d41 + 0de911c commit 0c2f4c0

38 files changed

+153
-91
lines changed

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
23
"semi": true,
34
"singleQuote": false,
45
"tabWidth": 2,

eslint.config.mjs

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import js from "@eslint/js";
2-
import tseslint from "typescript-eslint";
2+
import { defineConfig } from "eslint/config";
33
import react from "eslint-plugin-react";
44
import reactHooks from "eslint-plugin-react-hooks";
5+
import tseslint from "typescript-eslint";
56

6-
export default tseslint.config(
7-
js.configs.recommended,
8-
...tseslint.configs.recommendedTypeChecked,
9-
...tseslint.configs.stylisticTypeChecked,
7+
export default defineConfig([
108
{
119
ignores: [
1210
"dist/",
@@ -21,6 +19,9 @@ export default tseslint.config(
2119
"src/main.tsx",
2220
],
2321
},
22+
js.configs.recommended,
23+
...tseslint.configs.recommendedTypeChecked,
24+
...tseslint.configs.stylisticTypeChecked,
2425
{
2526
files: ["src/**/*.{ts,tsx}"],
2627
languageOptions: {
@@ -50,7 +51,7 @@ export default tseslint.config(
5051
},
5152
},
5253
plugins: {
53-
react: react,
54+
react,
5455
"react-hooks": reactHooks,
5556
},
5657
settings: {
@@ -87,6 +88,44 @@ export default tseslint.config(
8788
},
8889
],
8990

91+
// Enforce shorthand array notation, e.g. Foo[] instead of Array<Foo>
92+
"@typescript-eslint/array-type": [
93+
"error",
94+
{
95+
default: "array-simple",
96+
readonly: "array-simple",
97+
},
98+
],
99+
100+
// Keep type-only imports explicit to avoid runtime inclusion
101+
"@typescript-eslint/consistent-type-imports": [
102+
"error",
103+
{
104+
prefer: "type-imports",
105+
disallowTypeAnnotations: true,
106+
},
107+
],
108+
109+
// Require handling Promises instead of letting them float
110+
"@typescript-eslint/no-floating-promises": [
111+
"error",
112+
{
113+
ignoreVoid: true,
114+
ignoreIIFE: true,
115+
},
116+
],
117+
118+
// Highlight unnecessary assertions to keep code idiomatic
119+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
120+
121+
// Encourage readonly where possible to surface unintended mutations
122+
"@typescript-eslint/prefer-readonly": [
123+
"error",
124+
{
125+
onlyInlineLambdas: true,
126+
},
127+
],
128+
90129
// Prevent using any type at all
91130
"@typescript-eslint/no-unsafe-assignment": "error",
92131
"@typescript-eslint/no-unsafe-member-access": "error",
@@ -145,5 +184,5 @@ export default tseslint.config(
145184
afterAll: "readonly",
146185
},
147186
},
148-
}
149-
);
187+
},
188+
]);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"lint": "eslint 'src/**/*.{ts,tsx}' && bun run typecheck && bun run typecheck:main",
1919
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
2020
"fmt": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\" \"*.{json,md}\"",
21+
"fmt:shell": "shfmt -i 2 -ci -bn -w scripts",
2122
"fmt:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json}\" \"*.{json,md}\"",
2223
"test": "jest",
2324
"test:watch": "jest --watch",

scripts/update_vercel_docs.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DOCS_DIR="$PROJECT_ROOT/docs/vercel"
88
TEMP_DIR="$(mktemp -d)"
99

1010
cleanup() {
11-
rm -rf "$TEMP_DIR"
11+
rm -rf "$TEMP_DIR"
1212
}
1313
trap cleanup EXIT
1414

@@ -18,25 +18,25 @@ cd "$TEMP_DIR"
1818
git init -q
1919
git remote add origin https://github.com/vercel/ai.git
2020
git config core.sparseCheckout true
21-
echo "content/*" > .git/info/sparse-checkout
21+
echo "content/*" >.git/info/sparse-checkout
2222

2323
git fetch --depth=1 origin main
2424
git checkout main
2525

2626
if [ -d "$DOCS_DIR" ]; then
27-
echo "Removing existing docs/vercel directory..."
28-
rm -rf "$DOCS_DIR"
27+
echo "Removing existing docs/vercel directory..."
28+
rm -rf "$DOCS_DIR"
2929
fi
3030

3131
mkdir -p "$DOCS_DIR"
3232

3333
if [ -d "content" ]; then
34-
echo "Copying documentation to $DOCS_DIR..."
35-
cp -r content/* "$DOCS_DIR/"
36-
echo "Documentation updated successfully!"
34+
echo "Copying documentation to $DOCS_DIR..."
35+
cp -r content/* "$DOCS_DIR/"
36+
echo "Documentation updated successfully!"
3737
else
38-
echo "Error: content directory not found in repository"
39-
exit 1
38+
echo "Error: content directory not found in repository"
39+
exit 1
4040
fi
4141

42-
echo "Vercel AI SDK documentation has been updated in $DOCS_DIR"
42+
echo "Vercel AI SDK documentation has been updated in $DOCS_DIR"

src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import styled from "@emotion/styled";
33
import { Global, css } from "@emotion/react";
44
import { GlobalColors } from "./styles/colors";
55
import { GlobalFonts } from "./styles/fonts";
6-
import ProjectSidebar, { ProjectConfig, WorkspaceSelection } from "./components/ProjectSidebar";
6+
import type { ProjectConfig, WorkspaceSelection } from "./components/ProjectSidebar";
7+
import ProjectSidebar from "./components/ProjectSidebar";
78
import NewWorkspaceModal from "./components/NewWorkspaceModal";
89
import { AIView } from "./components/AIView";
910
import { ErrorBoundary } from "./components/ErrorBoundary";

src/components/AIView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { InterruptedBarrier } from "./Messages/InterruptedBarrier";
55
import { ChatInput } from "./ChatInput";
66
import { ErrorMessage } from "./ErrorMessage";
77
import { ChatMetaSidebar } from "./ChatMetaSidebar";
8-
import { DisplayedMessage, CmuxMessage } from "../types/message";
8+
import type { DisplayedMessage, CmuxMessage } from "../types/message";
99
import { StreamingMessageAggregator } from "../utils/StreamingMessageAggregator";
1010
import { shouldShowInterruptedBarrier } from "../utils/messageUtils";
1111
import { DebugProvider, useDebugMode } from "../contexts/DebugContext";
1212
import { ChatProvider } from "../contexts/ChatContext";
1313
import { ThinkingProvider } from "../contexts/ThinkingContext";
14+
import type { WorkspaceChatMessage } from "../types/ipc";
1415
import {
15-
WorkspaceChatMessage,
1616
isCaughtUpMessage,
1717
isStreamError,
1818
isStreamStart,

src/components/ChatInput.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React, { useState, useRef, useCallback, useEffect } from "react";
22
import styled from "@emotion/styled";
33
import { CommandSuggestions, COMMAND_SUGGESTION_KEYS } from "./CommandSuggestions";
4-
import { ChatInputToast, Toast, SolutionLabel } from "./ChatInputToast";
5-
import { parseCommand, ParsedCommand } from "../utils/commandParser";
6-
import { SendMessageError as SendMessageErrorType } from "../types/errors";
4+
import type { Toast } from "./ChatInputToast";
5+
import { ChatInputToast, SolutionLabel } from "./ChatInputToast";
6+
import type { ParsedCommand } from "../utils/commandParser";
7+
import { parseCommand } from "../utils/commandParser";
8+
import type { SendMessageError as SendMessageErrorType } from "../types/errors";
79
import { usePersistedState } from "../hooks/usePersistedState";
810
import { ThinkingSliderComponent } from "./ThinkingSlider";
911
import { useThinkingLevel } from "../hooks/useThinkingLevel";

src/components/ChatInputToast.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useEffect, useCallback, ReactNode } from "react";
1+
import type { ReactNode } from "react";
2+
import React, { useEffect, useCallback } from "react";
23
import styled from "@emotion/styled";
34
import { keyframes, css } from "@emotion/react";
45

src/components/ChatMetaSidebar/CostsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ const formatCostWithDollar = (cost: number): string => {
270270

271271
type ViewMode = "last-request" | "session";
272272

273-
const VIEW_MODE_OPTIONS: ToggleOption<ViewMode>[] = [
273+
const VIEW_MODE_OPTIONS: Array<ToggleOption<ViewMode>> = [
274274
{ value: "last-request", label: "Last Request" },
275275
{ value: "session", label: "Session" },
276276
];

src/components/ErrorBoundary.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { Component, ReactNode } from "react";
1+
import type { ReactNode } from "react";
2+
import React, { Component } from "react";
23
import styled from "@emotion/styled";
34

45
const ErrorContainer = styled.div`

0 commit comments

Comments
 (0)