diff options
Diffstat (limited to 'tooling')
| -rw-r--r-- | tooling/eslint/base.js | 43 | ||||
| -rw-r--r-- | tooling/eslint/nextjs.js | 10 | ||||
| -rw-r--r-- | tooling/eslint/package.json | 42 | ||||
| -rw-r--r-- | tooling/eslint/react.js | 24 | ||||
| -rw-r--r-- | tooling/eslint/tsconfig.json | 8 | ||||
| -rw-r--r-- | tooling/github/package.json | 3 | ||||
| -rw-r--r-- | tooling/github/setup/action.yml | 19 | ||||
| -rw-r--r-- | tooling/prettier/index.js | 36 | ||||
| -rw-r--r-- | tooling/prettier/package.json | 24 | ||||
| -rw-r--r-- | tooling/prettier/tsconfig.json | 8 | ||||
| -rw-r--r-- | tooling/tailwind/base.ts | 48 | ||||
| -rw-r--r-- | tooling/tailwind/native.ts | 9 | ||||
| -rw-r--r-- | tooling/tailwind/package.json | 37 | ||||
| -rw-r--r-- | tooling/tailwind/tsconfig.json | 8 | ||||
| -rw-r--r-- | tooling/tailwind/web.ts | 40 | ||||
| -rw-r--r-- | tooling/typescript/base.json | 21 | ||||
| -rw-r--r-- | tooling/typescript/node.json | 14 | ||||
| -rw-r--r-- | tooling/typescript/package.json | 9 |
18 files changed, 403 insertions, 0 deletions
diff --git a/tooling/eslint/base.js b/tooling/eslint/base.js new file mode 100644 index 00000000..d1f6296c --- /dev/null +++ b/tooling/eslint/base.js @@ -0,0 +1,43 @@ +/** @type {import("eslint").Linter.Config} */ +const config = { + extends: [ + "turbo", + "eslint:recommended", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + ], + 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: [ + "**/*.config.js", + "**/*.config.cjs", + "**/.eslintrc.cjs", + ".next", + "dist", + "pnpm-lock.yaml", + ], + reportUnusedDisableDirectives: true, +}; + +module.exports = config; diff --git a/tooling/eslint/nextjs.js b/tooling/eslint/nextjs.js new file mode 100644 index 00000000..169993e3 --- /dev/null +++ b/tooling/eslint/nextjs.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +const config = { + extends: ["plugin:@next/next/core-web-vitals"], + rules: { + "@next/next/no-html-link-for-pages": "off", + "@typescript-eslint/require-await": "off", + }, +}; + +module.exports = config; diff --git a/tooling/eslint/package.json b/tooling/eslint/package.json new file mode 100644 index 00000000..5329f6d2 --- /dev/null +++ b/tooling/eslint/package.json @@ -0,0 +1,42 @@ +{ + "name": "@hoarder/eslint-config", + "version": "0.2.0", + "private": true, + "license": "MIT", + "files": [ + "./base.js", + "./nextjs.js", + "./react.js" + ], + "scripts": { + "clean": "rm -rf .turbo node_modules", + "format": "prettier --check . --ignore-path ../../.gitignore", + "lint": "eslint .", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "@next/eslint-plugin-next": "^14.1.1", + "@typescript-eslint/eslint-plugin": "^7.2.0", + "@typescript-eslint/parser": "^7.2.0", + "eslint-config-turbo": "^1.12.4", + "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": { + "@hoarder/prettier-config": "workspace:^0.1.0", + "@hoarder/tsconfig": "workspace:^0.1.0", + "@types/eslint": "^8.56.5", + "eslint": "^8.57.0", + "prettier": "^3.2.5", + "typescript": "^5.3.3" + }, + "eslintConfig": { + "root": true, + "extends": [ + "./base.js" + ] + }, + "prettier": "@hoarder/prettier-config" +}
\ No newline at end of file diff --git a/tooling/eslint/react.js b/tooling/eslint/react.js new file mode 100644 index 00000000..618e1816 --- /dev/null +++ b/tooling/eslint/react.js @@ -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; diff --git a/tooling/eslint/tsconfig.json b/tooling/eslint/tsconfig.json new file mode 100644 index 00000000..dcbd7d30 --- /dev/null +++ b/tooling/eslint/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@hoarder/tsconfig/base.json", + "compilerOptions": { + "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json" + }, + "include": ["."], + "exclude": ["node_modules"] +} diff --git a/tooling/github/package.json b/tooling/github/package.json new file mode 100644 index 00000000..42e5fc74 --- /dev/null +++ b/tooling/github/package.json @@ -0,0 +1,3 @@ +{ + "name": "@hoarder/github" +} diff --git a/tooling/github/setup/action.yml b/tooling/github/setup/action.yml new file mode 100644 index 00000000..9a8ff513 --- /dev/null +++ b/tooling/github/setup/action.yml @@ -0,0 +1,19 @@ +name: "Setup and install" +description: "Common setup steps for Actions" + +runs: + using: composite + steps: + - uses: pnpm/action-setup@v2 + - uses: actions/setup-node@v4 + with: + node-version: 21 + cache: "pnpm" + + - shell: bash + run: pnpm add -g turbo + + - shell: bash + run: pnpm install + env: + PUPPETEER_SKIP_DOWNLOAD: "true" diff --git a/tooling/prettier/index.js b/tooling/prettier/index.js new file mode 100644 index 00000000..08618ae6 --- /dev/null +++ b/tooling/prettier/index.js @@ -0,0 +1,36 @@ +import { fileURLToPath } from "url"; + +/** @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: fileURLToPath( + new URL("../../tooling/tailwind/web.ts", import.meta.url), + ), + tailwindFunctions: ["cn", "cva"], + importOrder: [ + "<TYPES>", + "^(react/(.*)$)|^(react$)|^(react-native(.*)$)", + "^(next/(.*)$)|^(next$)", + "^(expo(.*)$)|^(expo$)", + "<THIRD_PARTY_MODULES>", + "", + "<TYPES>^@hoarder", + "^@hoarder/(.*)$", + "", + "<TYPES>^[.|..|~]", + "^~/", + "^[../]", + "^[./]", + ], + importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"], + importOrderTypeScriptVersion: "4.4.0", +}; + +export default config; diff --git a/tooling/prettier/package.json b/tooling/prettier/package.json new file mode 100644 index 00000000..e16a183d --- /dev/null +++ b/tooling/prettier/package.json @@ -0,0 +1,24 @@ +{ + "name": "@hoarder/prettier-config", + "private": true, + "version": "0.1.0", + "type": "module", + "exports": { + ".": "./index.js" + }, + "scripts": { + "clean": "rm -rf .turbo node_modules", + "format": "prettier --check . --ignore-path ../../.gitignore", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "@ianvs/prettier-plugin-sort-imports": "^4.1.1", + "prettier": "^3.2.5", + "prettier-plugin-tailwindcss": "^0.5.11" + }, + "devDependencies": { + "@hoarder/tsconfig": "workspace:^0.1.0", + "typescript": "^5.3.3" + }, + "prettier": "@hoarder/prettier-config" +} diff --git a/tooling/prettier/tsconfig.json b/tooling/prettier/tsconfig.json new file mode 100644 index 00000000..dcbd7d30 --- /dev/null +++ b/tooling/prettier/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@hoarder/tsconfig/base.json", + "compilerOptions": { + "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json" + }, + "include": ["."], + "exclude": ["node_modules"] +} diff --git a/tooling/tailwind/base.ts b/tooling/tailwind/base.ts new file mode 100644 index 00000000..15fd759a --- /dev/null +++ b/tooling/tailwind/base.ts @@ -0,0 +1,48 @@ +import type { Config } from "tailwindcss"; + +export default { + darkMode: ["class"], + content: ["src/**/*.{ts,tsx}"], + theme: { + extend: { + colors: { + border: "hsl(var(--border))", + input: "hsl(var(--input))", + ring: "hsl(var(--ring))", + background: "hsl(var(--background))", + foreground: "hsl(var(--foreground))", + primary: { + DEFAULT: "hsl(var(--primary))", + foreground: "hsl(var(--primary-foreground))", + }, + secondary: { + DEFAULT: "hsl(var(--secondary))", + foreground: "hsl(var(--secondary-foreground))", + }, + destructive: { + DEFAULT: "hsl(var(--destructive))", + foreground: "hsl(var(--destructive-foreground))", + }, + muted: { + DEFAULT: "hsl(var(--muted))", + foreground: "hsl(var(--muted-foreground))", + }, + accent: { + DEFAULT: "hsl(var(--accent))", + foreground: "hsl(var(--accent-foreground))", + }, + popover: { + DEFAULT: "hsl(var(--popover))", + foreground: "hsl(var(--popover-foreground))", + }, + card: { + DEFAULT: "hsl(var(--card))", + foreground: "hsl(var(--card-foreground))", + }, + }, + borderColor: { + DEFAULT: "hsl(var(--border))", + }, + }, + }, +} satisfies Config; diff --git a/tooling/tailwind/native.ts b/tooling/tailwind/native.ts new file mode 100644 index 00000000..7441221e --- /dev/null +++ b/tooling/tailwind/native.ts @@ -0,0 +1,9 @@ +import type { Config } from "tailwindcss"; + +import base from "./base"; + +export default { + content: base.content, + presets: [base], + theme: {}, +} satisfies Config; diff --git a/tooling/tailwind/package.json b/tooling/tailwind/package.json new file mode 100644 index 00000000..9ee573a5 --- /dev/null +++ b/tooling/tailwind/package.json @@ -0,0 +1,37 @@ +{ + "name": "@hoarder/tailwind-config", + "version": "0.1.0", + "private": true, + "type": "module", + "exports": { + "./native": "./native.ts", + "./web": "./web.ts" + }, + "license": "MIT", + "scripts": { + "clean": "rm -rf .turbo node_modules", + "format": "prettier --check . --ignore-path ../../.gitignore", + "lint": "eslint .", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "postcss": "^8.4.35", + "tailwindcss": "^3.4.1", + "tailwindcss-animate": "^1.0.7" + }, + "devDependencies": { + "@hoarder/eslint-config": "workspace:^0.2.0", + "@hoarder/prettier-config": "workspace:^0.1.0", + "@hoarder/tsconfig": "workspace:^0.1.0", + "eslint": "^8.57.0", + "prettier": "^3.2.5", + "typescript": "^5.3.3" + }, + "eslintConfig": { + "root": true, + "extends": [ + "@hoarder/eslint-config/base" + ] + }, + "prettier": "@hoarder/prettier-config" +} diff --git a/tooling/tailwind/tsconfig.json b/tooling/tailwind/tsconfig.json new file mode 100644 index 00000000..dcbd7d30 --- /dev/null +++ b/tooling/tailwind/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@hoarder/tsconfig/base.json", + "compilerOptions": { + "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json" + }, + "include": ["."], + "exclude": ["node_modules"] +} diff --git a/tooling/tailwind/web.ts b/tooling/tailwind/web.ts new file mode 100644 index 00000000..0729477a --- /dev/null +++ b/tooling/tailwind/web.ts @@ -0,0 +1,40 @@ +import type { Config } from "tailwindcss"; +import animate from "tailwindcss-animate"; + +import base from "./base"; + +export default { + content: base.content, + presets: [base], + theme: { + container: { + center: true, + padding: "2rem", + screens: { + "2xl": "1400px", + }, + }, + extend: { + borderRadius: { + lg: "var(--radius)", + md: "calc(var(--radius) - 2px)", + sm: "calc(var(--radius) - 4px)", + }, + keyframes: { + "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: { + "accordion-down": "accordion-down 0.2s ease-out", + "accordion-up": "accordion-up 0.2s ease-out", + }, + }, + }, + plugins: [animate], +} satisfies Config; diff --git a/tooling/typescript/base.json b/tooling/typescript/base.json new file mode 100644 index 00000000..2708b280 --- /dev/null +++ b/tooling/typescript/base.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "target": "ES2022", + "lib": ["dom", "dom.iterable", "ES2022"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "moduleDetection": "force", + "jsx": "preserve", + "incremental": true, + "noUncheckedIndexedAccess": false + }, + "exclude": ["node_modules", "build", "dist", ".next", ".expo"] +} diff --git a/tooling/typescript/node.json b/tooling/typescript/node.json new file mode 100644 index 00000000..aeda1ffd --- /dev/null +++ b/tooling/typescript/node.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@tsconfig/node21/tsconfig.json", + "include": ["**/*.ts"], + "exclude": ["node_modules", "build", "dist", ".next", ".expo"], + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "node", + "incremental": true, + "isolatedModules": true, + "strict": true, + "esModuleInterop": true + } +} diff --git a/tooling/typescript/package.json b/tooling/typescript/package.json new file mode 100644 index 00000000..e2961b9f --- /dev/null +++ b/tooling/typescript/package.json @@ -0,0 +1,9 @@ +{ + "name": "@hoarder/tsconfig", + "private": true, + "version": "0.1.0", + "files": [ + "base.json", + "node.json" + ] +} |
