Skip to content

Commit

Permalink
vinvoor: lint & format update
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie committed Nov 19, 2024
1 parent ca0c0f1 commit e1494ca
Show file tree
Hide file tree
Showing 88 changed files with 1,898 additions and 971 deletions.
16 changes: 16 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# some (*)nix distros dont have /bin/bash

echo "Frontend linting"
(cd vinvoor && pnpm --silent run precommit:lint)
if [ $? -ne 0 ]; then
echo "Frontend linting failed. Please fix the errors before committing."
exit 1
fi

echo "Frontend typecheck"
(cd vinvoor && pnpm --silent run precommit:typecheck)
if [ $? -ne 0 ]; then
echo "Frontend type checking failed. Please fix the errors before committing."
exit 1
fi
20 changes: 0 additions & 20 deletions .githooks/vinvoor_format_lint

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: Format and linting
name: Vinvoor Format, Lint & Typecheck

on:
push:
branches:
- main
paths:
- .github/workflows/vinvoor_format_lint.yml
- 'vinvoor/**'
pull_request:
paths:
- .github/workflows/vinvoor_format_lint.yml
- 'vinvoor/**'

jobs:
format-and-lint:
Expand All @@ -20,10 +14,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.15.1
node-version: 22.8.0

- name: Install pnpm
run: npm install -g pnpm
Expand All @@ -32,10 +26,10 @@ jobs:
run: pnpm install
working-directory: vinvoor/

- name: Run formatter
run: pnpm prettier --check .
- name: Run format & lint
run: pnpm eslint .
working-directory: vinvoor/

- name: Run Linter
run: pnpm eslint . --max-warnings=0
- name: Run typecheck
run: pnpm tsc --noEmit
working-directory: vinvoor/
18 changes: 0 additions & 18 deletions vinvoor/.eslintrc.cjs

This file was deleted.

4 changes: 0 additions & 4 deletions vinvoor/.prettierrc

This file was deleted.

42 changes: 19 additions & 23 deletions vinvoor/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import { includeIgnoreFile } from "@eslint/compat";
import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import path, { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import tseslint from "typescript-eslint";
import antfu from "@antfu/eslint-config";

const __dirname = dirname(fileURLToPath(import.meta.url));
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
includeIgnoreFile(gitignorePath),
export default antfu(
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
stylistic: {
quotes: "double",
semi: true,
},

react: true,

typescript: {
tsconfigPath: "./tsconfig.json",
},

formatters: true,

rules: {
"react-hooks/exhaustive-deps": "off",
"ts/switch-exhaustiveness-check": "off",
"ts/strict-boolean-expressions": "off",
},
},
{
ignores: ["eslint.config.mjs", ".eslintrc.cjs"],
},
eslintConfigPrettier,
);
6 changes: 2 additions & 4 deletions vinvoor/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "vinvoor",
"private": true,
"version": "0.0.0",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"host": "vite --host",
Expand Down Expand Up @@ -42,8 +42,6 @@
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react-swc": "^3.7.1",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
Loading

0 comments on commit e1494ca

Please sign in to comment.