Skip to content

Commit

Permalink
chore: format source code, run deno fmt --check in CI (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k authored May 17, 2024
1 parent 2aaa9cf commit de6ff46
Show file tree
Hide file tree
Showing 47 changed files with 3,170 additions and 547 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- run: deno fmt --check
5 changes: 2 additions & 3 deletions .github/workflows/update_versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (Deno.args.includes("--create-pr")) {
async function getLatestTagForRepo(name: string) {
$.logStep(`Fetching latest release for ${name}...`);
const latestRelease = await $.request(
`https://api.github.com/repos/denoland/${name}/releases/latest`
`https://api.github.com/repos/denoland/${name}/releases/latest`,
)
.header("accept", "application/vnd.github.v3+json")
.json<{ tag_name: string }>();
Expand Down Expand Up @@ -81,8 +81,7 @@ async function tryCreatePr() {
$.log(`Opened PR at ${openedPr.data.url}`);

function getPrBody() {
let text =
`Bumped versions for ${latestCliVersion}\n\n` +
let text = `Bumped versions for ${latestCliVersion}\n\n` +
`To make edits to this PR:\n` +
"```shell\n" +
`gh pr checkout <THIS PR NUMBER>\n` +
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ authored.

## Examples

[Deno by Example](https://docs.deno.com/examples) is a collection of small snippets showcasing various functions of the APIs implemented in Deno.

[Deno by Example](https://docs.deno.com/examples) is a collection of small
snippets showcasing various functions of the APIs implemented in Deno.

- Examples are written in TypeScript
- Each example should be a single file, no more than 50 lines
Expand All @@ -217,10 +217,11 @@ authored.

### Adding an example

To add an example, create a file in the `by-example` directory. The file name should
be a short description of the example (in kebab case) and the contents should be the code for the example.
The file should be in the `.ts` format. The file should start with a JSDoc style
multi line comment that describes the example:
To add an example, create a file in the `by-example` directory. The file name
should be a short description of the example (in kebab case) and the contents
should be the code for the example. The file should be in the `.ts` format. The
file should start with a JSDoc style multi line comment that describes the
example:

```ts
/**
Expand Down
2 changes: 1 addition & 1 deletion by-example/checking-file-existence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @tags cli, deploy
* @run --allow-read --allow-write <url>
* @group File System
*
*
* Sometimes we as developers think that we need to check
* if a file exists or not. More often than not, we are
* entirely wrong.
Expand Down
2 changes: 1 addition & 1 deletion by-example/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @run --allow-net --allow-sys --allow-read <url>
* @resource {https://deno.land/x/mongo} Deno MongoDB on deno.land/x
* @group Databases
*
*
* Using the Deno MongoDB client, you can connect to a Mongo database
* running anywhere.
*/
Expand Down
2 changes: 1 addition & 1 deletion by-example/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @resource {https://docs.deno.com/runtime/manual/node/npm_specifiers} npm: specifiers
* @resource {https://www.npmjs.com/package/express} express module on npm
* @group Basics
*
*
* Use JavaScript modules from npm in your Deno programs with the "npm:"
* specifier in your imports.
*/
Expand Down
2 changes: 1 addition & 1 deletion by-example/parsing-serializing-csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @resource {/import-export} Example: Importing & Exporting
* @resource {https://datatracker.ietf.org/doc/html/rfc4180} Spec: CSV
* @group Encoding
*
*
* CSV is a data serialization format that is designed to be portable for table-like applications.
*/
import { parse, stringify } from "jsr:@std/csv";
Expand Down
2 changes: 1 addition & 1 deletion by-example/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @resource {https://deno.land/x/r2d2} r2d2 on deno.land/x
* @resource {https://redis.io/docs/getting-started/} Getting started with Redis
* @group Databases
*
*
* Using the r2d2 module, you can connect to a Redis database running anywhere.
*/

Expand Down
2 changes: 1 addition & 1 deletion by-example/streaming-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @resource {https://deno.land/api?s=Deno.open} Doc: Deno.open
* @resource {https://deno.land/api?s=Deno.FsFile} Doc: Deno.FsFile
* @group File System
*
*
* Sometimes we need more granular control over file operations.
* Deno provides a low level interface to file operations that
* may be used for this purpose.
Expand Down
7 changes: 3 additions & 4 deletions deploy/manual/acceptable-use-policy.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Acceptable use policy

The Deno Deploy service includes resources (CPU time,
request counts) that are subject to this Acceptable Use policy. This document
can give a rough estimate to what we consider as "Acceptable Use", and what we
do not.
The Deno Deploy service includes resources (CPU time, request counts) that are
subject to this Acceptable Use policy. This document can give a rough estimate
to what we consider as "Acceptable Use", and what we do not.

### Examples of Acceptable Use

Expand Down
1 change: 1 addition & 0 deletions deploy/manual/deployctl.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,4 @@ Get a csv stream of the CPU time per request on each isolate of each region:
```shell
deployctl top | jq -r '[.id,.region,.cpuTimePerRequest] | @csv'
```
````
3 changes: 2 additions & 1 deletion deploy/tutorials/fresh.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ You can edit `routes/index.js` to modify the application.

## **Step 3:** Deploy to Deno Deploy

1. Navigate to [https://dash.deno.com/new_project](https://dash.deno.com/new_project).
1. Navigate to
[https://dash.deno.com/new_project](https://dash.deno.com/new_project).
2. Connect to your GitHub account and select your repository.
3. Fill in the values on the form:
- Give your project a name
Expand Down
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const config = {
{
label: "Deno Deploy",
to: "/deploy/manual",
},
},
{
label: "Deno Subhosting",
to: "/subhosting/manual",
Expand Down
4 changes: 2 additions & 2 deletions runtime/manual/advanced/jsx_dom/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ A web application is generally made up of three key technologies:
- HTML
- CSS

As well as increasingly, [WebAssembly](../../runtime/webassembly/index.md)
might play a part in a web application.
As well as increasingly, [WebAssembly](../../runtime/webassembly/index.md) might
play a part in a web application.

These technologies combine to allow a developer to build an application in a
browser using the web platform. While Deno supports a lot of web platform APIs,
Expand Down
14 changes: 7 additions & 7 deletions runtime/manual/advanced/publishing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ For more details, see [Adding a Module](https://deno.land/add_module).

## Auto-generating documentation for modules

When a module is published, the contents of the module are analyzed. An automated
process identifies modules that contain code that Deno understands and generates
documentation based on the code. For each path, including the root path, it
attempts to identify the default module. In order of preference it looks for
`mod`, `lib`, `main`, or `index` files with an extension that Deno understands
(ts,tsx,js,jsx,mjs, or mts). When viewing the documentation for the module for a
path, the default module will be shown.
When a module is published, the contents of the module are analyzed. An
automated process identifies modules that contain code that Deno understands and
generates documentation based on the code. For each path, including the root
path, it attempts to identify the default module. In order of preference it
looks for `mod`, `lib`, `main`, or `index` files with an extension that Deno
understands (ts,tsx,js,jsx,mjs, or mts). When viewing the documentation for the
module for a path, the default module will be shown.

If a default module cannot be identified, a list of modules that can be
documented will be provided instead. When generating the documentation, not only
Expand Down
6 changes: 3 additions & 3 deletions runtime/manual/advanced/typescript/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ You can learn more about type-checking arguments

Since Deno supports JavaScript, TypeScript, JSX, TSX modules, Deno has to make a
decision about how to treat each of these kinds of files. For local modules,
Deno makes this determination based on the extension. When the extension
is absent in a local file, it is assumed to be JavaScript. The module type can
be overridden using the `--ext` argument. This is useful if the module does not
Deno makes this determination based on the extension. When the extension is
absent in a local file, it is assumed to be JavaScript. The module type can be
overridden using the `--ext` argument. This is useful if the module does not
have a file extension, e.g. because it is embedded in another file.

For remote modules, the media type (mime-type) is used to determine the type of
Expand Down
12 changes: 6 additions & 6 deletions runtime/manual/advanced/typescript/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ When type checking `coolLib` and your usage of it in the file, the
`coolLib.d.ts` types will be used instead of looking at the JavaScript file.

The pattern matching for the compiler hint is somewhat forgiving and will accept
quoted and non-question values for the specifier as well as accepting whitespace
quoted and non-question values for the specifier as well as accepting whitespace
before and after the equals sign.

## Providing types when hosting
Expand Down Expand Up @@ -234,12 +234,12 @@ file, its resolution follow the normal import rules of Deno. For a lot of the
compatible with Deno.

[esm.sh](https://esm.sh) is a CDN which provides type declarations by default
(via the `X-TypeScript-Types` header). It can be disabled by appending
`?no-dts` to the import URL:
(via the `X-TypeScript-Types` header). It can be disabled by appending `?no-dts`
to the import URL:

```ts
import React from "https://esm.sh/react?no-dts";
```
```ts
import React from "https://esm.sh/react?no-dts";
```

## Behavior of JavaScript when type checking

Expand Down
4 changes: 2 additions & 2 deletions runtime/manual/basics/connecting_to_databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ db.close();

To connect to Firebase with Deno, import the
[firestore npm module](https://firebase.google.com/docs/firestore/quickstart)
with the [ESM CDN](https://esm.sh/). To learn more about using npm
modules in Deno with a CDN, see [Using npm packages with CDNs](../node/cdns.md).
with the [ESM CDN](https://esm.sh/). To learn more about using npm modules in
Deno with a CDN, see [Using npm packages with CDNs](../node/cdns.md).

### Connect to Firebase with the firestore npm module

Expand Down
5 changes: 4 additions & 1 deletion runtime/manual/getting_started/first_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const site = await fetch("https://www.deno.com");
console.log(await site.text());
```

Because this example is fetching data from across the internet, you will need to allow network permissions. You can give network permissions with the `--allow-net` flag or by using `-A` to allow all permissions. We'll look at permissions and security in more depth later on. Run the example with:
Because this example is fetching data from across the internet, you will need to
allow network permissions. You can give network permissions with the
`--allow-net` flag or by using `-A` to allow all permissions. We'll look at
permissions and security in more depth later on. Run the example with:

```console
deno run -A hello.ts
Expand Down
7 changes: 4 additions & 3 deletions runtime/manual/getting_started/web_frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ configure, while being super flexible. Highlights include:

[Hono](https://hono.dev) is a light-weight web app framework in the tradition of
Express and Sinatra. In just a few lines of code, you can set up an API server
or a server for dynamic web pages. Hono provides a Deno-native installation path,
and works great with Deno’s built-in TypeScript tooling.
or a server for dynamic web pages. Hono provides a Deno-native installation
path, and works great with Deno’s built-in TypeScript tooling.

- This website is served by Hono running on [Deno Deploy](https://deno.com/deploy).
- This website is served by Hono running on
[Deno Deploy](https://deno.com/deploy).

### Oak

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ cargo -V
> functions.
**Linux(Debian)/WSL**

```shell
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
Expand Down Expand Up @@ -78,7 +79,6 @@ brew install llvm
# Add /opt/homebrew/opt/llvm/bin/ to $PATH
```


**Windows**:

1. Get [VS Community 2019](https://www.visualstudio.com/downloads/) with the
Expand Down Expand Up @@ -136,6 +136,7 @@ Windows users can download the latest binary release from
## Building Deno

The easiest way to build Deno is by using a precompiled version of V8:

> for WSL make sure you have sufficient memory allocated in .wslconfig
```console
Expand Down
6 changes: 3 additions & 3 deletions runtime/manual/tools/____template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# deno foo

*This applies to `deno` v.1.17.0. and above.* **Unstable preview feature**
_This applies to `deno` v.1.17.0. and above._ **Unstable preview feature**

Do a fooer on a bar.

Expand Down Expand Up @@ -38,11 +38,11 @@ This is a description of the required arguments
- `-h, --help`
Prints help information
Prints help information
- `-s, --something`
Does a something
Does a something
## Examples
Expand Down
Loading

0 comments on commit de6ff46

Please sign in to comment.