Skip to content

Commit

Permalink
ci: backend CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
ugur-eren committed Sep 4, 2024
1 parent 7f425f7 commit 09c8f99
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 125 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Backend

on: [push, pull_request]

permissions: read-all

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
run: yarn install
working-directory: backend

- name: Check formatting
run: yarn format:check
working-directory: backend

- name: Lint
run: yarn lint
working-directory: backend
123 changes: 60 additions & 63 deletions backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,60 @@
module.exports = {
root: true,

env: {
es6: true,
node: true,
},
plugins: ["import", "simple-import-sort", "unused-imports"],
extends: ["eslint:recommended"],
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
},
rules: {
"prettier/prettier": [
"error",
{
semi: false,
singleQuote: true,
printWidth: 120,
},
],
"import/no-unused-modules": ["error", { unusedExports: true }],
"object-shorthand": ["error", "always"],
"unused-imports/no-unused-imports": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
},
overrides: [
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint/eslint-plugin"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-restricted-imports": ["error"],
},
},
{
files: ["*"],
plugins: ["prettier"],
extends: ["plugin:prettier/recommended"],
},
],
};
module.exports = {
root: true,

env: {
es6: true,
node: true,
},
plugins: ['import', 'simple-import-sort', 'unused-imports'],
extends: ['eslint:recommended'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
'prettier/prettier': [
'error',
{
semi: false,
singleQuote: true,
printWidth: 120,
},
],
'import/no-unused-modules': ['error', { unusedExports: true }],
'object-shorthand': ['error', 'always'],
'unused-imports/no-unused-imports': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
overrides: [
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/typescript'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-restricted-imports': ['error'],
},
},
{
files: ['*'],
plugins: ['prettier'],
extends: ['plugin:prettier/recommended'],
},
],
}
6 changes: 6 additions & 0 deletions backend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist/**
build/**
node_modules/**
types/**
drizzle/**
.eslintrc.js
10 changes: 5 additions & 5 deletions backend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120
}
{
"semi": false,
"singleQuote": true,
"printWidth": 120
}
70 changes: 36 additions & 34 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
{
"name": "backend",
"scripts": {
"start": "tsx src/index.ts",
"typecheck": "tsc --noEmit",
"drizzle:generate": "drizzle-kit generate",
"prepare": "yarn drizzle:generate",
"lint": "eslint . --max-warnings=0",
"fix": "eslint . --fix"
},
"dependencies": {
"dotenv": "^16.4.5",
"drizzle-orm": "^0.33.0",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
"postgres": "^3.4.4"
},
"devDependencies": {
"@types/node": "^22.5.3",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^8.4.0",
"drizzle-kit": "^0.24.2",
"eslint": "^8.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-unused-imports": "^3.2.0",
"prettier": "^3.2.5",
"tsx": "^4.19.0",
"typescript": "^5.5.4"
}
}
{
"name": "backend",
"scripts": {
"start": "tsx src/index.ts",
"typecheck": "tsc --noEmit",
"drizzle:generate": "drizzle-kit generate",
"prepare": "yarn drizzle:generate",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint . --max-warnings=0",
"fix": "eslint . --fix"
},
"dependencies": {
"dotenv": "^16.4.5",
"drizzle-orm": "^0.33.0",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
"postgres": "^3.4.4"
},
"devDependencies": {
"@types/node": "^22.5.3",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^8.4.0",
"drizzle-kit": "^0.24.2",
"eslint": "^8.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-unused-imports": "^3.2.0",
"prettier": "^3.2.5",
"tsx": "^4.19.0",
"typescript": "^5.5.4"
}
}
46 changes: 23 additions & 23 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"types": []
}
}
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"types": []
}
}

0 comments on commit 09c8f99

Please sign in to comment.