Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: setup prettier, eslint, conventional commits, prevent push to main branch #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm commitlint --edit $1

branch="$(git rev-parse --abbrev-ref HEAD)"

color_red="$(tput setaf 1)"
bold="$(tput bold)"
reset="$(tput sgr0)"

if [ "$branch" = "main" ]; then
echo "${color_red}${bold}You can't commit directly to the main branch${reset}"
exit 1
fi

4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
ahmadshaheer marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'*.{json,md,yml}': ['prettier --write'],
};
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
.turbo
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
trailingComma: 'all',
useTabs: true,
tabWidth: 1,
singleQuote: true,
jsxSingleQuote: false,
semi: true,
};
70 changes: 35 additions & 35 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"name": "docs",
"version": "0.1.18",
"type": "module",
"private": true,
"scripts": {
"dev": "storybook dev -p 6006",
"build": "storybook build --docs",
"preview-storybook": "serve storybook-static",
"clean": "rm -rf .turbo && rm -rf node_modules",
"lint": "eslint ./stories/*.stories.tsx --max-warnings 0"
},
"dependencies": {
"@signozhq/button": "workspace:*",
"@signozhq/input": "workspace:*",
"@signozhq/tailwind-config": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@storybook/addon-actions": "^8.3.3",
"@storybook/addon-designs": "^8.0.3",
"@storybook/addon-essentials": "^8.3.3",
"@storybook/addon-links": "^8.3.3",
"@storybook/react": "^8.3.3",
"@storybook/react-vite": "^8.3.3",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^9.11.0",
"serve": "^14.2.1",
"storybook": "^8.3.3",
"typescript": "^5.3.3",
"vite": "^5.1.4"
}
"name": "docs",
"version": "0.1.18",
"type": "module",
"private": true,
"scripts": {
"dev": "storybook dev -p 6006",
"build": "storybook build --docs",
"preview-storybook": "serve storybook-static",
"clean": "rm -rf .turbo && rm -rf node_modules",
"lint": "eslint . --ext ./stories/*.stories.tsx --fix && prettier --write ."
},
"dependencies": {
"@signozhq/button": "workspace:*",
"@signozhq/input": "workspace:*",
"@signozhq/tailwind-config": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@storybook/addon-actions": "^8.3.3",
"@storybook/addon-designs": "^8.0.3",
"@storybook/addon-essentials": "^8.3.3",
"@storybook/addon-links": "^8.3.3",
"@storybook/react": "^8.3.3",
"@storybook/react-vite": "^8.3.3",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^9.11.0",
"serve": "^14.2.1",
"storybook": "^8.3.3",
"typescript": "^5.3.3",
"vite": "^5.1.4"
}
}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ['@commitlint/config-conventional'] };
12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';

export default [
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
];
52 changes: 32 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
{
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"changeset": "changeset",
"version-packages": "changeset version",
"update-version": "changeset && changeset version",
"release": "turbo run build --filter=docs^... && changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"inquirer": "^11.0.2",
"prettier": "^3.2.5",
"turbo": "^2.1.2"
},
"packageManager": "[email protected]",
"name": "design-system"
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"changeset": "changeset",
"version-packages": "changeset version",
"update-version": "changeset && changeset version",
"release": "turbo run build --filter=docs^... && changeset publish",
"prepare": "husky install",
"pre-commit": "lint-staged"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we setup typecheck and prettier for this repo ?

},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@eslint/js": "^9.9.0",
"eslint": "^9.11.0",
"eslint-plugin-react": "^7.37.1",
"globals": "^15.9.0",
"husky": "^8.0.0",
"inquirer": "^11.0.2",
"lint-staged": "^15.2.10",
"prettier": "^3.2.5",
"turbo": "^2.1.2",
"typescript-eslint": "^8.0.1"
},
"packageManager": "[email protected]",
"name": "design-system",
"type": "module"
}
108 changes: 54 additions & 54 deletions packages/button/package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
{
"name": "@signozhq/button",
"version": "0.0.0",
"sideEffects": false,
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./dist/button.d.ts",
"import": "./dist/button.js"
}
},
"main": "./dist/button.js",
"module": "./dist/button.js",
"types": "./dist/button.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "vite build",
"dev": "vite build --watch",
"lint": "eslint . --max-warnings 0",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@signozhq/tailwind-config": "workspace:*",
"@types/node": "^22.5.5",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.11.0",
"postcss": "^8.4.47",
"react-dom": "^18.2.0",
"tailwindcss": "^3.4.12",
"typescript": "^5.3.3",
"vite": "^5.0.0",
"vite-plugin-lib-inject-css": "^2.1.1",
"vite-plugin-dts": "^4.2.1"
},
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.445.0",
"react": "^18.2.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7"
},
"publishConfig": {
"access": "public"
}
"name": "@signozhq/button",
"version": "0.0.0",
"sideEffects": false,
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./dist/button.d.ts",
"import": "./dist/button.js"
}
},
"main": "./dist/button.js",
"module": "./dist/button.js",
"types": "./dist/button.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "vite build",
"dev": "vite build --watch",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx --fix && prettier --write .",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@signozhq/tailwind-config": "workspace:*",
"@types/node": "^22.5.5",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.11.0",
"postcss": "^8.4.47",
"react-dom": "^18.2.0",
"tailwindcss": "^3.4.12",
"typescript": "^5.3.3",
"vite": "^5.0.0",
"vite-plugin-lib-inject-css": "^2.1.1",
"vite-plugin-dts": "^4.2.1"
},
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.445.0",
"react": "^18.2.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7"
},
"publishConfig": {
"access": "public"
}
}
Loading