@timmo001/oxlint-rules 0.6.0 → 0.6.1
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/README.md +3 -2
- package/dist/cli.js +7 -6
- package/dist/configs/recommended-effect.js +7 -6
- package/dist/effect/index.js +7 -6
- package/package.json +1 -1
- package/src/effect/rules/no-raw-gh.ts +12 -5
package/README.md
CHANGED
|
@@ -137,8 +137,9 @@ they only run when the consumer enables `typeAware`.
|
|
|
137
137
|
|
|
138
138
|
- `no-raw-gh`: reports the raw `execute`, `json` and `stream` methods called on
|
|
139
139
|
a `yield* Gh` binding from `@timmo001/effect-gh`, `Api.raw` from that package,
|
|
140
|
-
and
|
|
141
|
-
|
|
140
|
+
and calls that launch gh: `"gh"` followed by its arguments, such as
|
|
141
|
+
`executor.run("gh", ...)`, or an argument array starting with `"gh"`, such
|
|
142
|
+
as `Bun.spawn(["gh", ...])`. Use the
|
|
142
143
|
package's typed operations, and add one to effect-gh when a command has none.
|
|
143
144
|
effect-gh's own relative imports are not reported.
|
|
144
145
|
- `no-try-catch-in-effect-generators`: diagnoses synchronous `try/catch` owned
|
package/dist/cli.js
CHANGED
|
@@ -3004,12 +3004,13 @@ function isYieldGh(sourceCode, node) {
|
|
|
3004
3004
|
function isGhBinding(sourceCode, identifier) {
|
|
3005
3005
|
return resolveVariable(sourceCode, identifier)?.defs.some((definition) => definition.type === "Variable" && definition.node.type === "VariableDeclarator" && isYieldGh(sourceCode, definition.node.init)) ?? false;
|
|
3006
3006
|
}
|
|
3007
|
-
function
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3007
|
+
function launchesGh(args) {
|
|
3008
|
+
const [command, argv] = args;
|
|
3009
|
+
if (command?.type === "Literal")
|
|
3010
|
+
return command.value === "gh" && argv !== undefined;
|
|
3011
|
+
if (command?.type !== "ArrayExpression")
|
|
3011
3012
|
return false;
|
|
3012
|
-
const first =
|
|
3013
|
+
const first = command.elements[0];
|
|
3013
3014
|
return first?.type === "Literal" && first.value === "gh";
|
|
3014
3015
|
}
|
|
3015
3016
|
var noRawGhRule = defineRule24({
|
|
@@ -3040,7 +3041,7 @@ var noRawGhRule = defineRule24({
|
|
|
3040
3041
|
return;
|
|
3041
3042
|
}
|
|
3042
3043
|
}
|
|
3043
|
-
if (
|
|
3044
|
+
if (launchesGh(node.arguments))
|
|
3044
3045
|
context.report({ node, messageId: "spawnGh" });
|
|
3045
3046
|
}
|
|
3046
3047
|
};
|
|
@@ -55,12 +55,13 @@ function isYieldGh(sourceCode, node) {
|
|
|
55
55
|
function isGhBinding(sourceCode, identifier) {
|
|
56
56
|
return resolveVariable(sourceCode, identifier)?.defs.some((definition) => definition.type === "Variable" && definition.node.type === "VariableDeclarator" && isYieldGh(sourceCode, definition.node.init)) ?? false;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
function launchesGh(args) {
|
|
59
|
+
const [command, argv] = args;
|
|
60
|
+
if (command?.type === "Literal")
|
|
61
|
+
return command.value === "gh" && argv !== undefined;
|
|
62
|
+
if (command?.type !== "ArrayExpression")
|
|
62
63
|
return false;
|
|
63
|
-
const first =
|
|
64
|
+
const first = command.elements[0];
|
|
64
65
|
return first?.type === "Literal" && first.value === "gh";
|
|
65
66
|
}
|
|
66
67
|
var noRawGhRule = defineRule({
|
|
@@ -91,7 +92,7 @@ var noRawGhRule = defineRule({
|
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
if (
|
|
95
|
+
if (launchesGh(node.arguments))
|
|
95
96
|
context.report({ node, messageId: "spawnGh" });
|
|
96
97
|
}
|
|
97
98
|
};
|
package/dist/effect/index.js
CHANGED
|
@@ -50,12 +50,13 @@ function isYieldGh(sourceCode, node) {
|
|
|
50
50
|
function isGhBinding(sourceCode, identifier) {
|
|
51
51
|
return resolveVariable(sourceCode, identifier)?.defs.some((definition) => definition.type === "Variable" && definition.node.type === "VariableDeclarator" && isYieldGh(sourceCode, definition.node.init)) ?? false;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
function launchesGh(args) {
|
|
54
|
+
const [command, argv] = args;
|
|
55
|
+
if (command?.type === "Literal")
|
|
56
|
+
return command.value === "gh" && argv !== undefined;
|
|
57
|
+
if (command?.type !== "ArrayExpression")
|
|
57
58
|
return false;
|
|
58
|
-
const first =
|
|
59
|
+
const first = command.elements[0];
|
|
59
60
|
return first?.type === "Literal" && first.value === "gh";
|
|
60
61
|
}
|
|
61
62
|
var noRawGhRule = defineRule({
|
|
@@ -86,7 +87,7 @@ var noRawGhRule = defineRule({
|
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
if (
|
|
90
|
+
if (launchesGh(node.arguments))
|
|
90
91
|
context.report({ node, messageId: "spawnGh" });
|
|
91
92
|
}
|
|
92
93
|
};
|
package/package.json
CHANGED
|
@@ -61,11 +61,18 @@ function isGhBinding(
|
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Whether call arguments launch gh: `"gh"` followed by its argv, as in
|
|
66
|
+
* `run("gh", args)`, or an argv array starting with `"gh"`.
|
|
67
|
+
*/
|
|
68
|
+
function launchesGh(args: ESTree.CallExpression["arguments"]): boolean {
|
|
69
|
+
const [command, argv] = args;
|
|
66
70
|
|
|
67
|
-
if (
|
|
68
|
-
|
|
71
|
+
if (command?.type === "Literal")
|
|
72
|
+
return command.value === "gh" && argv !== undefined;
|
|
73
|
+
|
|
74
|
+
if (command?.type !== "ArrayExpression") return false;
|
|
75
|
+
const first = command.elements[0];
|
|
69
76
|
|
|
70
77
|
return first?.type === "Literal" && first.value === "gh";
|
|
71
78
|
}
|
|
@@ -118,7 +125,7 @@ export const noRawGhRule = defineRule({
|
|
|
118
125
|
}
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
if (
|
|
128
|
+
if (launchesGh(node.arguments))
|
|
122
129
|
context.report({ node, messageId: "spawnGh" });
|
|
123
130
|
},
|
|
124
131
|
};
|