diff --git a/examples/array-test/.eslintrc b/examples/array-test/.eslintrc new file mode 100644 index 0000000..e2060ea --- /dev/null +++ b/examples/array-test/.eslintrc @@ -0,0 +1,13 @@ +{ + "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint", "simple-import-sort", "@idealjs/sapling"], + "rules": { + "quotes": "warn", + "simple-import-sort/imports": "warn", + "simple-import-sort/exports": "warn", + "@idealjs/sapling/no-nested-derive-call": "error", + "@idealjs/sapling/no-state-created-in-derive": "error", + "@typescript-eslint/no-unused-vars": "off" + } +} diff --git a/examples/array-test/.gitignore b/examples/array-test/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/examples/array-test/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/examples/array-test/index.html b/examples/array-test/index.html new file mode 100644 index 0000000..e6025da --- /dev/null +++ b/examples/array-test/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + TS + + +
+ + + diff --git a/examples/array-test/package.json b/examples/array-test/package.json new file mode 100644 index 0000000..705ee6f --- /dev/null +++ b/examples/array-test/package.json @@ -0,0 +1,20 @@ +{ + "name": "array-test", + "private": true, + "version": "0.1.18", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "@idealjs/eslint-plugin-sapling": "0.1.18", + "@types/node": "^20.10.7", + "typescript": "^5.3.3", + "vite": "^5.0.11" + }, + "dependencies": { + "@idealjs/sapling": "0.1.18" + } +} diff --git a/examples/array-test/public/vite.svg b/examples/array-test/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/examples/array-test/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/array-test/src/main.tsx b/examples/array-test/src/main.tsx new file mode 100644 index 0000000..aa3b9a2 --- /dev/null +++ b/examples/array-test/src/main.tsx @@ -0,0 +1,20 @@ +import { upsert } from "@idealjs/sapling"; + +const Test = () => { + return [
A
,
B
]; +}; + +const Component = () => { + return ( +
+
{() => }
+
{() => [, ]}
+ + [ ,,] +
+ ); +}; + +const root = document.getElementById("app")!; + +upsert(root, ); diff --git a/examples/array-test/src/vite-env.d.ts b/examples/array-test/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/examples/array-test/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/array-test/tsconfig.json b/examples/array-test/tsconfig.json new file mode 100644 index 0000000..a227df0 --- /dev/null +++ b/examples/array-test/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist", + "jsx": "react-jsx", + "jsxImportSource": "@idealjs/sapling", + "paths": { + "@idealjs/sapling/*": ["../../packages/core/src/*"] + } + }, + "include": ["src"], + "exclude": ["node_modules"], + "references": [ + { + "path": "../../packages/core" + } + ] +} diff --git a/examples/array-test/vite.config.ts b/examples/array-test/vite.config.ts new file mode 100644 index 0000000..07bc5f3 --- /dev/null +++ b/examples/array-test/vite.config.ts @@ -0,0 +1,12 @@ +import path from "path"; +import { defineConfig } from "vite"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [], + resolve: { + alias: { + "@idealjs/sapling": path.resolve(__dirname, "../../packages/core/src"), + }, + }, +});