diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 03500d825163..20d80048f545 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -60,6 +60,11 @@ const defaultCamelCaseAllTheThingsConfig: Options = [ format: ['PascalCase'], selector: 'typeLike', }, + + { + format: ['PascalCase'], + selector: 'enumMember', + }, ]; export default createRule({ diff --git a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts index c43b293c686e..8ca4dc6014ad 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts @@ -1301,6 +1301,32 @@ ruleTester.run('naming-convention', rule, { }, ], }, + { + code: ` + const enum SearchIndexType { + title = 1, + heading = 2, + } + `, + errors: [ + { + data: { + formats: 'PascalCase', + name: 'title', + type: 'Enum Member', + }, + messageId: 'doesNotMatchFormat', + }, + { + data: { + formats: 'PascalCase', + name: 'heading', + type: 'Enum Member', + }, + messageId: 'doesNotMatchFormat', + }, + ], + }, ], valid: [ { @@ -2291,5 +2317,13 @@ ruleTester.run('naming-convention', rule, { }, ], }, + { + code: ` + const enum SearchIndexType { + Title = 1, + Heading = 2, + } + `, + }, ], });