mirror of
https://github.com/kou029w/_.git
synced 2025-02-07 09:38:46 +00:00
deno lint, deno test
This commit is contained in:
parent
58d3e74c02
commit
998590ba13
6 changed files with 29 additions and 4 deletions
9
deno/add.test.ts
Normal file
9
deno/add.test.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { assertStrictEquals } from "testing/asserts.ts";
|
||||||
|
import { add } from "./add.ts";
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "add",
|
||||||
|
fn() {
|
||||||
|
assertStrictEquals(add(1, 2), 3);
|
||||||
|
},
|
||||||
|
});
|
1
deno/add.ts
Normal file
1
deno/add.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const add = (a: number, b: number) => a + b;
|
|
@ -1,4 +1,4 @@
|
||||||
import { Handler, ServeInit, serve } from "http/server.ts";
|
import { Handler, serve, ServeInit } from "http/server.ts";
|
||||||
|
|
||||||
const handler: Handler = () => new Response("Hello World\n");
|
const handler: Handler = () => new Response("Hello World\n");
|
||||||
const options: ServeInit = { addr: "localhost:8080" };
|
const options: ServeInit = { addr: "localhost:8080" };
|
||||||
|
|
8
deno/deno.json
Normal file
8
deno/deno.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
|
||||||
|
"lint": {
|
||||||
|
"rules": {
|
||||||
|
"include": ["default-param-last", "eqeqeq"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"imports": {
|
"imports": {
|
||||||
"http/": "https://deno.land/std@0.115.1/http/"
|
"http/": "https://deno.land/std@0.115.1/http/",
|
||||||
|
"testing/": "https://deno.land/std@0.116.0/testing/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
# yaml-language-server: $schema=https://deno.land/x/denon@2.4.10/schema.json
|
# yaml-language-server: $schema=https://deno.land/x/denon@2.4.10/schema.json
|
||||||
importmap: importmap.json
|
|
||||||
scripts:
|
scripts:
|
||||||
start:
|
start:
|
||||||
cmd: "deno run app.ts"
|
cmd: "deno run --import-map=importmap.json app.ts"
|
||||||
allow: [net]
|
allow: [net]
|
||||||
|
test:
|
||||||
|
cmd: "deno test --import-map=importmap.json"
|
||||||
|
lint:
|
||||||
|
cmd: "deno lint --config=deno.json ."
|
||||||
|
fmt:
|
||||||
|
cmd: "deno fmt --config=deno.json ."
|
||||||
|
|
Loading…
Add table
Reference in a new issue