Skip to content

Commit

Permalink
Merge pull request #7 from Kavian77/setup-prettier-and-husky
Browse files Browse the repository at this point in the history
Setup Prettier and Husky
  • Loading branch information
Kavian77 authored Dec 26, 2024
2 parents aa839b7 + 63a919f commit 5c67788
Show file tree
Hide file tree
Showing 28 changed files with 778 additions and 95 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,7 +15,7 @@ jobs:

- name: Cache turbo build setup
uses: actions/cache@v4
with:
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
Expand All @@ -25,17 +25,22 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Run tests
run: npm run test

- name: Lint
run: npm run lint

- name: Check types
run: npm run check-types

- name: Check formatting
run: npm run check-formatting
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npm run check-types
lint-staged
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
dist
node_modules
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
11 changes: 8 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import noOnlyTestsPlugin from "eslint-plugin-no-only-tests";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";

export default tseslint.config(
{ ignores: ["dist"] },
{ ignores: ["**/dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
Expand All @@ -18,5 +23,5 @@ export default tseslint.config(
rules: {
"no-only-tests/no-only-tests": "error",
},
}
},
);
2 changes: 1 addition & 1 deletion examples/react/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>
</StrictMode>,
);
2 changes: 1 addition & 1 deletion examples/react/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"paths": {
/* TODO: Remove these when the packages are published */
"@cluesive/core": ["../../packages/core/src"],
"@cluesive/click-tracker": ["../../packages/trackers/click-tracker/src"],
"@cluesive/click-tracker": ["../../packages/trackers/click-tracker/src"]
}
},
"include": ["src", "../../packages/*/src"]
}
}
8 changes: 4 additions & 4 deletions examples/react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
// TODO: Remove these once the packages are published
'@cluesive/core': '../../../packages/core/src',
'@cluesive/click-tracker': '../../../packages/trackers/click-tracker/src',
"@cluesive/core": "../../../packages/core/src",
"@cluesive/click-tracker": "../../../packages/trackers/click-tracker/src",
},
},
});
Loading

0 comments on commit 5c67788

Please sign in to comment.