Skip to content

Commit dbbbbbb

Browse files
committed
update wflow and eslint
1 parent cae8048 commit dbbbbbb

2 files changed

Lines changed: 89 additions & 29 deletions

File tree

.github/workflows/backend-ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Backend CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "QUY-TRINH-1", "QUY-TRINH-2", "QUY-TRINH-3", "QUY-TRINH-4", "SOURCE" ]
6+
paths:
7+
- 'backend/**'
8+
- '.github/workflows/backend-ci.yml'
9+
pull_request:
10+
branches: [ "main", "QUY-TRINH-1", "QUY-TRINH-2", "QUY-TRINH-3", "QUY-TRINH-4", "SOURCE" ]
11+
paths:
12+
- 'backend/**'
13+
- '.github/workflows/backend-ci.yml'
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node-version: [22.19.0]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- name: Install dependencies
30+
run: npm ci
31+
- name: Code Quality - Lint
32+
run: npm run lint
33+
- name: Build
34+
run: npm run build --if-present
35+
- name: Run tests
36+
run: npm test

backend/eslint.config.mjs

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,55 @@
1-
module.exports = {
2-
parser: '@typescript-eslint/parser',
3-
parserOptions: {
4-
project: 'tsconfig.json',
5-
tsconfigRootDir: __dirname,
6-
sourceType: 'module',
1+
import { dirname } from 'path';
2+
import { fileURLToPath } from 'url';
3+
import tsPlugin from '@typescript-eslint/eslint-plugin';
4+
import tsParser from '@typescript-eslint/parser';
5+
import prettierConfig from 'eslint-config-prettier';
6+
import prettierPlugin from 'eslint-plugin-prettier';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
11+
export default [
12+
{
13+
ignores: [
14+
'**/node_modules/**',
15+
'**/dist/**',
16+
'**/.eslintrc.js',
17+
'**/coverage/**',
18+
],
719
},
8-
plugins: ['@typescript-eslint/eslint-plugin'],
9-
extends: [
10-
'plugin:@typescript-eslint/recommended',
11-
'plugin:prettier/recommended',
12-
],
13-
root: true,
14-
env: {
15-
node: true,
16-
jest: true,
20+
{
21+
files: ['**/*.ts'],
22+
languageOptions: {
23+
parser: tsParser,
24+
parserOptions: {
25+
project: './tsconfig.json',
26+
tsconfigRootDir: __dirname,
27+
sourceType: 'module',
28+
},
29+
globals: {
30+
node: true,
31+
jest: true,
32+
},
33+
},
34+
plugins: {
35+
'@typescript-eslint': tsPlugin,
36+
prettier: prettierPlugin,
37+
},
38+
rules: {
39+
...tsPlugin.configs.recommended.rules,
40+
...prettierConfig.rules,
41+
'@typescript-eslint/interface-name-prefix': 'off',
42+
'@typescript-eslint/explicit-function-return-type': 'off',
43+
'@typescript-eslint/explicit-module-boundary-types': 'off',
44+
'@typescript-eslint/no-explicit-any': 'off',
45+
'@typescript-eslint/no-unused-vars': 'warn',
46+
'@typescript-eslint/ban-ts-comment': 'warn',
47+
'prettier/prettier': [
48+
'error',
49+
{
50+
endOfLine: 'auto',
51+
},
52+
],
53+
},
1754
},
18-
ignorePatterns: ['.eslintrc.js'],
19-
rules: {
20-
'@typescript-eslint/interface-name-prefix': 'off',
21-
'@typescript-eslint/explicit-function-return-type': 'off',
22-
'@typescript-eslint/explicit-module-boundary-types': 'off',
23-
'@typescript-eslint/no-explicit-any': 'off',
24-
},
25-
"prettier/prettier": [
26-
"error",
27-
{
28-
"endOfLine": "auto"
29-
}
30-
]
31-
};
55+
];

0 commit comments

Comments
 (0)