eslint-plugin-turbo 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -11
- package/package.json +7 -2
package/dist/index.js
CHANGED
|
@@ -20,7 +20,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
24
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
28
|
|
|
26
29
|
// ../turbo-utils/dist/index.js
|
|
@@ -3705,7 +3708,7 @@ function findDependsOnEnvVars({
|
|
|
3705
3708
|
dependencies
|
|
3706
3709
|
}) {
|
|
3707
3710
|
if (dependencies) {
|
|
3708
|
-
return dependencies.filter((dep) => dep.startsWith("$"));
|
|
3711
|
+
return dependencies.filter((dep) => dep.startsWith("$")).map((envVar) => envVar.slice(1, envVar.length));
|
|
3709
3712
|
}
|
|
3710
3713
|
return [];
|
|
3711
3714
|
}
|
|
@@ -3717,17 +3720,26 @@ function getEnvVarDependencies({
|
|
|
3717
3720
|
if (!turboJsonContent) {
|
|
3718
3721
|
return null;
|
|
3719
3722
|
}
|
|
3720
|
-
const {
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3723
|
+
const {
|
|
3724
|
+
globalDependencies,
|
|
3725
|
+
globalEnv = [],
|
|
3726
|
+
pipeline = {}
|
|
3727
|
+
} = turboJsonContent;
|
|
3728
|
+
const allEnvVars = [
|
|
3729
|
+
...findDependsOnEnvVars({
|
|
3730
|
+
dependencies: globalDependencies
|
|
3731
|
+
}),
|
|
3732
|
+
...globalEnv
|
|
3733
|
+
];
|
|
3734
|
+
Object.values(pipeline).forEach(({ env, dependsOn }) => {
|
|
3725
3735
|
if (dependsOn) {
|
|
3726
3736
|
allEnvVars.push(...findDependsOnEnvVars({ dependencies: dependsOn }));
|
|
3727
3737
|
}
|
|
3738
|
+
if (env) {
|
|
3739
|
+
allEnvVars.push(...env);
|
|
3740
|
+
}
|
|
3728
3741
|
});
|
|
3729
|
-
|
|
3730
|
-
return envVarSet;
|
|
3742
|
+
return new Set(allEnvVars);
|
|
3731
3743
|
}
|
|
3732
3744
|
var getEnvVarDependencies_default = getEnvVarDependencies;
|
|
3733
3745
|
|
|
@@ -3738,7 +3750,7 @@ var meta = {
|
|
|
3738
3750
|
description: "Do not allow the use of `process.env` without including the env key in turbo.json",
|
|
3739
3751
|
category: "Configuration Issues",
|
|
3740
3752
|
recommended: true,
|
|
3741
|
-
url: `https://github.com/vercel/turborepo/tree/main/packages/eslint-plugin-turbo/docs/rules/${RULES.noUndeclaredEnvVars}`
|
|
3753
|
+
url: `https://github.com/vercel/turborepo/tree/main/packages/eslint-plugin-turbo/docs/rules/${RULES.noUndeclaredEnvVars}.md`
|
|
3742
3754
|
},
|
|
3743
3755
|
schema: [
|
|
3744
3756
|
{
|
|
@@ -3790,10 +3802,16 @@ function create(context) {
|
|
|
3790
3802
|
});
|
|
3791
3803
|
}
|
|
3792
3804
|
};
|
|
3805
|
+
const isComputed = (node) => {
|
|
3806
|
+
if ("computed" in node.parent) {
|
|
3807
|
+
return node.parent.computed;
|
|
3808
|
+
}
|
|
3809
|
+
return false;
|
|
3810
|
+
};
|
|
3793
3811
|
return {
|
|
3794
3812
|
MemberExpression(node) {
|
|
3795
3813
|
var _a2, _b2;
|
|
3796
|
-
if ("name" in node.object && "name" in node.property) {
|
|
3814
|
+
if ("name" in node.object && "name" in node.property && !isComputed(node)) {
|
|
3797
3815
|
const objectName = node.object.name;
|
|
3798
3816
|
const propertyName = node.property.name;
|
|
3799
3817
|
if (objectName === "process" && propertyName === "env") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-turbo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "ESLint plugin for Turborepo",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"turbo",
|
|
@@ -15,13 +15,16 @@
|
|
|
15
15
|
"dist/**"
|
|
16
16
|
],
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"@types/eslint": "^8.4.5",
|
|
18
19
|
"@types/estree": "^1.0.0",
|
|
19
20
|
"@types/jest": "^27.4.0",
|
|
20
21
|
"@types/node": "^16.11.12",
|
|
21
22
|
"jest": "^27.4.3",
|
|
22
23
|
"ts-jest": "^27.1.1",
|
|
24
|
+
"tsconfig": "0.0.0",
|
|
23
25
|
"tsup": "^6.2.0",
|
|
24
26
|
"turbo-utils": "0.0.0",
|
|
27
|
+
"turbo-types": "0.0.0",
|
|
25
28
|
"typescript": "^4.7.4"
|
|
26
29
|
},
|
|
27
30
|
"peerDependencies": {
|
|
@@ -29,7 +32,9 @@
|
|
|
29
32
|
},
|
|
30
33
|
"license": "MPL-2.0",
|
|
31
34
|
"scripts": {
|
|
35
|
+
"release": "pnpm build && pnpm publish",
|
|
32
36
|
"test": "jest",
|
|
33
|
-
"build": "tsup"
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"check-types": "tsc --noEmit"
|
|
34
39
|
}
|
|
35
40
|
}
|