feat(create-turbo): apply official-starter transform

This commit is contained in:
Turbobot
2025-02-08 13:41:40 -08:00
committed by ryan
parent 9fe2818df8
commit c158dda08f
48 changed files with 5621 additions and 24 deletions
+3
View File
@@ -0,0 +1,3 @@
# `@turbo/eslint-config`
Collection of internal eslint configurations.
+34
View File
@@ -0,0 +1,34 @@
const { resolve } = require("node:path");
const project = resolve(process.cwd(), "tsconfig.json");
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "turbo"],
plugins: ["only-warn"],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
],
overrides: [
{
files: ["*.js?(x)", "*.ts?(x)"],
},
],
};
+42
View File
@@ -0,0 +1,42 @@
const { resolve } = require("node:path");
const project = resolve(process.cwd(), "tsconfig.json");
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
"eslint:recommended",
"prettier",
require.resolve("@vercel/style-guide/eslint/next"),
"turbo",
],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
},
plugins: ["only-warn"],
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
],
overrides: [
{ files: ["*.js?(x)", "*.ts?(x)"] },
{
files: ["*.ts", "*.tsx"],
rules: {
"no-undef": "off",
},
},
],
};
@@ -0,0 +1,20 @@
{
"name": "@repo/eslint-config",
"version": "0.0.0",
"private": true,
"files": [
"library.js",
"next.js",
"react-internal.js",
"server.js"
],
"devDependencies": {
"@vercel/style-guide": "^5.2.0",
"eslint-config-turbo": "^2.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-only-warn": "^1.1.0",
"@typescript-eslint/parser": "^7.1.0",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"typescript": "5.5.4"
}
}
+39
View File
@@ -0,0 +1,39 @@
const { resolve } = require("node:path");
const project = resolve(process.cwd(), "tsconfig.json");
/*
* This is a custom ESLint configuration for use with
* internal (bundled by their consumer) libraries
* that utilize React.
*/
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "turbo"],
plugins: ["only-warn"],
globals: {
React: true,
JSX: true,
},
env: {
browser: true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
],
overrides: [
// Force ESLint to detect .tsx files
{ files: ["*.js?(x)", "*.ts?(x)"] },
],
};
+19
View File
@@ -0,0 +1,19 @@
module.exports = {
extends: ["eslint:recommended"],
env: {
node: true,
es6: true,
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
overrides: [
{
files: ["**/__tests__/**/*"],
env: {
jest: true,
},
},
],
};
@@ -0,0 +1,17 @@
import type { Config } from "jest";
const config = {
roots: ["<rootDir>"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
modulePathIgnorePatterns: [
"<rootDir>/test/__fixtures__",
"<rootDir>/node_modules",
"<rootDir>/dist",
],
preset: "ts-jest",
} as const satisfies Config;
export default config;
+13
View File
@@ -0,0 +1,13 @@
{
"name": "@repo/jest-presets",
"version": "0.0.0",
"private": true,
"license": "MIT",
"files": [
"node/jest-preset.ts"
],
"dependencies": {
"jest": "^29.7.0",
"ts-jest": "^29.2.5"
}
}
+10
View File
@@ -0,0 +1,10 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@repo/eslint-config/react-internal.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
ignorePatterns: ["**/__tests__/"],
};
+30
View File
@@ -0,0 +1,30 @@
{
"name": "@repo/logger",
"version": "0.0.0",
"private": true,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/**"
],
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"dev": "tsc -w",
"lint": "eslint \"src/**/*.ts*\" --max-warnings 0",
"test": "jest"
},
"jest": {
"preset": "@repo/jest-presets/node"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "*",
"@repo/jest-presets": "*",
"@repo/typescript-config": "*",
"@types/node": "^20.11.24",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"typescript": "5.5.4"
}
}
@@ -0,0 +1,11 @@
import { describe, it, expect, jest } from "@jest/globals";
import { log } from "..";
jest.spyOn(global.console, "log");
describe("@repo/logger", () => {
it("prints a message", () => {
log("hello");
expect(console.log).toHaveBeenCalled();
});
});
+3
View File
@@ -0,0 +1,3 @@
export const log = (str: any) => {
console.log("logger: " + str);
};
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"lib": ["ES2015", "DOM"],
"outDir": "./dist",
"rootDir": "./src",
"types": ["jest", "node"]
},
"include": ["src"],
"exclude": ["node_modules"]
}
@@ -0,0 +1,3 @@
# `tsconfig`
These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from.
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
},
"exclude": ["node_modules"]
}
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}
@@ -0,0 +1,9 @@
{
"name": "@repo/typescript-config",
"version": "0.0.0",
"private": true,
"license": "MIT",
"publishConfig": {
"access": "public"
}
}
@@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"lib": ["ES2015"],
"target": "ES6",
"jsx": "react-jsx"
},
"exclude": ["node_modules"]
}
+9
View File
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@repo/eslint-config/react-internal.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
+21
View File
@@ -0,0 +1,21 @@
{
"name": "@repo/ui",
"version": "0.0.0",
"exports": {
"./button": "./src/button.tsx"
},
"scripts": {
"lint": "eslint \"**/*.ts*\" --max-warnings 0"
},
"devDependencies": {
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"eslint": "^8.57.0",
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"typescript": "5.5.4"
},
"dependencies": {
"react": "^18.2.0"
}
}
+7
View File
@@ -0,0 +1,7 @@
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children: React.ReactNode;
}
export const Button = ({ children, ...rest }: ButtonProps) => {
return <button {...rest}>{children}</button>;
};
+5
View File
@@ -0,0 +1,5 @@
{
"extends": "@repo/typescript-config/react-library.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}