Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Jan 3, 2024
1 parent d1abb7b commit f6c1c13
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/create/src/recipes/_base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as p from "@clack/prompts";
import { updatePackage } from "write-package";

import * as utils from "../../utils.js";
import type { Framework, BaseRecipe } from "../types.js";
import type { Framework, BaseRecipe, BaseOptions } from "../types.js";

const logger = debug("@edgedb/create:recipe:base");

Expand Down Expand Up @@ -53,7 +53,7 @@ const recipe: BaseRecipe = {
projectDir: path.resolve(process.cwd(), opts.projectName),
};
},
async apply({ projectDir, projectName }) {
async apply({ projectDir, projectName }: BaseOptions) {
logger("Running base recipe");
try {
const projectDirStat = await fs.stat(projectDir);
Expand Down
4 changes: 2 additions & 2 deletions packages/create/src/recipes/_edgedb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import debug from "debug";
import util from "node:util";
import childProcess from "node:child_process";

import { Recipe } from "../types.js";
import { BaseOptions, Recipe } from "../types.js";

const logger = debug("@edgedb/create:recipe:edgedb");
const exec = util.promisify(childProcess.exec);

const recipe: Recipe = {
async apply({ projectDir, useEdgeDBAuth }) {
async apply({ projectDir, useEdgeDBAuth }: BaseOptions) {
logger("Running edgedb recipe");

const spinner = p.spinner();
Expand Down
6 changes: 3 additions & 3 deletions packages/create/src/recipes/_install/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import debug from "debug";
import * as p from "@clack/prompts";

import * as utils from "../../utils.js";
import { Recipe } from "../types.js";
import { BaseOptions, Recipe } from "../types.js";

const logger = debug("@edgedb/create:recipe:install");

Expand All @@ -12,7 +12,7 @@ interface InstallOptions {
}

const recipe: Recipe<InstallOptions> = {
getOptions({ packageManager }) {
getOptions({ packageManager }: BaseOptions) {
return p.group({
shouldGitInit: () =>
p.confirm({
Expand All @@ -26,7 +26,7 @@ const recipe: Recipe<InstallOptions> = {
}),
});
},
async apply(baseOptions, recipeOptions) {
async apply(baseOptions: BaseOptions, recipeOptions: InstallOptions) {
logger("Running install recipe");
},
};
Expand Down
6 changes: 3 additions & 3 deletions packages/create/src/recipes/express/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import debug from "debug";
import type { Recipe } from "../types.js";
import type { BaseOptions, Recipe } from "../types.js";

const logger = debug("@edgedb/create:recipe:express");

const recipe: Recipe = {
skip(opts) {
skip(opts: BaseOptions) {
return opts.framework !== "express";
},
async apply(baseOptions, recipeOptions) {
async apply(baseOptions: BaseOptions) {
logger("Running express recipe");
},
};
Expand Down
9 changes: 6 additions & 3 deletions packages/create/src/recipes/nextjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as p from "@clack/prompts";
import debug from "debug";
import { updatePackage } from "write-package";

import { Recipe } from "../types.js";
import { BaseOptions, Recipe } from "../types.js";
import { copyTemplateFiles } from "../../utils.js";

const logger = debug("@edgedb/create:recipe:nextjs");
Expand All @@ -13,7 +13,7 @@ interface NextjsOptions {
}

const recipe: Recipe<NextjsOptions> = {
skip(opts) {
skip(opts: BaseOptions) {
return opts.framework !== "next";
},
getOptions() {
Expand All @@ -31,7 +31,10 @@ const recipe: Recipe<NextjsOptions> = {
}),
});
},
async apply({ projectDir, useEdgeDBAuth }, { router }) {
async apply(
{ projectDir, useEdgeDBAuth }: BaseOptions,
{ router }: NextjsOptions
) {
logger("Running nextjs recipe");

const dirname = path.dirname(new URL(import.meta.url).pathname);
Expand Down
2 changes: 1 addition & 1 deletion packages/create/src/recipes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface BaseOptions {
useEdgeDBAuth: boolean;
}

export interface Recipe<RecipeOptions = any> {
export interface Recipe<RecipeOptions = undefined> {
skip?: (baseOptions: BaseOptions) => boolean;
getOptions?: (baseOptions: BaseOptions) => Promise<RecipeOptions>;
apply: (
Expand Down
8 changes: 7 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
}
},
"linterOptions": {
"exclude": ["**/*.deno.ts", "**/generated/**", "test/**", "qb/test/**"]
"exclude": [
"**/*.deno.ts",
"**/generated/**",
"test/**",
"qb/test/**",
"packages/create/src/recipes/*/template/**"
]
}
}

0 comments on commit f6c1c13

Please sign in to comment.