diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7feefc4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = false + +[*.{js,ts}] +indent_style = tab +indent_size = 4 + +[{*.{yml,mjs,json}}] +indent_style = space +indent_size = 2 + diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..36af84b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# Package Managers +package-lock.json +pnpm-lock.yaml +yarn.lock +*.md + diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..8a8a39f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,21 @@ +{ + "useTabs": true, + "singleQuote": true, + "trailingComma": "es5", + "printWidth": 100, + "endOfLine": "lf", + "arrowParens": "always", + "jsxSingleQuote": false, + "semi": true, + "quoteProps": "as-needed", + "tabWidth": 4, + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ] +} diff --git a/bun.lock b/bun.lock index 1cb5417..d9701b2 100644 --- a/bun.lock +++ b/bun.lock @@ -24,6 +24,7 @@ "@storybook/test": "^8.5.0", "@sveltejs/kit": "^2.15.2", "@sveltejs/package": "^2.3.9", + "@sveltejs/vite-plugin-svelte": "^5.0.3", "@types/bun": "latest", "eslint": "^9.7.0", "eslint-config-prettier": "^9.1.0", @@ -33,6 +34,7 @@ "prettier-plugin-tailwindcss": "^0.6.5", "storybook": "^8.5.0", "svelte-check": "^4.0.0", + "vite": "^6.0.7", }, "peerDependencies": { "clsx": "^2.1.1", diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e0f8ed2 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,55 @@ +import prettier from "eslint-config-prettier"; +import js from "@eslint/js"; +import { includeIgnoreFile } from "@eslint/compat"; +import svelte from "eslint-plugin-svelte"; +import globals from "globals"; +import { fileURLToPath } from "node:url"; +import ts from "typescript-eslint"; +const gitignorePath = fileURLToPath(new URL("./.gitignore", import.meta.url)); + +export default ts.config( + includeIgnoreFile(gitignorePath), + js.configs.recommended, + ...ts.configs.recommended, + ...svelte.configs["flat/recommended"], + prettier, + ...svelte.configs["flat/prettier"], + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + }, + { + files: ["**/*.svelte"], + + languageOptions: { + parserOptions: { + parser: ts.parser, + }, + }, + }, + { + rules: { + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], + "no-restricted-syntax": [ + "error", + { + selector: + 'CallExpression:matches([callee.object.object.name="prisma"], [callee.object.object.name="prismaTransactionClient"], [callee.object.object.name="transactionClient"]):matches([callee.property.name="findFirst"], [callee.property.name="findMany"], [callee.property.name="updateMany"], [callee.property.name="deleteMany"], [callee.property.name="count"], [callee.property.name="aggregate"], [callee.property.name="groupBy"]):not(:has(ObjectExpression > Property[key.name="where"] > ObjectExpression > Property[key.name="tenantId"]))', + message: + "Please filter on the current tenant when using findFirst, findMany, updateMany, deleteMany, count, aggregate or groupBy.", + }, + ], + }, + }, +); diff --git a/package.json b/package.json index 50d0077..7b1ef9d 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,25 @@ { - "name": "@atlas/monorepo", - "version": "1.0.0", - "type": "module", - "workspaces": [ - "packages/svelte-components" - ], - "devDependencies": { - "@types/bun": "latest" - } -} + "name": "atlas-monorepo", + "version": "1.0.0", + "type": "module", + "workspaces": [ + "packages/svelte-components" + ], + "scripts": { + "format": "prettier --write .", + "lint": "prettier --check . && eslint .", + "prepare": "husky" + }, + "devDependencies": { + "@eslint/compat": "^1.2.3", + "@types/bun": "latest", + "eslint": "^9.7.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.36.0", + "husky": "^9.1.7", + "lint-staged": "^15.3.0", + "prettier": "^3.3.2", + "prettier-plugin-svelte": "^3.2.6", + "prettier-plugin-tailwindcss": "^0.6.5" + } +} \ No newline at end of file