diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cd115b7c..ea5a26ac0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,7 @@ jobs: - name: Check for build artifacts run: | - if [ ! -d "packages/protocol/dist" ]; then + if [ ! -d "packages/core/dist" ]; then echo "Protocol package build failed" exit 1 fi diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index e038e2909..f0576226b 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -4,6 +4,11 @@ on: pull_request: types: [opened, synchronize, reopened] +permissions: + contents: read + pull-requests: write + issues: write + jobs: validate: name: Validate PR diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..3e775efb0 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +auto-install-peers=true diff --git a/apps/playground/eslint.config.js b/apps/playground/eslint.config.js new file mode 100644 index 000000000..092408a9f --- /dev/null +++ b/apps/playground/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/apps/playground/package.json b/apps/playground/package.json index 30a8a2490..8be512d72 100644 --- a/apps/playground/package.json +++ b/apps/playground/package.json @@ -19,14 +19,20 @@ "react-dom": "^18.3.1" }, "devDependencies": { + "@eslint/js": "^9.39.2", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^5.1.1", "autoprefixer": "^10.4.23", + "eslint": "^9.39.2", + "eslint-plugin-react-hooks": "^7.0.1", + "eslint-plugin-react-refresh": "^0.4.26", + "globals": "^16.5.0", "postcss": "^8.5.6", "tailwindcss": "^3.4.19", "tailwindcss-animate": "^1.0.7", "typescript": "~5.9.3", + "typescript-eslint": "^8.53.0", "vite": "^7.2.4" } } diff --git a/apps/playground/src/App.tsx b/apps/playground/src/App.tsx index 1b13f23a2..2c983c5fe 100644 --- a/apps/playground/src/App.tsx +++ b/apps/playground/src/App.tsx @@ -9,26 +9,34 @@ type ViewportSize = 'desktop' | 'tablet' | 'mobile'; export default function Playground() { const [selectedExample, setSelectedExample] = useState('dashboard'); const [code, setCode] = useState(examples['dashboard']); + // eslint-disable-next-line @typescript-eslint/no-explicit-any const [schema, setSchema] = useState(null); const [jsonError, setJsonError] = useState(null); const [viewportSize, setViewportSize] = useState('desktop'); const [copied, setCopied] = useState(false); - // Real-time JSON parsing - useEffect(() => { + const updateSchema = (newCode: string) => { try { - const parsed = JSON.parse(code); + const parsed = JSON.parse(newCode); setSchema(parsed); setJsonError(null); } catch (e) { setJsonError((e as Error).message); // Keep previous schema on error } - }, [code]); + }; + + // Initial parse usage + useEffect(() => { + updateSchema(code); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); // Run once on mount const handleExampleChange = (key: ExampleKey) => { setSelectedExample(key); - setCode(examples[key]); + const newCode = examples[key]; + setCode(newCode); + updateSchema(newCode); }; const handleCopySchema = async () => { @@ -118,7 +126,11 @@ export default function Playground() {