Skip to content

Commit 6c6d353

Browse files
committed
feat: setup typescript check, prettier, eslint, conventional commits, prevent push to main branch
1 parent f198b63 commit 6c6d353

15 files changed

+2008
-117
lines changed

.husky/commit-msg

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pnpm commitlint --edit $1
2+
3+
branch="$(git rev-parse --abbrev-ref HEAD)"
4+
5+
color_red="$(tput setaf 1)"
6+
bold="$(tput bold)"
7+
reset="$(tput sgr0)"
8+
9+
if [ "$branch" = "main" ]; then
10+
echo "${color_red}${bold}You can't commit directly to the main branch${reset}"
11+
exit 1
12+
fi

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint-staged

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
public
3+
build
4+
dist

.prettierrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
trailingComma: 'all',
3+
useTabs: true,
4+
tabWidth: 1,
5+
singleQuote: true,
6+
jsxSingleQuote: false,
7+
semi: true,
8+
};

apps/docs/package.json

+36-35
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
{
2-
"name": "docs",
3-
"version": "0.1.18",
4-
"type": "module",
5-
"private": true,
6-
"scripts": {
7-
"dev": "storybook dev -p 6006",
8-
"build": "storybook build --docs",
9-
"preview-storybook": "serve storybook-static",
10-
"clean": "rm -rf .turbo && rm -rf node_modules",
11-
"lint": "eslint ./stories/*.stories.tsx --max-warnings 0"
12-
},
13-
"dependencies": {
14-
"@signozhq/button": "workspace:*",
15-
"@signozhq/input": "workspace:*",
16-
"@signozhq/tailwind-config": "workspace:*",
17-
"react": "^18.2.0",
18-
"react-dom": "^18.2.0"
19-
},
20-
"devDependencies": {
21-
"@chromatic-com/storybook": "^1",
22-
"@repo/eslint-config": "workspace:*",
23-
"@repo/typescript-config": "workspace:*",
24-
"@storybook/addon-actions": "^8.3.3",
25-
"@storybook/addon-designs": "^8.0.3",
26-
"@storybook/addon-essentials": "^8.3.3",
27-
"@storybook/addon-links": "^8.3.3",
28-
"@storybook/react": "^8.3.3",
29-
"@storybook/react-vite": "^8.3.3",
30-
"@vitejs/plugin-react": "^4.2.1",
31-
"eslint": "^9.11.0",
32-
"serve": "^14.2.1",
33-
"storybook": "^8.3.3",
34-
"typescript": "^5.3.3",
35-
"vite": "^5.1.4"
36-
}
2+
"name": "docs",
3+
"version": "0.1.18",
4+
"type": "module",
5+
"private": true,
6+
"scripts": {
7+
"dev": "storybook dev -p 6006",
8+
"build": "storybook build --docs",
9+
"preview-storybook": "serve storybook-static",
10+
"clean": "rm -rf .turbo && rm -rf node_modules",
11+
"lint": "eslint ./stories/*.stories.tsx --max-warnings 0"
12+
},
13+
"dependencies": {
14+
"@signozhq/button": "workspace:*",
15+
"@signozhq/input": "workspace:*",
16+
"@signozhq/tailwind-config": "workspace:*",
17+
"react": "^18.2.0",
18+
"react-dom": "^18.2.0"
19+
},
20+
"devDependencies": {
21+
"@chromatic-com/storybook": "^1",
22+
"@repo/eslint-config": "workspace:*",
23+
"@repo/typescript-config": "workspace:*",
24+
"@storybook/addon-actions": "^8.3.3",
25+
"@storybook/addon-designs": "^8.0.3",
26+
"@storybook/addon-essentials": "^8.3.3",
27+
"@storybook/addon-links": "^8.3.3",
28+
"@storybook/react": "^8.3.3",
29+
"@storybook/react-vite": "^8.3.3",
30+
"@types/react": "^18.3.11",
31+
"@vitejs/plugin-react": "^4.2.1",
32+
"eslint": "^9.11.0",
33+
"serve": "^14.2.1",
34+
"storybook": "^8.3.3",
35+
"typescript": "^5.3.3",
36+
"vite": "^5.1.4"
37+
}
3738
}

apps/docs/tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "@repo/typescript-config/react-app.json",
3-
"include": ["."],
4-
"exclude": ["dist", "build", "node_modules"]
2+
"extends": "@repo/typescript-config/react-library.json",
3+
"include": ["."],
4+
"exclude": ["dist", "build", "node_modules"]
55
}

apps/packages-playground/src/main.tsx

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
import { StrictMode } from "react";
2-
import { createRoot } from "react-dom/client";
3-
import App from "./App.tsx";
4-
import "./index.css";
5-
import { ThemeProvider, useTheme } from "@signozhq/theme";
1+
import React from 'react';
2+
import { StrictMode } from 'react';
3+
import { createRoot } from 'react-dom/client';
4+
import App from './App';
5+
import './index.css';
6+
import { ThemeProvider, useTheme } from '@signozhq/theme';
67

78
function ThemedApp() {
8-
const { theme } = useTheme();
9+
const { theme } = useTheme();
910

10-
return (
11-
<div className={`app ${theme}`}>
12-
<App />
13-
</div>
14-
);
11+
return (
12+
<div className={`app ${theme}`}>
13+
<App />
14+
</div>
15+
);
1516
}
1617

17-
createRoot(document.getElementById("root")!).render(
18-
<StrictMode>
19-
<ThemeProvider>
20-
<ThemedApp />
21-
</ThemeProvider>
22-
</StrictMode>
18+
createRoot(document.getElementById('root')!).render(
19+
<StrictMode>
20+
<ThemeProvider>
21+
<ThemedApp />
22+
</ThemeProvider>
23+
</StrictMode>,
2324
);

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ['@commitlint/config-conventional'] };

eslint.config.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import pluginReact from 'eslint-plugin-react';
5+
6+
export default [
7+
{
8+
ignores: [
9+
'dist',
10+
'node_modules',
11+
'packages/**/dist',
12+
'apps/**/dist',
13+
'packages/**/node_modules',
14+
'apps/**/node_modules',
15+
],
16+
},
17+
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
18+
{ languageOptions: { globals: globals.browser } },
19+
pluginJs.configs.recommended,
20+
...tseslint.configs.recommended,
21+
pluginReact.configs.flat.recommended,
22+
];

package.json

+47-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
{
2-
"private": true,
3-
"scripts": {
4-
"build": "turbo run build",
5-
"dev": "turbo run dev",
6-
"lint": "turbo run lint",
7-
"clean": "turbo run clean && rm -rf node_modules",
8-
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
9-
"changeset": "changeset",
10-
"version-packages": "changeset version",
11-
"update-version": "changeset && changeset version",
12-
"release": "turbo run build --filter=docs^... && changeset publish"
13-
},
14-
"devDependencies": {
15-
"@changesets/cli": "^2.27.1",
16-
"inquirer": "^11.0.2",
17-
"prettier": "^3.2.5",
18-
"turbo": "^2.1.2"
19-
},
20-
"packageManager": "[email protected]",
21-
"name": "design-system"
2+
"private": true,
3+
"type": "module",
4+
"scripts": {
5+
"build": "turbo run build",
6+
"dev": "turbo run dev",
7+
"lint": "turbo run lint",
8+
"clean": "turbo run clean && rm -rf node_modules",
9+
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
10+
"changeset": "changeset",
11+
"version-packages": "changeset version",
12+
"update-version": "changeset && changeset version",
13+
"release": "turbo run build --filter=docs^... && changeset publish",
14+
"prepare": "husky",
15+
"pre-commit": "lint-staged"
16+
},
17+
"lint-staged": {
18+
"*.{js, jsx,ts,tsx}": [
19+
"sh scripts/typecheck-staged.sh",
20+
"eslint --quiet --fix",
21+
"prettier --write"
22+
],
23+
"*.{json,js,ts,jsx,tsx,html}": [
24+
"prettier --write --ignore-unknown"
25+
]
26+
},
27+
"devDependencies": {
28+
"@changesets/cli": "^2.27.1",
29+
"@commitlint/cli": "^19.5.0",
30+
"@commitlint/config-conventional": "^19.5.0",
31+
"@eslint/js": "^9.9.0",
32+
"@repo/typescript-config": "workspace:*",
33+
"@turbo/gen": "^2.1.2",
34+
"@types/fs-extra": "^11.0.4",
35+
"eslint": "^9.11.0",
36+
"eslint-plugin-react": "^7.37.1",
37+
"fs-extra": "^11.2.0",
38+
"globals": "^15.9.0",
39+
"husky": "^9.1.6",
40+
"inquirer": "^11.0.2",
41+
"lint-staged": "^15.2.10",
42+
"prettier": "^3.2.5",
43+
"turbo": "^2.1.2",
44+
"typescript": "^5.6.2",
45+
"typescript-eslint": "^8.0.1"
46+
},
47+
"packageManager": "[email protected]",
48+
"name": "design-system"
2249
}
+11-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2-
"$schema": "https://json.schemastore.org/tsconfig",
3-
"display": "React Library",
4-
"extends": "./base.json",
5-
"compilerOptions": {
6-
"jsx": "react-jsx",
7-
"lib": ["dom", "ES2015"],
8-
"module": "ESNext",
9-
"target": "es6"
10-
}
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"display": "React Library",
4+
"extends": "./base.json",
5+
"compilerOptions": {
6+
"jsx": "react-jsx",
7+
"lib": ["dom", "ES2015"],
8+
"module": "ESNext",
9+
"target": "es6",
10+
"noImplicitAny": true,
11+
"noFallthroughCasesInSwitch": true
12+
}
1113
}

0 commit comments

Comments
 (0)