Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use prettier in deno (in //tools/format.ts) #1708

Merged
merged 2 commits into from
Feb 9, 2019

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Feb 8, 2019

No description provided.

@kt3k kt3k changed the title Use prettier in deno (in //tools/format.ts) WIP Use prettier in deno (in //tools/format.ts) Feb 8, 2019
@kt3k kt3k force-pushed the feature/update-prettier branch 3 times, most recently from e9f669c to 92fda3d Compare February 8, 2019 06:32
tools/util.ts Outdated
/**
* Returns true if the path exists.
*/
export function existsSync (path: string): boolean {
Copy link
Member

Choose a reason for hiding this comment

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

Style error here - shouldn't be a space between existsSync and parens.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Will fix it.

Something is wrong in this branch and formatting doesn't seem working now. I'll look into it.

Copy link
Member Author

Choose a reason for hiding this comment

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

std/prettier/main.ts was crashing at //tests/error_syntax.js because the parser throws. The original prettier CLI seems ignoring the file when it can't parse it, and avoids crashing. I added error_syntax.js to skip list to avoid the crash.

Copy link
Member

Choose a reason for hiding this comment

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

Because of this file: https://github.com/denoland/deno/blob/master/.prettierignore
I guess std/prettier doesn't look at it?

tools/util.ts Outdated

/**
* Returns true if the path exists.
*/
Copy link
Member

Choose a reason for hiding this comment

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

Use a single line for jsdoc comments if possible.

* Looks up the available deno path with the priority
* of release -> debug -> global
*/
export function lookupDenoPath(): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Aside: I wonder if the executable location should be available in deno.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that's convenient in some situations, like when deno is unavailable in $PATH.

@kt3k kt3k force-pushed the feature/update-prettier branch 2 times, most recently from 5f95f38 to 949c0f5 Compare February 8, 2019 12:34
@kt3k kt3k changed the title WIP Use prettier in deno (in //tools/format.ts) Use prettier in deno (in //tools/format.ts) Feb 8, 2019
join("tools", "clang"),
join("js", "deps"),
join("tests", "badly_formatted.js"),
join("tests", "error_syntax.js")
Copy link
Member

Choose a reason for hiding this comment

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

Please remove .prettierignore if we do this.

export const executableSuffix = platform.os === "win" ? ".exe" : "";

// Returns true if the path exists.
export function existsSync(path: string): boolean {
Copy link
Member

Choose a reason for hiding this comment

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

existsSync is super useful. Maybe we should add it to the core API...
The comment should be jsdoc /** Returns true if the path exists. */

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

Please update the documentation if necessary (note #1712)

kt3k added a commit to kt3k/deno that referenced this pull request Feb 9, 2019
@kt3k
Copy link
Member Author

kt3k commented Feb 9, 2019

Removed .prettierignore (because std/prettier doesn't handle it at the moment), and no need of update documentation. (--allow-run is enough for running //tools/format.ts)

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM - nice work!

@ry ry merged commit 4c869dc into denoland:master Feb 9, 2019
@kt3k kt3k deleted the feature/update-prettier branch February 9, 2019 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants