Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
93 changes: 93 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"files": {
"includes": ["**", "!**/cosmos-export", "!**/dist", "!**/package.json"]
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off"
},
"complexity": {
"noForEach": "error",
"useLiteralKeys": "off"
},
"a11y": {
"noAccessKey": "off",
"noAriaHiddenOnFocusable": "off",
"noAriaUnsupportedElements": "off",
"noAutofocus": "off",
"noDistractingElements": "off",
"noHeaderScope": "off",
"noInteractiveElementToNoninteractiveRole": "off",
"noLabelWithoutControl": "off",
"noNoninteractiveElementToInteractiveRole": "off",
"noNoninteractiveTabindex": "off",
"noPositiveTabindex": "off",
"noRedundantAlt": "off",
"noRedundantRoles": "off",
"noStaticElementInteractions": "off",
"noSvgWithoutTitle": "off",
"useAltText": "off",
"useAnchorContent": "off",
"useAriaActivedescendantWithTabindex": "off",
"useAriaPropsForRole": "off",
"useAriaPropsSupportedByRole": "off",
"useButtonType": "off",
"useFocusableInteractive": "off",
"useHeadingContent": "off",
"useHtmlLang": "off",
"useIframeTitle": "off",
"useKeyWithClickEvents": "off",
"useKeyWithMouseEvents": "off",
"useMediaCaption": "off",
"useSemanticElements": "off",
"useValidAnchor": "off",
"useValidAriaProps": "off",
"useValidAriaRole": "off",
"useValidAriaValues": "off",
"useValidAutocomplete": "off",
"useValidLang": "off"
},
"style": {
"useSingleVarDeclarator": "error",
"noParameterAssign": "off",
"noUselessElse": "off",
"noNonNullAssertion": "off",
"useNumberNamespace": "off",
"noUnusedTemplateLiteral": "off",
"useFilenamingConvention": {
"level": "error",
"options": {
"strictCase": true,
"requireAscii": true,
"filenameCases": ["kebab-case", "export"]
}
},
"useAsConstAssertion": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "error",
"useSelfClosingElements": "error",
"noInferrableTypes": "error"
}
}
}
}
5 changes: 5 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# [test]
# preload = ["./tests/fixtures/preload.ts"]

[install.lockfile]
save = false
6 changes: 6 additions & 0 deletions cosmos.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json.schemastore.org/cosmos-config",
"plugins": ["react-cosmos-plugin-vite"],
"fixtureFileSuffix": "page",
"decoratorFile": "cosmos.decorator.tsx"
}
21 changes: 21 additions & 0 deletions cosmos.decorator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { useEffect } from "react"

export const TailwindDecorator = ({
children,
}: {
children: React.ReactNode
}) => {
useEffect(() => {
const script = document.createElement("script")
script.src = "https://cdn.tailwindcss.com"
document.head.appendChild(script)

return () => {
document.head.removeChild(script)
}
}, [])

return <>{children}</>
}

export default TailwindDecorator
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Cosmos Vite Renderer</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "trace-capacity-visualizer",
"private": true,
"scripts":{
"start": "cosmos"
},
"devDependencies": {
"@types/bun": "latest",
"react": "^19.2.0",
"react-cosmos": "^7.0.0",
"react-cosmos-plugin-vite": "^7.0.0",
"react-dom": "^19.2.0",
"vite": "^7.2.2"
},
"peerDependencies": {
"typescript": "^5"
}
}
3 changes: 3 additions & 0 deletions pages/example01.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Example01() {
return "hi"
}
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}