-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ee9c4c
commit 0485af5
Showing
5 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Command } from "../deps.ts"; | ||
import { GlobalOpts, initProject } from "../common.ts"; | ||
import { listSourceFiles } from "../../project/mod.ts"; | ||
|
||
export const formatCommand = new Command<GlobalOpts>() | ||
.option("--check, -c", "Check if files are formatted") | ||
.action( | ||
async (opts) => { | ||
const project = await initProject(opts); | ||
|
||
const sourceFiles = await listSourceFiles(project, { localOnly: true }); | ||
|
||
const cmd = await new Deno.Command("deno", { | ||
args: [ | ||
"fmt", | ||
...opts.check ? ["--check"] : [], | ||
...sourceFiles, | ||
], | ||
stdout: "inherit", | ||
stderr: "inherit", | ||
}) | ||
.output(); | ||
if (!cmd.success) throw new Error("Check failed"); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Command } from "../deps.ts"; | ||
import { GlobalOpts, initProject } from "../common.ts"; | ||
import { listSourceFiles } from "../../project/mod.ts"; | ||
|
||
export const lintCommand = new Command<GlobalOpts>() | ||
.action( | ||
async (opts) => { | ||
const project = await initProject(opts); | ||
|
||
const sourceFiles = await listSourceFiles(project, { localOnly: true }); | ||
console.log(sourceFiles); | ||
|
||
const cmd = await new Deno.Command("deno", { | ||
args: [ | ||
"lint", | ||
...sourceFiles, | ||
], | ||
stdout: "inherit", | ||
stderr: "inherit", | ||
}) | ||
.output(); | ||
if (!cmd.success) throw new Error("Link failed"); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
{ | ||
"lint": { | ||
"include": [ | ||
"src/" | ||
], | ||
"exclude": [ | ||
"tests/" | ||
], | ||
"rules": { | ||
"exclude": [ | ||
"no-empty-interface", | ||
"no-explicit-any", | ||
"require-await" | ||
] | ||
} | ||
}, | ||
"fmt": { | ||
"useTabs": true | ||
} | ||
} | ||
"lint": { | ||
"include": [ | ||
"src/" | ||
], | ||
"exclude": [ | ||
"tests/" | ||
], | ||
"rules": { | ||
"exclude": [ | ||
"no-empty-interface", | ||
"no-explicit-any", | ||
"require-await" | ||
] | ||
} | ||
}, | ||
"fmt": { | ||
"useTabs": true | ||
} | ||
} |