From b0a4847eb7eac12005c820bc3057f06da93f034f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= Date: Wed, 20 Jul 2022 11:06:32 +0200 Subject: [PATCH] chore(linting): add naming convention rule (#1170) --- .eslintrc.js | 9 +++++++++ src/modules/date/index.ts | 2 ++ src/modules/name/index.ts | 3 +++ 3 files changed, 14 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index afc6a3bae5a..6f24766dc5f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,6 +51,15 @@ module.exports = defineConfig({ }, ], '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/naming-convention': [ + 'error', + { + format: ['PascalCase'], + selector: ['class', 'interface', 'typeAlias', 'enumMember'], + leadingUnderscore: 'forbid', + trailingUnderscore: 'forbid', + }, + ], }, overrides: [ { diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts index 0ff90db1c81..23cf6222bbf 100644 --- a/src/modules/date/index.ts +++ b/src/modules/date/index.ts @@ -20,6 +20,8 @@ function toDate(date?: string | Date | number): Date { /** * Module to generate dates. */ +// disabled until modules are renamed to something with a suffix +// eslint-disable-next-line @typescript-eslint/naming-convention export class _Date { constructor(private readonly faker: Faker) { // Bind `this` so namespaced is working correctly diff --git a/src/modules/name/index.ts b/src/modules/name/index.ts index 46d31de3ac9..3ff775e2b9e 100644 --- a/src/modules/name/index.ts +++ b/src/modules/name/index.ts @@ -1,8 +1,11 @@ import type { Faker } from '../..'; import { deprecated } from '../../internal/deprecated'; +// disabled until renamed to Sex export enum Gender { + // eslint-disable-next-line @typescript-eslint/naming-convention female = 'female', + // eslint-disable-next-line @typescript-eslint/naming-convention male = 'male', }