From 7e5ccf417969e695618e4c505063e5cc765714b6 Mon Sep 17 00:00:00 2001 From: Andreas Fyrstelin Fuller Date: Tue, 22 Feb 2022 18:40:51 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Allo=20destructed=20naming=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 5 +++++ package.json | 4 ++-- .../naming-convention/destructing.ts | 18 ++++++++++++++++++ yarn.lock | 6 +++--- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 tests/@typescript-eslint/naming-convention/destructing.ts diff --git a/index.js b/index.js index 5923347..8789914 100644 --- a/index.js +++ b/index.js @@ -103,6 +103,11 @@ module.exports = { "selector": "variable", "format": ["UPPER_CASE", "strictCamelCase"], "modifiers": ["const", "global"] + }, + { + "selector": ["variable", "parameter"], + "format": null, + "modifiers": ["destructured"] } ], "react-hooks/rules-of-hooks": "error", diff --git a/package.json b/package.json index 4a15066..05e7d3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paralenz/eslint-config-typescript-react", - "version": "1.0.6", + "version": "1.0.7", "description": "Paralenz eslint configuration for typescript and React", "main": "index.js", "scripts": { @@ -50,4 +50,4 @@ "ts-node": "^10.4.0", "typescript": "^4.4.4" } -} \ No newline at end of file +} diff --git a/tests/@typescript-eslint/naming-convention/destructing.ts b/tests/@typescript-eslint/naming-convention/destructing.ts new file mode 100644 index 0000000..b3d75ce --- /dev/null +++ b/tests/@typescript-eslint/naming-convention/destructing.ts @@ -0,0 +1,18 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +type ImportedType = { + uses_snake_case: string + AndPascalCase: string +} +/* eslint-enable @typescript-eslint/naming-convention */ + +export function foo({ + uses_snake_case, + AndPascalCase +}: ImportedType) { + console.log(uses_snake_case, AndPascalCase) +} + +export function bar(type: ImportedType) { + const { uses_snake_case, AndPascalCase } = type + console.log(uses_snake_case, AndPascalCase) +} diff --git a/yarn.lock b/yarn.lock index 0ad2bcf..86769ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1176,9 +1176,9 @@ camelcase@^6.2.0: integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== caniuse-lite@^1.0.30001219: - version "1.0.30001231" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001231.tgz#6c1f9b49fc27cc368b894e64b9b28b39ef80603b" - integrity sha512-WAFFv31GgU4DiwNAy77qMo3nNyycEhH3ikcCVHvkQpPe/fO8Tb2aRYzss8kgyLQBm8mJ7OryW4X6Y4vsBCIqag== + version "1.0.30001312" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz" + integrity sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ== chalk@^2.0.0: version "2.4.2"