From c81785b156161bbbaeb73a954c7d011fd26a0293 Mon Sep 17 00:00:00 2001 From: Leszek Date: Tue, 19 Nov 2024 10:54:03 -0500 Subject: [PATCH 1/3] allow leading underscore and in-between double underscore in snake_case --- .eslintrc.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c5d2ac60cf..b790ba22e9 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -144,11 +144,16 @@ const tsRules = Object.assign({}, jsRules, { selector: 'variableLike', format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'], }, - {selector: 'memberLike', format: ['camelCase', 'PascalCase', 'snake_case']}, {selector: 'typeLike', format: ['PascalCase']}, { - selector: 'property', - format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'], + selector: 'memberLike', + format: ['camelCase', 'PascalCase', 'snake_case'], + leadingUnderscore: 'allow', + filter: { + // Allow snake_case with in-between double underscores + regex: '^([a-zA-Z]+(?:_{1,2}[a-zA-Z]+)*)$', + match: false, + }, }, {selector: 'method', format: ['camelCase']}, { From 555c899e4dd5f2d313bfa7c84ec59aa453836456 Mon Sep 17 00:00:00 2001 From: Leszek Date: Tue, 19 Nov 2024 11:06:46 -0500 Subject: [PATCH 2/3] bring back property as separate (to allow UPPER_CASE) --- .eslintrc.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index b790ba22e9..9ab6ebb287 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -155,6 +155,15 @@ const tsRules = Object.assign({}, jsRules, { match: false, }, }, + { + selector: 'property', + format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'], + filter: { + // Allow snake_case with in-between double underscores + regex: '^([a-zA-Z]+(?:_{1,2}[a-zA-Z]+)*)$', + match: false, + }, + }, {selector: 'method', format: ['camelCase']}, { selector: [ From 4e170b372adde9ab49454d59cb5e252661f30304 Mon Sep 17 00:00:00 2001 From: Leszek Date: Tue, 19 Nov 2024 11:09:39 -0500 Subject: [PATCH 3/3] allow double leading/trailing underscore --- .eslintrc.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9ab6ebb287..9b91d234fa 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -148,7 +148,8 @@ const tsRules = Object.assign({}, jsRules, { { selector: 'memberLike', format: ['camelCase', 'PascalCase', 'snake_case'], - leadingUnderscore: 'allow', + leadingUnderscore: 'allowSingleOrDouble', + trailingUnderscore: 'allowSingleOrDouble', filter: { // Allow snake_case with in-between double underscores regex: '^([a-zA-Z]+(?:_{1,2}[a-zA-Z]+)*)$', @@ -158,6 +159,8 @@ const tsRules = Object.assign({}, jsRules, { { selector: 'property', format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'], + leadingUnderscore: 'allowSingleOrDouble', + trailingUnderscore: 'allowSingleOrDouble', filter: { // Allow snake_case with in-between double underscores regex: '^([a-zA-Z]+(?:_{1,2}[a-zA-Z]+)*)$',