Skip to content

Commit 9c82f86

Browse files
fix: bind configs to variables before exporting to make sure typeerrors are reported (#1232)
* bind configs * Create odd-spies-appear.md * Update .changeset/odd-spies-appear.md --------- Co-authored-by: Christopher Ehrlich <[email protected]>
1 parent 9ef6171 commit 9c82f86

14 files changed

+49
-17
lines changed

Diff for: .changeset/odd-spies-appear.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-t3-app": patch
3+
---
4+
5+
fix: bind configs to variables before exporting to make sure typeerrors are reported

Diff for: .eslintrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import("eslint").Linter.Config} */
2-
module.exports = {
2+
const config = {
33
root: true,
44
parser: "@typescript-eslint/parser",
55
plugins: ["isaacscript", "import"],
@@ -45,3 +45,5 @@ module.exports = {
4545
"isaacscript/format-jsdoc-comments": "warn",
4646
},
4747
};
48+
49+
module.exports = config;

Diff for: .prettierrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('prettier').Config} */
2-
module.exports = {
2+
const config = {
33
arrowParens: "always",
44
printWidth: 80,
55
singleQuote: false,
@@ -8,3 +8,5 @@ module.exports = {
88
trailingComma: "all",
99
tabWidth: 2,
1010
};
11+
12+
module.exports = config;

Diff for: cli/.prettierrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/** @type {import('prettier').Config} */
2-
module.exports = {
2+
const config = {
33
...require("../.prettierrc.cjs"),
44
plugins: [require.resolve("prettier-plugin-tailwindcss")],
55
tailwindConfig: "./template/extras/config/tailwind.config.cjs",
66
};
7+
8+
module.exports = config;

Diff for: cli/template/base/_eslintrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import("eslint").Linter.Config} */
2-
module.exports = {
2+
const config = {
33
overrides: [
44
{
55
extends: [
@@ -27,3 +27,5 @@ module.exports = {
2727
],
2828
},
2929
};
30+
31+
module.exports = config;

Diff for: cli/template/base/src/env.mjs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { z } from "zod";
22

33
/**
4-
* Specify your server-side environment variables schema here.
5-
* This way you can ensure the app isn't built with invalid env vars.
4+
* Specify your server-side environment variables schema here. This way you can ensure the app isn't
5+
* built with invalid env vars.
66
*/
77
const server = z.object({
88
NODE_ENV: z.enum(["development", "test", "production"]),
99
});
1010

1111
/**
12-
* Specify your client-side environment variables schema here.
13-
* This way you can ensure the app isn't built with invalid env vars.
14-
* To expose them to the client, prefix them with `NEXT_PUBLIC_`.
12+
* Specify your client-side environment variables schema here. This way you can ensure the app isn't
13+
* built with invalid env vars. To expose them to the client, prefix them with `NEXT_PUBLIC_`.
1514
*/
1615
const client = z.object({
1716
// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),
1817
});
1918

2019
/**
21-
* You can't destruct `process.env` as a regular object in the Next.js
22-
* edge runtimes (e.g. middlewares) or client-side so we need to destruct manually.
20+
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
21+
* middlewares) or client-side so we need to destruct manually.
22+
*
2323
* @type {Record<keyof z.infer<typeof server> | keyof z.infer<typeof client>, string | undefined>}
2424
*/
2525
const processEnv = {

Diff for: cli/template/extras/config/postcss.config.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
module.exports = {
1+
const config = {
22
plugins: {
33
tailwindcss: {},
44
autoprefixer: {},
55
},
66
};
7+
8+
module.exports = config;

Diff for: cli/template/extras/config/prettier.config.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import("prettier").Config} */
2-
module.exports = {
2+
const config = {
33
plugins: [require.resolve("prettier-plugin-tailwindcss")],
44
};
5+
6+
module.exports = config;

Diff for: cli/template/extras/config/tailwind.config.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/** @type {import('tailwindcss').Config} */
2-
module.exports = {
2+
const config = {
33
content: ["./src/**/*.{js,ts,jsx,tsx}"],
44
theme: {
55
extend: {},
66
},
77
plugins: [],
88
};
9+
10+
module.exports = config;

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@manypkg/cli": "^0.20.0",
5151
"@types/eslint": "^8.21.1",
5252
"@types/node": "^18.14.0",
53+
"@types/prettier": "^2.7.2",
5354
"@typescript-eslint/eslint-plugin": "^5.53.0",
5455
"@typescript-eslint/parser": "^5.53.0",
5556
"eslint": "^8.34.0",

Diff for: pnpm-lock.yaml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: www/.eslintrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/** @type {import("eslint").Linter.Config} */
2-
module.exports = {
2+
const config = {
33
parserOptions: {
44
extraFileExtensions: [".astro"],
55
},
66
};
7+
8+
module.exports = config;

Diff for: www/.prettierrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('prettier').Config} */
2-
module.exports = {
2+
const config = {
33
...require("../.prettierrc.cjs"),
44
plugins: [
55
require.resolve("prettier-plugin-astro"),
@@ -17,3 +17,5 @@ module.exports = {
1717
astroAllowShorthand: false,
1818
tailwindConfig: "./tailwind.config.cjs",
1919
};
20+
21+
module.exports = config;

Diff for: www/tailwind.config.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('tailwindcss').Config} */
2-
module.exports = {
2+
const config = {
33
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
44
darkMode: "class",
55
theme: {
@@ -68,3 +68,5 @@ module.exports = {
6868
// eslint-disable-next-line @typescript-eslint/no-var-requires
6969
plugins: [require("tailwind-scrollbar")({ nocompatible: true })],
7070
};
71+
72+
module.exports = config;

0 commit comments

Comments
 (0)