This commit is contained in:
Turbobot
2024-03-21 13:41:16 +08:00
committed by giancarlo
commit bb58169fe9
204 changed files with 26228 additions and 0 deletions

46
tooling/eslint/base.js Normal file
View File

@@ -0,0 +1,46 @@
/** @type {import("eslint").Linter.Config} */
const config = {
extends: [
"turbo",
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"prettier",
],
env: {
es2022: true,
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint", "import"],
rules: {
"turbo/no-undeclared-env-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/consistent-type-imports": [
"warn",
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
],
"@typescript-eslint/no-misused-promises": [
2,
{ checksVoidReturn: { attributes: false } },
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
},
ignorePatterns: [
"**/.eslintrc.cjs",
"**/*.config.js",
"**/*.config.cjs",
".next",
"dist",
"pnpm-lock.yaml",
],
reportUnusedDisableDirectives: true,
};
module.exports = config;

9
tooling/eslint/nextjs.js Normal file
View File

@@ -0,0 +1,9 @@
/** @type {import('eslint').Linter.Config} */
const config = {
extends: ["plugin:@next/next/recommended"],
rules: {
"@next/next/no-html-link-for-pages": "off",
},
};
module.exports = config;

View File

@@ -0,0 +1,42 @@
{
"name": "@acme/eslint-config",
"version": "0.2.0",
"private": true,
"license": "MIT",
"files": [
"./base.js",
"./nextjs.js",
"./react.js"
],
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint .",
"format": "prettier --check \"**/*.{js,json}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@next/eslint-plugin-next": "^14.1.0",
"@types/eslint": "^8.56.2",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.11.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0"
},
"devDependencies": {
"@acme/prettier-config": "^0.1.0",
"@acme/tsconfig": "^0.1.0",
"eslint": "^8.56.0",
"typescript": "^5.3.3"
},
"eslintConfig": {
"root": true,
"extends": [
"./base.js"
]
},
"prettier": "@acme/prettier-config"
}

24
tooling/eslint/react.js vendored Normal file
View File

@@ -0,0 +1,24 @@
/** @type {import('eslint').Linter.Config} */
const config = {
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
rules: {
"react/prop-types": "off",
},
globals: {
React: "writable",
},
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
},
};
module.exports = config;

View File

@@ -0,0 +1,8 @@
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
},
"include": ["."],
"exclude": ["node_modules"],
}

View File

@@ -0,0 +1,28 @@
/** @typedef {import("prettier").Config} PrettierConfig */
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
/** @typedef {import("@ianvs/prettier-plugin-sort-imports").PluginConfig} SortImportsConfig */
/** @type { PrettierConfig | SortImportsConfig | TailwindConfig } */
const config = {
plugins: [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss",
],
tailwindConfig: "../../tooling/tailwind",
importOrder: [
"^(react/(.*)$)|^(react$)|^(react-native(.*)$)",
"^(next/(.*)$)|^(next$)",
"^(expo(.*)$)|^(expo$)",
"<THIRD_PARTY_MODULES>",
"",
"^@acme/(.*)$",
"",
"^~/",
"^[../]",
"^[./]",
],
importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"],
importOrderTypeScriptVersion: "4.4.0",
};
export default config;

View File

@@ -0,0 +1,21 @@
{
"name": "@acme/prettier-config",
"private": true,
"version": "0.1.0",
"main": "index.mjs",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"format": "prettier --check \"**/*.{mjs,json}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"prettier": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11"
},
"devDependencies": {
"@acme/tsconfig": "^0.1.0",
"typescript": "^5.3.3"
},
"prettier": "@acme/prettier-config"
}

View File

@@ -0,0 +1,8 @@
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
},
"include": ["."],
"exclude": ["node_modules"],
}

108
tooling/tailwind/index.ts Normal file
View File

@@ -0,0 +1,108 @@
import type { Config } from "tailwindcss";
import { fontFamily } from "tailwindcss/defaultTheme";
export default {
darkMode: ["class"],
content: ["src/**/*.{ts,tsx}", "components/**/*.{ts,tsx}"],
theme: {
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
},
},
extend: {
borderColor: {
DEFAULT: "hsl(var(--border) / <alpha-value>)",
},
colors: {
border: "hsl(var(--border) / <alpha-value>)",
input: "hsl(var(--input) / <alpha-value>)",
ring: "hsl(var(--ring) / <alpha-value>)",
background: "hsl(var(--background) / <alpha-value>)",
foreground: "hsl(var(--foreground) / <alpha-value>)",
primary: {
DEFAULT: "hsl(var(--primary) / <alpha-value>)",
foreground: "hsl(var(--primary-foreground) / <alpha-value>)",
},
secondary: {
DEFAULT: "hsl(var(--secondary) / <alpha-value>)",
foreground: "hsl(var(--secondary-foreground) / <alpha-value>)",
},
destructive: {
DEFAULT: "hsl(var(--destructive) / <alpha-value>)",
foreground: "hsl(var(--destructive-foreground) / <alpha-value>)",
},
muted: {
DEFAULT: "hsl(var(--muted) / <alpha-value>)",
foreground: "hsl(var(--muted-foreground) / <alpha-value>)",
},
accent: {
DEFAULT: "hsl(var(--accent) / <alpha-value>)",
foreground: "hsl(var(--accent-foreground) / <alpha-value>)",
},
popover: {
DEFAULT: "hsl(var(--popover) / <alpha-value>)",
foreground: "hsl(var(--popover-foreground) / <alpha-value>)",
},
card: {
DEFAULT: "hsl(var(--card) / <alpha-value>)",
foreground: "hsl(var(--card-foreground) / <alpha-value>)",
},
},
borderRadius: {
lg: `var(--radius)`,
md: `calc(var(--radius) - 2px)`,
sm: "calc(var(--radius) - 4px)",
},
fontFamily: {
cal: ["var(--font-cal)", ...fontFamily.sans],
sans: ["var(--font-sans)", ...fontFamily.sans],
},
keyframes: {
"fade-up": {
"0%": {
opacity: "0",
transform: "translateY(10px)",
},
"80%": {
opacity: "0.6",
},
"100%": {
opacity: "1",
transform: "translateY(0px)",
},
},
"fade-down": {
"0%": {
opacity: "0",
transform: "translateY(-10px)",
},
"80%": {
opacity: "0.6",
},
"100%": {
opacity: "1",
transform: "translateY(0px)",
},
},
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
},
animation: {
"fade-up": "fade-up 0.5s",
"fade-down": "fade-down 0.5s",
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [require("tailwindcss-animate")],
} satisfies Config;

View File

@@ -0,0 +1,36 @@
{
"name": "@acme/tailwind-config",
"version": "0.1.0",
"main": "index.ts",
"license": "MIT",
"files": [
"index.ts",
"postcss.js"
],
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint .",
"format": "prettier --check \"**/*.{js,ts,json}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"autoprefixer": "^10.4.17",
"postcss": "8.4.33",
"tailwindcss": "3.4.1"
},
"devDependencies": {
"@acme/eslint-config": "^0.2.0",
"@acme/prettier-config": "^0.1.0",
"@acme/tsconfig": "^0.1.0",
"eslint": "^8.56.0",
"prettier": "^3.2.4",
"typescript": "^5.3.3"
},
"eslintConfig": {
"root": true,
"extends": [
"@acme/eslint-config/base"
]
},
"prettier": "@acme/prettier-config"
}

View File

@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View File

@@ -0,0 +1,8 @@
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
},
"include": ["."],
"exclude": ["node_modules"],
}

View File

@@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noUncheckedIndexedAccess": true
},
"exclude": ["node_modules", "build", "dist", ".next", ".expo"]
}

View File

@@ -0,0 +1,8 @@
{
"name": "@acme/tsconfig",
"private": true,
"version": "0.1.0",
"files": [
"base.json"
]
}