Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 409a616

Browse files
committed
fix: correct default config to closely match eslint's camelcase
1 parent e21d472 commit 409a616

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

packages/eslint-plugin/docs/rules/naming-convention.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,15 @@ const defaultOptions: Options = [
4545
{
4646
selector: 'default',
4747
format: ['camelCase'],
48+
leadingUnderscore: 'allow',
49+
trailingUnderscore: 'allow',
4850
},
4951

5052
{
5153
selector: 'variable',
5254
format: ['camelCase', 'UPPER_CASE'],
53-
},
54-
{
55-
selector: 'parameter',
56-
format: ['camelCase'],
5755
leadingUnderscore: 'allow',
58-
},
59-
60-
{
61-
selector: 'memberLike',
62-
modifiers: ['private'],
63-
format: ['camelCase'],
64-
leadingUnderscore: 'require',
56+
trailingUnderscore: 'allow',
6557
},
6658

6759
{

packages/eslint-plugin/src/rules/naming-convention.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,25 +274,21 @@ const SCHEMA: JSONSchema.JSONSchema4 = {
274274

275275
// #endregion Schema Config
276276

277+
// This essentially mirrors eslint's camelcase rule
278+
// note that that rule ignores leading and trailing underscores and only checks those in the middle of a variable name
277279
const defaultCamelCaseAllTheThingsConfig: Options = [
278280
{
279281
selector: 'default',
280282
format: ['camelCase'],
283+
leadingUnderscore: 'allow',
284+
trailingUnderscore: 'allow',
281285
},
282286

283287
{
284288
selector: 'variable',
285289
format: ['camelCase', 'UPPER_CASE'],
286-
},
287-
{
288-
selector: 'parameter',
289-
format: ['camelCase'],
290290
leadingUnderscore: 'allow',
291-
},
292-
293-
{
294-
selector: 'memberLike',
295-
format: ['camelCase'],
291+
trailingUnderscore: 'allow',
296292
},
297293

298294
{

0 commit comments

Comments
 (0)