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

chore(github): 🔧 ci cd for checking code style #26

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
101 changes: 0 additions & 101 deletions .eslintrc.json

This file was deleted.

88 changes: 88 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
env:
browser: false
es2021: true
node: true
extends:
- "plugin:react/recommended"
- "plugin:react-hooks/recommended"
- "plugin:jsx-a11y/recommended"
- "plugin:@typescript-eslint/recommended"
- "next/core-web-vitals"
plugins:
- "react"
- "react-hooks"
- "unused-imports"
- "import"
- "@typescript-eslint"
- "jsx-a11y"
parser: '@typescript-eslint/parser'
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: 12
sourceType: module
settings:
react:
version: detect
rules:
no-console: warn
react/prop-types: off
react/jsx-uses-react: off
react/react-in-jsx-scope: off
react-hooks/rules-of-hooks: error
react-hooks/exhaustive-deps: warn
jsx-a11y/click-events-have-key-events: warn
jsx-a11y/interactive-supports-focus: warn
no-unused-vars: off
unused-imports/no-unused-vars: off
unused-imports/no-unused-imports: warn
'@typescript-eslint/no-non-null-asserted-optional-chain': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-unused-vars':
- warn
- args: after-used
ignoreRestSiblings: false
argsIgnorePattern: "^_.*?$"
import/order:
- warn
- groups:
- type
- builtin
- object
- external
- internal
- parent
- sibling
- index
pathGroups:
- pattern: "~/**"
group: external
position: after
newlines-between: always
react/self-closing-comp: warn
react/jsx-sort-props:
- warn
- callbacksLast: true
shorthandFirst: true
noSortAlphabetically: false
reservedFirst: true
padding-line-between-statements:
- warn
- blankLine: always
prev: "*"
next: return
- blankLine: always
prev:
- const
- let
- var
next: "*"
- blankLine: any
prev:
- const
- let
- var
next:
- const
- let
- var
26 changes: 26 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: on-pull-request

on:
pull_request:
branches:
- dev

jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install dependencies
run: npm install

- name: Run lint
run: npm run lint
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

# ide
.idea

certificates
Caddyfile
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

7 changes: 7 additions & 0 deletions .lefthook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
pre-commit:
parallel: true
commands:
eslint:
glob: "*.{js,ts,mjs,cjs,jsx,tsx}"
run: npx eslint {staged_files} --ext .js,.ts,.tsx,.jsx
22 changes: 0 additions & 22 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions components/posts/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export function PostsList({
currentUserId={currentUserId}
hasAccess={hasAccess}
layout={view}
// @ts-ignore
// @ts-expect-error: will improve ts later
post={post}
postType={post.postType}
// @ts-ignore
// @ts-expect-error: will improve ts later
user={post.user!}
/>
</Link>
Expand Down
24 changes: 10 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "eslint . --ext .ts,.tsx --fix -c .eslintrc.json",
"lint": "next lint",
"postinstall": "npx prisma generate",
"format": "prettier --write .",
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
"prepare": "husky"
"prepare": "lefthook install"
},
"dependencies": {
"@auth/prisma-adapter": "^2.4.2",
Expand Down Expand Up @@ -63,6 +62,7 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^1.8.1",
"@types/jsonwebtoken": "^9.0.6",
"@types/lodash": "^4.17.7",
"@types/node": "^20",
Expand All @@ -73,21 +73,17 @@
"all-contributors-cli": "^6.26.1",
"autoprefixer": "10.4.19",
"eslint": "^8.57.1",
"eslint-config-next": "14.2.11",
"eslint-config-prettier": "^8.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-config-next": "14.2.4",
"eslint-config-stylistic": "^0.0.0-0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^3.2.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unused-imports": "^4.1.4",
"gacp": "^3.0.3",
"husky": "^9.1.6",
"lefthook": "^1.7.18",
"lint-staged": "^15.2.10",
"postcss": "^8",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8",
"prisma": "^5.19.0",
"tailwind-variants": "0.1.20",
"tailwindcss": "3.4.3",
Expand Down