From 2374aff1839ce47f4b66878472e4b6a0f3d01b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sin=C3=A9sio=20Couceiro?= Date: Fri, 8 Dec 2023 15:46:22 +0100 Subject: [PATCH] Allowing two dashes properties on naming-convention (#174) Co-authored-by: Sinesio Couceiro --- packages/eslint-config-typescript-react/index.js | 8 ++++++++ packages/eslint-config-typescript/index.js | 8 ++++++++ packages/test-eslint-config-typescript/index.ts | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/packages/eslint-config-typescript-react/index.js b/packages/eslint-config-typescript-react/index.js index f8d7da8..d32ead4 100644 --- a/packages/eslint-config-typescript-react/index.js +++ b/packages/eslint-config-typescript-react/index.js @@ -25,6 +25,14 @@ module.exports = { leadingUnderscore: 'forbid', trailingUnderscore: 'forbid', }, + { + selector: 'objectLiteralProperty', + format: [], + filter: { + regex: '^--', + match: true, + }, + }, ], }, }; diff --git a/packages/eslint-config-typescript/index.js b/packages/eslint-config-typescript/index.js index 7fb62ac..96ef23b 100644 --- a/packages/eslint-config-typescript/index.js +++ b/packages/eslint-config-typescript/index.js @@ -51,6 +51,14 @@ module.exports = { leadingUnderscore: 'forbid', trailingUnderscore: 'forbid', }, + { + selector: 'objectLiteralProperty', + format: [], + filter: { + regex: '^--', + match: true, + }, + }, ], '@typescript-eslint/no-confusing-void-expression': 'error', '@typescript-eslint/no-magic-numbers': 'off', diff --git a/packages/test-eslint-config-typescript/index.ts b/packages/test-eslint-config-typescript/index.ts index 81da0c4..b40b64f 100644 --- a/packages/test-eslint-config-typescript/index.ts +++ b/packages/test-eslint-config-typescript/index.ts @@ -55,3 +55,11 @@ sayCheese(undefined, 'Sandwich'); function functionWithParameter(value: MyInterface): string { return value.a + value.b; } + +function twoDashProperty(): boolean { + const myObject = { + '--my-property': true, + }; + + return myObject['--my-property']; +}