diff options
Diffstat (limited to 'examples/with-create-react-app/packages')
12 files changed, 147 insertions, 0 deletions
diff --git a/examples/with-create-react-app/packages/eslint-config-custom/index.js b/examples/with-create-react-app/packages/eslint-config-custom/index.js new file mode 100644 index 0000000..74c5b1e --- /dev/null +++ b/examples/with-create-react-app/packages/eslint-config-custom/index.js @@ -0,0 +1,16 @@ +module.exports = { + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended", + "turbo", + "prettier", + ], + plugins: ["@typescript-eslint"], + parser: "@typescript-eslint/parser", + settings: { + react: { + version: "detect", + }, + }, +}; diff --git a/examples/with-create-react-app/packages/eslint-config-custom/package.json b/examples/with-create-react-app/packages/eslint-config-custom/package.json new file mode 100644 index 0000000..8eb5702 --- /dev/null +++ b/examples/with-create-react-app/packages/eslint-config-custom/package.json @@ -0,0 +1,16 @@ +{ + "name": "eslint-config-custom", + "version": "0.0.0", + "license": "MIT", + "main": "index.js", + "dependencies": { + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-react": "^7.30.1", + "eslint-config-turbo": "latest" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/examples/with-create-react-app/packages/tsconfig/README.md b/examples/with-create-react-app/packages/tsconfig/README.md new file mode 100644 index 0000000..6ef3b81 --- /dev/null +++ b/examples/with-create-react-app/packages/tsconfig/README.md @@ -0,0 +1,3 @@ +# `tsconfig` + +This is the Turborepo shared `tsconfig.json` from which all others `tsconfig.json`s inherit from. Making changes to this may have unintended consequences. diff --git a/examples/with-create-react-app/packages/tsconfig/base.json b/examples/with-create-react-app/packages/tsconfig/base.json new file mode 100644 index 0000000..d72a9f3 --- /dev/null +++ b/examples/with-create-react-app/packages/tsconfig/base.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Default", + "compilerOptions": { + "composite": false, + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "inlineSources": false, + "isolatedModules": true, + "moduleResolution": "node", + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "skipLibCheck": true, + "strict": true + }, + "exclude": ["node_modules"] +} diff --git a/examples/with-create-react-app/packages/tsconfig/package.json b/examples/with-create-react-app/packages/tsconfig/package.json new file mode 100644 index 0000000..6efb83e --- /dev/null +++ b/examples/with-create-react-app/packages/tsconfig/package.json @@ -0,0 +1,9 @@ +{ + "name": "tsconfig", + "version": "0.0.0", + "private": true, + "license": "MIT", + "publishConfig": { + "access": "public" + } +} diff --git a/examples/with-create-react-app/packages/tsconfig/react-app.json b/examples/with-create-react-app/packages/tsconfig/react-app.json new file mode 100644 index 0000000..6af1347 --- /dev/null +++ b/examples/with-create-react-app/packages/tsconfig/react-app.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Next.js", + "extends": "./base.json", + "compilerOptions": { + "allowJs": true, + "declaration": false, + "declarationMap": false, + "incremental": true, + "jsx": "preserve", + "lib": ["dom", "dom.iterable", "esnext"], + "module": "esnext", + "noEmit": true, + "resolveJsonModule": true, + "target": "es5" + } +} diff --git a/examples/with-create-react-app/packages/tsconfig/react-library.json b/examples/with-create-react-app/packages/tsconfig/react-library.json new file mode 100644 index 0000000..af8711c --- /dev/null +++ b/examples/with-create-react-app/packages/tsconfig/react-library.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "React Library", + "extends": "./base.json", + "compilerOptions": { + "jsx": "react-jsx", + "lib": ["ES2015"], + "module": "ESNext", + "target": "es6" + } +} diff --git a/examples/with-create-react-app/packages/ui/.eslintrc.js b/examples/with-create-react-app/packages/ui/.eslintrc.js new file mode 100644 index 0000000..3f6c1e9 --- /dev/null +++ b/examples/with-create-react-app/packages/ui/.eslintrc.js @@ -0,0 +1 @@ +module.exports = require("../eslint-config-custom"); diff --git a/examples/with-create-react-app/packages/ui/package.json b/examples/with-create-react-app/packages/ui/package.json new file mode 100644 index 0000000..e9aedab --- /dev/null +++ b/examples/with-create-react-app/packages/ui/package.json @@ -0,0 +1,25 @@ +{ + "name": "ui", + "version": "0.0.0", + "private": true, + "license": "MIT", + "sideEffects": false, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "scripts": { + "build": "tsup src/index.tsx --format cjs --dts --external react", + "clean": "rm -rf dist", + "dev": "tsup src/index.tsx --format cjs --watch --dts --external react", + "lint": "eslint \"src/**/*.ts*\"" + }, + "devDependencies": { + "@types/react": "^17.0.13", + "@types/react-dom": "^17.0.8", + "eslint": "^8.4.1", + "eslint-config-custom": "workspace:*", + "react": "^17.0.2", + "tsconfig": "workspace:*", + "tsup": "^5.10.1", + "typescript": "^4.5.3" + } +} diff --git a/examples/with-create-react-app/packages/ui/src/Link.tsx b/examples/with-create-react-app/packages/ui/src/Link.tsx new file mode 100644 index 0000000..416bac8 --- /dev/null +++ b/examples/with-create-react-app/packages/ui/src/Link.tsx @@ -0,0 +1,20 @@ +import * as React from "react"; + +interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> { + children: React.ReactNode; + href: string; +} + +export const Link = (props: LinkProps) => { + const { children, href, ...rest } = props; + + if (rest.target === "_blank") { + rest.rel = "noopener noreferrer"; + } + + return ( + <a href={href} {...rest}> + {children} + </a> + ); +}; diff --git a/examples/with-create-react-app/packages/ui/src/index.tsx b/examples/with-create-react-app/packages/ui/src/index.tsx new file mode 100644 index 0000000..c7aa624 --- /dev/null +++ b/examples/with-create-react-app/packages/ui/src/index.tsx @@ -0,0 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import * as React from "react"; + +export * from "./Link"; diff --git a/examples/with-create-react-app/packages/ui/tsconfig.json b/examples/with-create-react-app/packages/ui/tsconfig.json new file mode 100644 index 0000000..ad010d9 --- /dev/null +++ b/examples/with-create-react-app/packages/ui/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "tsconfig/react-library.json", + "include": ["."], + "exclude": ["dist", "node_modules"] +} |
