From 0b6386050bff4d349ba9c8526677053a86408abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 28 Jun 2026 17:24:45 +0200 Subject: [PATCH] fix(lint): correct camelcase rule docs for destructuring and named imports Shorthand destructuring (`const { last_name } = obj1`) and named imports (`import { not_camelCased }`) are valid under the camelcase rule, since the identifier is determined by the source object/module and the user has no control over it. Move both examples from the Invalid to the Valid section. Verified against deno_lint main: `deno lint --rule camelcase` reports no diagnostic for either form. Fixes denoland/deno_lint#1324 --- lint/rules/camelcase.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lint/rules/camelcase.md b/lint/rules/camelcase.md index 69c344450..77fe86fed 100644 --- a/lint/rules/camelcase.md +++ b/lint/rules/camelcase.md @@ -23,7 +23,6 @@ Of note: let first_name = "Ichigo"; const obj1 = { last_name: "Hoshimiya" }; const obj2 = { first_name }; -const { last_name } = obj1; function do_something() {} function foo({ snake_case = "default value" }) {} @@ -31,7 +30,6 @@ function foo({ snake_case = "default value" }) {} class snake_case_class {} class Also_Not_Valid_Class {} -import { not_camelCased } from "external-module.js"; export * as not_camelCased from "mod.ts"; enum snake_case_enum { @@ -54,6 +52,7 @@ const __myPrivateVariable = "Hoshimiya"; const myPrivateVariable_ = "Hoshimiya"; const obj1 = { "last_name": "Hoshimiya" }; // if an object key is wrapped in quotation mark, then it's valid const obj2 = { "first_name": first_name }; +const { last_name } = obj1; // valid, because one has no control over the identifier const { last_name: lastName } = obj; function doSomething() {} // function declarations must be camelCase but... @@ -62,6 +61,7 @@ function foo({ snake_case: camelCase = "default value" }) {} class PascalCaseClass {} +import { not_camelCased } from "external-module.js"; // valid, because one has no control over the identifier import { not_camelCased as camelCased } from "external-module.js"; export * as camelCased from "mod.ts";