Skip to content

Commit ce55b7d

Browse files
committed
adds some kitcken-sink tests
1 parent b81cd22 commit ce55b7d

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
process.env.NEXT_PUBLIC_ZILTOID;
2+
process.env.GATSBY_THE;
3+
process.env.NITRO_OMNISCIENT;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "nextjs",
3+
"dependencies": {
4+
"next": "*",
5+
"blitz": "*",
6+
"react": "*",
7+
"left-pad": "*",
8+
"event-stream": "*",
9+
"gatsby": "*",
10+
"is-promise": "*",
11+
"@faker-js/faker": "*",
12+
"ua-parser-js": "*",
13+
"nitropack": "*"
14+
},
15+
"devDependencies": {
16+
"eslint": "8.57.0",
17+
"eslint-plugin-turbo": "../../../../"
18+
}
19+
}

packages/eslint-plugin-turbo/__tests__/lib/no-undeclared-env-vars/framework-inference/no-undeclared-env-vars.commonjs.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const cwd = path.join(
1313
);
1414
const nextJsFilename = path.join(cwd, "/apps/nextjs/index.js");
1515
const viteFilename = path.join(cwd, "/apps/vite/index.js");
16+
const kitchenSinkFilename = path.join(cwd, "/apps/kitchen-sink/index.js");
1617
const options = (extra: Record<string, unknown> = {}) => ({
1718
options: [
1819
{
@@ -34,6 +35,11 @@ ruleTester.run(RULES.noUndeclaredEnvVars, rule, {
3435
...options(),
3536
filename: viteFilename,
3637
},
38+
{
39+
code: `const { NEXT_PUBLIC_ZILTOID, GATSBY_THE, NITRO_OMNISCIENT } = process.env;`,
40+
...options(),
41+
filename: kitchenSinkFilename,
42+
},
3743
],
3844
invalid: [
3945
{
@@ -57,5 +63,15 @@ ruleTester.run(RULES.noUndeclaredEnvVars, rule, {
5763
},
5864
],
5965
},
66+
{
67+
code: `const { VITE_THINGS } = process.env;`,
68+
...options(),
69+
filename: kitchenSinkFilename,
70+
errors: [
71+
{
72+
message: "VITE_THINGS is not listed as a dependency in turbo.json",
73+
},
74+
],
75+
},
6076
],
6177
});

packages/eslint-plugin-turbo/__tests__/lib/no-undeclared-env-vars/framework-inference/no-undeclared-env-vars.module.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const cwd = path.join(
1313
);
1414
const nextJsFilename = path.join(cwd, "/apps/nextjs/index.js");
1515
const viteFilename = path.join(cwd, "/apps/vite/index.js");
16+
const kitchenSinkFilename = path.join(cwd, "/apps/kitchen-sink/index.js");
1617
const options = (extra: Record<string, unknown> = {}) => ({
1718
options: [
1819
{
@@ -34,6 +35,11 @@ ruleTester.run(RULES.noUndeclaredEnvVars, rule, {
3435
...options(),
3536
filename: viteFilename,
3637
},
38+
{
39+
code: `const { NEXT_PUBLIC_ZILTOID, GATSBY_THE, NITRO_OMNISCIENT } = import.meta.env;`,
40+
...options(),
41+
filename: kitchenSinkFilename,
42+
},
3743
],
3844
invalid: [
3945
{
@@ -57,5 +63,15 @@ ruleTester.run(RULES.noUndeclaredEnvVars, rule, {
5763
},
5864
],
5965
},
66+
{
67+
code: `const { VITE_THINGS } = import.meta.env;`,
68+
...options(),
69+
filename: kitchenSinkFilename,
70+
errors: [
71+
{
72+
message: "VITE_THINGS is not listed as a dependency in turbo.json",
73+
},
74+
],
75+
},
6076
],
6177
});

0 commit comments

Comments
 (0)