Skip to content

docs(path): Fix doc lints in @std/path to prepare for stabilization - #4839

Closed
nathanwhit wants to merge 4 commits into
denoland:mainfrom
nathanwhit:path-docs
Closed

nathanwhit wants to merge 4 commits into
denoland:mainfrom
nathanwhit:path-docs

Conversation

@nathanwhit

Copy link
Copy Markdown
Member

No description provided.

@nathanwhit
nathanwhit requested a review from kt3k as a code owner May 22, 2024 21:43
@github-actions github-actions Bot added the path label May 22, 2024
@nathanwhit nathanwhit changed the title doc(path): Fix doc lints in @std/path to prepare for stabilization docs(path): Fix doc lints in @std/path to prepare for stabilization May 22, 2024
Comment thread path/is_absolute.ts
* import { isAbsolute } from "@std/path/is-absolute";
*
* // posix
* isAbsolute("/home/foo"); // true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we could use assertions in these examples, but I couldn't figure out a nice way to make it work due to the os-dependent behavior.

I suppose we could do something like

if (Deno.build.os === "windows") {
  // windows specific examples
} else {
  // posix
}

but I'm not sure if it's worth the clutter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the readability matters more here. I'd suggest adding no-eval directive when it's difficult to make it work in cross-platform way

@codecov

codecov Bot commented May 22, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 80.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 91.96%. Comparing base (0079ea0) to head (6836e77).
Report is 4 commits behind head on main.

Files Patch % Lines
path/constants.ts 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4839      +/-   ##
==========================================
- Coverage   91.97%   91.96%   -0.01%     
==========================================
  Files         486      487       +1     
  Lines       41461    41550      +89     
  Branches     5360     5365       +5     
==========================================
+ Hits        38133    38213      +80     
- Misses       3270     3279       +9     
  Partials       58       58              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread path/glob_to_regexp.ts
} from "./windows/glob_to_regexp.ts";

export type { GlobOptions };
export type { GlobOptions, OSType };

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to resolve the lint that OsType is private despite appearing in a public type (GlobToRegExpOptions).

Alternatively we could inline the definition of OSType instead of exporting it, but that sort of defeats the purpose of the type.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exporting the type makes sense to me, but I think it should be renamed to OsType. The Deno style guide has the below section:

When the names are in camelCase or PascalCase, always follow the rules of them even when the parts of them are acronyms.

Note: Web APIs use uppercase acronyms (JSON, URL, URL.createObjectURL() etc.). Deno Standard Library does not follow this convention.

https://docs.deno.com/runtime/manual/references/contributing/style_guide#naming-convention

@kt3k

kt3k commented May 30, 2024

Copy link
Copy Markdown
Contributor

I'll continue this work in #4900. Thanks @nathanwhit for the contribution!

@kt3k kt3k closed this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants