Skip to content
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
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,15 @@ module.exports = {
},
},



// ── Config / seed files ───────────────────────────────────────────────────
{
files: ['src/**/*.config.ts', 'src/**/*.seed.ts'],
rules: {
'no-console': 'off',
},
},

],
};
10 changes: 10 additions & 0 deletions src/common/naming/naming.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// src/common/naming/naming.module.ts

import { Module } from '@nestjs/common';
import { NamingService } from './naming.service';

@Module({
providers: [NamingService],
exports: [NamingService],
})
export class NamingModule {}

Check failure on line 10 in src/common/naming/naming.module.ts

View workflow job for this annotation

GitHub Actions / ESLint

Insert `⏎`
36 changes: 36 additions & 0 deletions src/common/naming/naming.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// src/common/naming/naming.service.ts

import { Injectable } from '@nestjs/common';

@Injectable()
export class NamingService {
toCamelCase(input: string): string {
return input

Check failure on line 8 in src/common/naming/naming.service.ts

View workflow job for this annotation

GitHub Actions / ESLint

Replace `⏎······.toLowerCase()⏎······` with `.toLowerCase()`
.toLowerCase()
.replace(/[-_\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''));
}

toSnakeCase(input: string): string {
return input

Check failure on line 14 in src/common/naming/naming.service.ts

View workflow job for this annotation

GitHub Actions / ESLint

Replace `⏎······.replace(/[A-Z]/g,·letter·=>·`_${letter.toLowerCase()}`)⏎······` with `.replace(/[A-Z]/g,·(letter)·=>·`_${letter.toLowerCase()}`)`
.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
.replace(/^_/, '');
}

toPascalCase(input: string): string {
return input

Check failure on line 20 in src/common/naming/naming.service.ts

View workflow job for this annotation

GitHub Actions / ESLint

Replace `⏎······.replace(/(^\w|[-_\s]+\w)/g,·word·=>⏎········word.replace(/[-_\s]+/,·'').toUpperCase(),⏎······` with `.replace(/(^\w|[-_\s]+\w)/g,·(word)·=>·word.replace(/[-_\s]+/,·'').toUpperCase()`
.replace(/(^\w|[-_\s]+\w)/g, word =>
word.replace(/[-_\s]+/, '').toUpperCase(),
);
}

toKebabCase(input: string): string {
return input

Check failure on line 27 in src/common/naming/naming.service.ts

View workflow job for this annotation

GitHub Actions / ESLint

Replace `⏎······.replace(/[A-Z]/g,·letter·=>·`-${letter.toLowerCase()}`)⏎······` with `.replace(/[A-Z]/g,·(letter)·=>·`-${letter.toLowerCase()}`)`
.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)
.replace(/^-/, '');
}

normalizeKey(input: string): string {
// Example: enforce DB-safe keys
return this.toSnakeCase(input).replace(/[^a-z0-9_]/g, '');
}
}
Loading