-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginpreset config changeProposal for an addition, removal, or general change to a preset configProposal for an addition, removal, or general change to a preset config
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have read the FAQ and my problem is not listed.
Description
Code like this fails with the default option:
const enum SearchItemType {
Page = 0,
ID = 1,
}
const enum SearchIndexType {
Title = 1,
Heading = 2,
Text = 3,
Image = 4,
Card = 5,
Doc = 6,
}
However, I think using PascalCase for enum member should be the default option, as this is the default syntax in TypeScript official docs, blogs and examples.
E.g.:
- https://www.typescriptlang.org/docs/handbook/enums.html
- https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#all-enums-are-union-enums
Other things to report and could be a feature request
The problem is affecting me because we are not providing a keyword to enable the default naming convention and "make some tweaks over it". I.E.: In this case, I can not simply add the green line below, instead I have to redeclare the whole "option". That is not convinient for me accross projects.
Impacted Configurations
// the default config is similar to ESLint's camelcase rule but more strict
const defaultOptions: Options = [
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'import',
format: ['camelCase', 'PascalCase'],
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
+ {
+ selector: 'enumMember',
+ format: ['PascalCase'],
+ },
];
Additional Info
No response
gyohza, moratelli, Mini-ghost, Romservik29, developer-bandi and 1 more
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginpreset config changeProposal for an addition, removal, or general change to a preset configProposal for an addition, removal, or general change to a preset config