manual icon indicating copy to clipboard operation
manual copied to clipboard

add section for naming conventions

Open timreichen opened this issue 3 years ago • 3 comments

ref: https://github.com/denoland/deno_std/pull/2359

add section for naming conventions

timreichen avatar Jun 20 '22 16:06 timreichen

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 20 '22 16:06 CLAassistant

I agree this is mostly our current rule. But there seem some exceptions. We recently introduced JSONParseStream and JSONStringifyStream in std which don't follow this rule. The decision was made so because most people were in favor of that casing.

kt3k avatar Jun 21 '22 04:06 kt3k

Should uppercase be used if a class name starts with an acronym or is this an anomaly?

timreichen avatar Jun 21 '22 08:06 timreichen

What should the course of action be? Shall I also open a PR for the renames? @kt3k @nayeemrmn

candidates:

  • https://github.com/denoland/deno_std/blob/d7cd0080b8aa8a2df315edb220f919f4b88c4086/textproto/mod.ts#L65
  • https://github.com/denoland/deno_std/blob/6d33b18a8c89f7caf0a8e7588f9ea31efe5a45fc/encoding/json/_stringify.ts#L34

timreichen avatar Aug 23 '22 08:08 timreichen

What should the course of action be? Shall I also open a PR for the renames? @kt3k @nayeemrmn

I agree. We should be consistent and use the "capitalize only the first letter" rule. For example:

  • watchFs
  • serveHttp
  • listenTls

Current APIs that violate that rule should be renamed: JSONSomething => JsonSomething.

piscisaureus avatar Aug 24 '22 00:08 piscisaureus

Open question is whether we should also rename isatty to isaTty or isATty :)

piscisaureus avatar Aug 24 '22 00:08 piscisaureus

@piscisaureus Thanks for your opinion.

Ok. Let's land this and fix readMIMEHeader and JSON* APIs in std.

kt3k avatar Aug 24 '22 01:08 kt3k