Skip to content

Commit b46049a

Browse files
committed
Fixing eslint configuration for pipeline
1 parent 045262e commit b46049a

5 files changed

Lines changed: 252 additions & 29 deletions

File tree

.eslintrc.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ jobs:
100100
with:
101101
version: ${{ env.PNPM_VERSION }}
102102

103+
- name: Get pnpm store directory
104+
shell: bash
105+
run: |
106+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
107+
108+
- name: Setup pnpm cache
109+
uses: actions/cache@v4
110+
with:
111+
path: ${{ env.STORE_PATH }}
112+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
113+
restore-keys: |
114+
${{ runner.os }}-pnpm-store-
115+
103116
- name: Install dependencies
104117
run: pnpm install --frozen-lockfile
105118

@@ -221,6 +234,19 @@ jobs:
221234
with:
222235
version: ${{ env.PNPM_VERSION }}
223236

237+
- name: Get pnpm store directory
238+
shell: bash
239+
run: |
240+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
241+
242+
- name: Setup pnpm cache
243+
uses: actions/cache@v4
244+
with:
245+
path: ${{ env.STORE_PATH }}
246+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
247+
restore-keys: |
248+
${{ runner.os }}-pnpm-store-
249+
224250
- name: Install dependencies
225251
run: pnpm install --frozen-lockfile
226252

@@ -256,6 +282,19 @@ jobs:
256282
with:
257283
version: ${{ env.PNPM_VERSION }}
258284

285+
- name: Get pnpm store directory
286+
shell: bash
287+
run: |
288+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
289+
290+
- name: Setup pnpm cache
291+
uses: actions/cache@v4
292+
with:
293+
path: ${{ env.STORE_PATH }}
294+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
295+
restore-keys: |
296+
${{ runner.os }}-pnpm-store-
297+
259298
- name: Install dependencies
260299
run: pnpm install --frozen-lockfile
261300

@@ -342,6 +381,19 @@ jobs:
342381
with:
343382
version: ${{ env.PNPM_VERSION }}
344383

384+
- name: Get pnpm store directory
385+
shell: bash
386+
run: |
387+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
388+
389+
- name: Setup pnpm cache
390+
uses: actions/cache@v4
391+
with:
392+
path: ${{ env.STORE_PATH }}
393+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
394+
restore-keys: |
395+
${{ runner.os }}-pnpm-store-
396+
345397
- name: Install dependencies
346398
run: pnpm install --frozen-lockfile
347399

@@ -438,6 +490,19 @@ jobs:
438490
with:
439491
version: ${{ env.PNPM_VERSION }}
440492

493+
- name: Get pnpm store directory
494+
shell: bash
495+
run: |
496+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
497+
498+
- name: Setup pnpm cache
499+
uses: actions/cache@v4
500+
with:
501+
path: ${{ env.STORE_PATH }}
502+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
503+
restore-keys: |
504+
${{ runner.os }}-pnpm-store-
505+
441506
- name: Install dependencies
442507
run: pnpm install --frozen-lockfile
443508

@@ -489,6 +554,19 @@ jobs:
489554
with:
490555
version: ${{ env.PNPM_VERSION }}
491556

557+
- name: Get pnpm store directory
558+
shell: bash
559+
run: |
560+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
561+
562+
- name: Setup pnpm cache
563+
uses: actions/cache@v4
564+
with:
565+
path: ${{ env.STORE_PATH }}
566+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
567+
restore-keys: |
568+
${{ runner.os }}-pnpm-store-
569+
492570
- name: Install dependencies
493571
run: pnpm install --frozen-lockfile
494572

@@ -531,6 +609,19 @@ jobs:
531609
with:
532610
version: ${{ env.PNPM_VERSION }}
533611

612+
- name: Get pnpm store directory
613+
shell: bash
614+
run: |
615+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
616+
617+
- name: Setup pnpm cache
618+
uses: actions/cache@v4
619+
with:
620+
path: ${{ env.STORE_PATH }}
621+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
622+
restore-keys: |
623+
${{ runner.os }}-pnpm-store-
624+
534625
- name: Install dependencies
535626
run: pnpm install --frozen-lockfile
536627

eslint.config.js

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
const js = require('@eslint/js');
2+
const tseslint = require('@typescript-eslint/eslint-plugin');
3+
const tsparser = require('@typescript-eslint/parser');
4+
5+
module.exports = [
6+
// Base JavaScript recommended rules
7+
js.configs.recommended,
8+
9+
// TypeScript configuration for source files
10+
{
11+
files: ['src/**/*.ts'],
12+
ignores: ['src/**/*.spec.ts', 'src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
13+
languageOptions: {
14+
parser: tsparser,
15+
parserOptions: {
16+
project: './tsconfig.json',
17+
tsconfigRootDir: __dirname,
18+
sourceType: 'module',
19+
ecmaVersion: 2021,
20+
},
21+
globals: {
22+
// Node.js globals
23+
Buffer: 'readonly',
24+
console: 'readonly',
25+
global: 'readonly',
26+
process: 'readonly',
27+
__dirname: 'readonly',
28+
__filename: 'readonly',
29+
module: 'readonly',
30+
require: 'readonly',
31+
exports: 'readonly',
32+
// Node.js timer functions
33+
setImmediate: 'readonly',
34+
clearImmediate: 'readonly',
35+
setInterval: 'readonly',
36+
clearInterval: 'readonly',
37+
setTimeout: 'readonly',
38+
clearTimeout: 'readonly',
39+
// Node.js types
40+
NodeJS: 'readonly',
41+
},
42+
},
43+
plugins: {
44+
'@typescript-eslint': tseslint,
45+
},
46+
rules: {
47+
// Base TypeScript rules
48+
'@typescript-eslint/no-unused-vars': ['warn', {
49+
argsIgnorePattern: '^_',
50+
varsIgnorePattern: '^_',
51+
caughtErrorsIgnorePattern: '^_'
52+
}],
53+
'@typescript-eslint/no-explicit-any': 'off',
54+
'@typescript-eslint/explicit-function-return-type': 'off',
55+
'@typescript-eslint/explicit-module-boundary-types': 'off',
56+
'@typescript-eslint/interface-name-prefix': 'off',
57+
'@typescript-eslint/no-empty-function': 'off',
58+
'@typescript-eslint/ban-ts-comment': 'off',
59+
60+
// General rules
61+
'no-console': 'off',
62+
'no-unused-vars': 'off', // Use TypeScript version instead
63+
'prefer-const': 'error',
64+
'no-var': 'error',
65+
'no-undef': 'off', // TypeScript handles this
66+
},
67+
},
68+
69+
// Test files configuration (more relaxed rules)
70+
{
71+
files: ['**/*.spec.ts', '**/*.test.ts', '**/__tests__/**/*.ts', '**/test/**/*.ts', '**/tests/**/*.ts'],
72+
languageOptions: {
73+
parser: tsparser,
74+
parserOptions: {
75+
sourceType: 'module',
76+
ecmaVersion: 2021,
77+
// Don't require project for test files to avoid parsing errors
78+
},
79+
globals: {
80+
// Node.js globals
81+
Buffer: 'readonly',
82+
console: 'readonly',
83+
global: 'readonly',
84+
process: 'readonly',
85+
__dirname: 'readonly',
86+
__filename: 'readonly',
87+
module: 'readonly',
88+
require: 'readonly',
89+
exports: 'readonly',
90+
// Jest globals
91+
jest: 'readonly',
92+
describe: 'readonly',
93+
it: 'readonly',
94+
expect: 'readonly',
95+
beforeEach: 'readonly',
96+
afterEach: 'readonly',
97+
beforeAll: 'readonly',
98+
afterAll: 'readonly',
99+
test: 'readonly',
100+
},
101+
},
102+
plugins: {
103+
'@typescript-eslint': tseslint,
104+
},
105+
rules: {
106+
'@typescript-eslint/no-unused-vars': 'off',
107+
'@typescript-eslint/no-explicit-any': 'off',
108+
'@typescript-eslint/explicit-function-return-type': 'off',
109+
'@typescript-eslint/explicit-module-boundary-types': 'off',
110+
'no-console': 'off',
111+
'no-undef': 'off',
112+
'no-unused-vars': 'off',
113+
},
114+
},
115+
116+
// JavaScript files configuration
117+
{
118+
files: ['**/*.js', '**/*.mjs'],
119+
languageOptions: {
120+
ecmaVersion: 2021,
121+
sourceType: 'module',
122+
globals: {
123+
Buffer: 'readonly',
124+
console: 'readonly',
125+
global: 'readonly',
126+
process: 'readonly',
127+
__dirname: 'readonly',
128+
__filename: 'readonly',
129+
module: 'readonly',
130+
require: 'readonly',
131+
exports: 'readonly',
132+
},
133+
},
134+
rules: {
135+
'no-console': 'off',
136+
'prefer-const': 'error',
137+
'no-var': 'error',
138+
},
139+
},
140+
141+
// Ignore patterns
142+
{
143+
ignores: [
144+
'dist/**',
145+
'node_modules/**',
146+
'coverage/**',
147+
'logs/**',
148+
'.eslintrc.js',
149+
'eslint.config.js',
150+
'**/*.d.ts',
151+
'scripts/generate-sample-iam-data.ts',
152+
],
153+
},
154+
];

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"test:bdd:verbose": "bash docs/postman/run-bdd-tests.sh --verbose",
1717
"test:bdd:users": "bash docs/postman/run-bdd-tests.sh --folder Users",
1818
"test:bdd:roles": "bash docs/postman/run-bdd-tests.sh --folder Roles",
19-
"lint": "eslint \"{src,test}/**/*.ts\" --fix",
19+
"lint": "eslint \"{src,test}/**/*.ts\"",
20+
"lint:fix": "eslint \"{src,test}/**/*.ts\" --fix",
2021
"clean": "rm -rf dist node_modules",
2122
"docker:up": "docker-compose up -d",
2223
"docker:down": "docker-compose down",
@@ -86,6 +87,7 @@
8687
"winston-transport": "^4.9.0"
8788
},
8889
"devDependencies": {
90+
"@eslint/js": "^9.39.2",
8991
"@nestjs/cli": "^11.0.14",
9092
"@nestjs/testing": "^11.1.10",
9193
"@types/bcrypt": "^6.0.0",

src/logger/transports/transport.factory.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export async function createFileTransport(
113113
console.log(`[LoggerService] ✓ New log file created: ${newFilename}`);
114114
});
115115

116-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
116+
117117
return transport as any;
118118
} catch (error) {
119119
console.warn(
@@ -159,7 +159,7 @@ export async function createLokiTransport(
159159
}
160160

161161
const transport = new LokiTransport(transportConfig as any);
162-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
162+
163163
return transport as any;
164164
} catch (error) {
165165
console.warn(
@@ -226,7 +226,7 @@ export async function createFluentBitTransport(
226226
}
227227
}
228228

229-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
229+
230230
return new FluentBitTransport({ level }) as any;
231231
} catch (error) {
232232
console.warn(
@@ -282,7 +282,7 @@ export async function createOpenSearchTransport(
282282
};
283283
};
284284

285-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
285+
286286
return new ElasticsearchTransport({
287287
level,
288288
client: client as any,

0 commit comments

Comments
 (0)