Skip to content

Commit 6d1b19b

Browse files
committed
fix: sync ESLint and Prettier configurations
- Install eslint-config-prettier to disable conflicting ESLint formatting rules - Remove formatting rules from ESLint (semi, quotes, comma-dangle, etc.) as Prettier handles all formatting - Keep code quality rules in ESLint (eqeqeq, curly, no-var, etc.) - Format and lint now work together without conflicts This ensures that running 'npm run format' followed by 'npm run lint' will always pass, and vice versa.
1 parent 5afeac2 commit 6d1b19b

File tree

18 files changed

+165
-143
lines changed

18 files changed

+165
-143
lines changed

eslint.config.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import js from '@eslint/js';
22
import tseslint from 'typescript-eslint';
33
import importPlugin from 'eslint-plugin-import';
44
import promisePlugin from 'eslint-plugin-promise';
5+
import prettierConfig from 'eslint-config-prettier';
56

67
export default tseslint.config(
78
js.configs.recommended,
89
...tseslint.configs.recommended,
10+
prettierConfig,
911
{
1012
files: ['**/*.ts'],
1113
languageOptions: {
@@ -20,33 +22,20 @@ export default tseslint.config(
2022
promise: promisePlugin
2123
},
2224
rules: {
23-
// Standard.js style rules
24-
'semi': ['error', 'always'],
25-
'quotes': ['error', 'single'],
26-
'comma-dangle': ['error', 'never'],
27-
'space-before-function-paren': ['error', {
28-
'anonymous': 'always',
29-
'named': 'never',
30-
'asyncArrow': 'always'
31-
}],
32-
'no-trailing-spaces': 'error',
33-
'eol-last': ['error', 'always'],
34-
'no-multiple-empty-lines': ['error', { 'max': 2, 'maxEOF': 1 }],
35-
'padded-blocks': ['error', 'never'],
36-
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
25+
// Code quality rules (formatting handled by Prettier)
3726
'camelcase': ['error', {
3827
'properties': 'never',
3928
'ignoreDestructuring': true,
4029
'allow': ['^_upsert_status$', '^_[a-z_]+$', '^[a-z]+_[a-z_]+$']
4130
}],
31+
// Code quality rules
4232
'no-control-regex': 'off',
4333
'curly': ['error', 'all'],
4434
'eqeqeq': ['error', 'always'],
4535
'no-throw-literal': 'error',
4636
'no-var': 'error',
4737
'prefer-const': 'error',
4838
'prefer-arrow-callback': 'error',
49-
'arrow-spacing': ['error', { 'before': true, 'after': true }],
5039
'no-unused-vars': 'off',
5140
'@typescript-eslint/no-unused-vars': ['error', {
5241
'argsIgnorePattern': '^_',

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@typescript-eslint/eslint-plugin": "^8.54.0",
5858
"@typescript-eslint/parser": "^8.54.0",
5959
"eslint": "9.29.0",
60+
"eslint-config-prettier": "^10.1.8",
6061
"eslint-plugin-import": "2.32.0",
6162
"eslint-plugin-n": "17.20.0",
6263
"eslint-plugin-promise": "7.2.1",

packages/access-control/src/access-control.module.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ export class AccessControlModule {
3636
providers: [
3737
{
3838
provide: RULES_BUILDER_TOKEN,
39-
useValue: rules
40-
}
39+
useValue: rules,
40+
},
4141
],
4242
exports: [
4343
{
4444
provide: RULES_BUILDER_TOKEN,
45-
useValue: rules
46-
}
47-
]
45+
useValue: rules,
46+
},
47+
],
4848
};
4949
}
5050

@@ -55,26 +55,26 @@ export class AccessControlModule {
5555
if (useExisting) {
5656
provider = {
5757
provide: RULES_BUILDER_TOKEN,
58-
useExisting
58+
useExisting,
5959
};
6060
} else if (useClass) {
6161
provider = {
6262
provide: RULES_BUILDER_TOKEN,
63-
useClass
63+
useClass,
6464
};
6565
} else {
6666
provider = {
6767
provide: RULES_BUILDER_TOKEN,
6868
useFactory: useFactory || (() => new RulesBuilder()),
69-
inject
69+
inject,
7070
};
7171
}
7272

7373
return {
7474
module: AccessControlModule,
7575
imports,
7676
providers: [provider],
77-
exports: [provider]
77+
exports: [provider],
7878
};
7979
}
8080
}

packages/access-control/src/access.control.module.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ describe('forRootAsync', () => {
1111
const module: TestingModule = await Test.createTestingModule({
1212
imports: [
1313
AccessControlModule.forRootAsync({
14-
useFactory: (): RulesBuilder => new RulesBuilder()
15-
})
16-
]
14+
useFactory: (): RulesBuilder => new RulesBuilder(),
15+
}),
16+
],
1717
}).compile();
1818

1919
const rules = module.get(RULES_BUILDER_TOKEN);
@@ -28,9 +28,9 @@ describe('forRootAsync', () => {
2828
useFactory: async (): Promise<RulesBuilder> => {
2929
await delay(100);
3030
return new RulesBuilder();
31-
}
32-
})
33-
]
31+
},
32+
}),
33+
],
3434
}).compile();
3535

3636
const rules = module.get(RULES_BUILDER_TOKEN);
@@ -45,7 +45,7 @@ describe('forRoles', () => {
4545
const options: ACOptions = { grantsEndpoint: 'grants' };
4646

4747
const module: TestingModule = await Test.createTestingModule({
48-
imports: [AccessControlModule.forRules(rules, options)]
48+
imports: [AccessControlModule.forRules(rules, options)],
4949
}).compile();
5050

5151
const controller = module.get<GrantsController>(GrantsController);
@@ -59,7 +59,7 @@ describe('forRoles', () => {
5959
const options: ACOptions = {};
6060

6161
const module: TestingModule = await Test.createTestingModule({
62-
imports: [AccessControlModule.forRules(rules, options)]
62+
imports: [AccessControlModule.forRules(rules, options)],
6363
}).compile();
6464

6565
expect(() => {
@@ -71,7 +71,7 @@ describe('forRoles', () => {
7171
const rules: RulesBuilder = new RulesBuilder();
7272

7373
const module: TestingModule = await Test.createTestingModule({
74-
imports: [AccessControlModule.forRules(rules)]
74+
imports: [AccessControlModule.forRules(rules)],
7575
}).compile();
7676

7777
expect(() => {

packages/access-control/src/controller/grants.controller.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ describe('Grants Controller #getGrants', () => {
1616
providers: [
1717
{
1818
provide: RULES_BUILDER_TOKEN,
19-
useValue: roles
20-
}
21-
]
19+
useValue: roles,
20+
},
21+
],
2222
}).compile();
2323

2424
controller = module.get<GrantsController>(GrantsController);

packages/bootstrap-log/src/test/bootstrap-log.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe('BootstrapLog', () => {
77
hostname: 'localhost',
88
package_json_body: {
99
name: 'test',
10-
version: '1.0.0'
11-
}
10+
version: '1.0.0',
11+
},
1212
};
1313
BootstrapLog({ config });
1414
});
@@ -19,13 +19,13 @@ describe('BootstrapLog', () => {
1919
hostname: 'localhost',
2020
package_json_body: {
2121
name: 'test',
22-
version: '1.0.0'
22+
version: '1.0.0',
2323
},
2424
redis_url: 'redis://localhost:6379',
2525
database_url: 'postgres://localhost:5432/test',
2626
sentry: true,
2727
health_check: true,
28-
swagger: true
28+
swagger: true,
2929
};
3030
BootstrapLog({ config });
3131
});

packages/bunyan-logger/src/bunyan-logger.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export class BunyanLoggerService implements LoggerService {
1616
private readonly formatterOptions: FormatterOptions;
1717
private readonly maxLength?: number;
1818
private isEmpty = (obj: unknown): boolean => {
19-
if (!obj || typeof obj !== 'object') {return false;}
19+
if (!obj || typeof obj !== 'object') {
20+
return false;
21+
}
2022
const constructorName = (obj as object).constructor?.name;
2123
return (constructorName === 'Object' || constructorName === 'Array') && !Object.entries(obj).length;
2224
};
@@ -56,7 +58,7 @@ export class BunyanLoggerService implements LoggerService {
5658
level: Bunyan.INFO,
5759
name: projectId,
5860
streams: [...streams],
59-
...extraFields
61+
...extraFields,
6062
});
6163
}
6264

@@ -135,7 +137,7 @@ export class BunyanLoggerService implements LoggerService {
135137
if (typeof processedMessage === 'string' && optionalParams.length > 0) {
136138
const interpolationObject = optionalParams.find(
137139
(param): param is Record<string, unknown> =>
138-
param !== null && typeof param === 'object' && !Array.isArray(param) && !(param instanceof Error)
140+
param !== null && typeof param === 'object' && !Array.isArray(param) && !(param instanceof Error),
139141
);
140142
if (interpolationObject) {
141143
processedMessage = this.interpolateString(processedMessage, interpolationObject);
@@ -206,7 +208,7 @@ export class BunyanLoggerService implements LoggerService {
206208
const nonStringParams = optionalParams.filter((param) => param !== trace && param !== context);
207209
const interpolationObject = nonStringParams.find(
208210
(param): param is Record<string, unknown> =>
209-
param !== null && typeof param === 'object' && !Array.isArray(param) && !(param instanceof Error)
211+
param !== null && typeof param === 'object' && !Array.isArray(param) && !(param instanceof Error),
210212
);
211213
if (interpolationObject) {
212214
processedMessage = this.interpolateString(processedMessage, interpolationObject);

0 commit comments

Comments
 (0)