@deslop/coding-standards 0.1.1234 → 0.1.1236
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/install.js +1 -1
- package/dist/lint.js +7 -30
- package/package.json +1 -1
- package/tsconfig.json +13 -2
package/dist/install.js
CHANGED
|
@@ -27604,7 +27604,7 @@ const runWith = (command, config) => {
|
|
|
27604
27604
|
}, ({ error, userMessage }) => andThen(showUserError(error, userMessage), fail$3(error))), catchFilter((e) => isQuitError(e) ? succeed$6(e) : fail$8(e), (_) => interrupt$1));
|
|
27605
27605
|
};
|
|
27606
27606
|
// package.json
|
|
27607
|
-
var version = "0.1.
|
|
27607
|
+
var version = "0.1.1236";
|
|
27608
27608
|
// src/install.ts
|
|
27609
27609
|
const cli = pipe(make("deslop-coding-standards", {}, fnUntraced(function* () {
|
|
27610
27610
|
const fs = yield* FileSystem;
|
package/dist/lint.js
CHANGED
|
@@ -920,7 +920,6 @@ const recommended = {
|
|
|
920
920
|
"effect-machine/prefer-inline-handle": "error"
|
|
921
921
|
};
|
|
922
922
|
// src/rules/shared.ts
|
|
923
|
-
const TEST_RUNNERS = /^(?:@effect\/vitest|vitest|vite-plus\/test)$/u;
|
|
924
923
|
const LENGTH_TESTS = {
|
|
925
924
|
"!== 0": "nonEmpty",
|
|
926
925
|
"< 1": "empty",
|
|
@@ -929,6 +928,7 @@ const LENGTH_TESTS = {
|
|
|
929
928
|
"> 0": "nonEmpty",
|
|
930
929
|
">= 1": "nonEmpty"
|
|
931
930
|
};
|
|
931
|
+
const TEST_RUNNERS = /^(?:@effect\/vitest|vitest|vite-plus\/test)$/u;
|
|
932
932
|
function inert$1(token) {
|
|
933
933
|
if (contains([
|
|
934
934
|
"Boolean",
|
|
@@ -2433,7 +2433,7 @@ const noFalliblePromise = defineRule({
|
|
|
2433
2433
|
const returned = returnedExpression(callback);
|
|
2434
2434
|
if (isNullish(returned) || !containsRejection(context, returned)) return;
|
|
2435
2435
|
context.report({
|
|
2436
|
-
message: "This API can reject. Use Effect.tryPromise so expected I/O failures reach typed recovery, not the defect channel.",
|
|
2436
|
+
message: "This API can reject. Use Effect.tryPromise({try, catch}) so expected I/O failures reach typed recovery, not the defect channel.",
|
|
2437
2437
|
node
|
|
2438
2438
|
});
|
|
2439
2439
|
} }),
|
|
@@ -4135,7 +4135,11 @@ function skips(context, node) {
|
|
|
4135
4135
|
"runIf",
|
|
4136
4136
|
"skipIf"
|
|
4137
4137
|
], last)) return true;
|
|
4138
|
-
return contains(["only", "skip"], last) && (!
|
|
4138
|
+
return contains(["only", "skip"], last) && (!isImportBinding({
|
|
4139
|
+
context,
|
|
4140
|
+
node: chain.root,
|
|
4141
|
+
source: TEST_RUNNERS
|
|
4142
|
+
}) || !contains([
|
|
4139
4143
|
"describe",
|
|
4140
4144
|
"it",
|
|
4141
4145
|
"suite",
|
|
@@ -4532,12 +4536,6 @@ function unknownSchema(context, node) {
|
|
|
4532
4536
|
}
|
|
4533
4537
|
function unknownJsonSchema(context, node) {
|
|
4534
4538
|
const schema = resolveBinding(context, node);
|
|
4535
|
-
if (schema.type === "MemberExpression") return importedMember({
|
|
4536
|
-
context,
|
|
4537
|
-
importedName: "Schema",
|
|
4538
|
-
node: schema,
|
|
4539
|
-
propertyName: "UnknownFromJsonString"
|
|
4540
|
-
});
|
|
4541
4539
|
return schema.type === "CallExpression" && schema.callee.type !== "Super" && importedMember({
|
|
4542
4540
|
context,
|
|
4543
4541
|
importedName: "Schema",
|
|
@@ -5048,22 +5046,6 @@ const schemaTypePair = defineRule({
|
|
|
5048
5046
|
variable
|
|
5049
5047
|
});
|
|
5050
5048
|
}
|
|
5051
|
-
const aliased = flatMap(program.body, (statement) => {
|
|
5052
|
-
const named = statementDeclaration(statement);
|
|
5053
|
-
if (named?.type !== "TSTypeAliasDeclaration" || !isInferredType({
|
|
5054
|
-
name: named.id.name,
|
|
5055
|
-
node: named.typeAnnotation
|
|
5056
|
-
})) return [];
|
|
5057
|
-
return [named.id.name];
|
|
5058
|
-
});
|
|
5059
|
-
for (const query of collected) map$1(queriedSchema(query), (name) => context.report({
|
|
5060
|
-
fix: (fixer) => {
|
|
5061
|
-
if (!contains(aliased, name) || !readsModuleBinding(context, query, name)) return [];
|
|
5062
|
-
return fixer.replaceText(query, name);
|
|
5063
|
-
},
|
|
5064
|
-
message: `Read the type ${name}, declared as \`type ${name} = typeof ${name}.Type\` beside its Schema.`,
|
|
5065
|
-
node: query
|
|
5066
|
-
}));
|
|
5067
5049
|
},
|
|
5068
5050
|
TSTypeQuery: (node) => {
|
|
5069
5051
|
append$1(queries, node);
|
|
@@ -5559,11 +5541,6 @@ const lint = {
|
|
|
5559
5541
|
}],
|
|
5560
5542
|
"eslint/no-restricted-properties": [
|
|
5561
5543
|
"error",
|
|
5562
|
-
{
|
|
5563
|
-
message: "Decode JSON through Schema.fromJsonString with the protocol schema.",
|
|
5564
|
-
object: "JSON",
|
|
5565
|
-
property: "parse"
|
|
5566
|
-
},
|
|
5567
5544
|
{
|
|
5568
5545
|
allowProperties: [
|
|
5569
5546
|
"entries",
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
"effectMapFlatten": "error",
|
|
62
62
|
"effectMapVoid": "error",
|
|
63
63
|
"effectSleepZeroToYieldNow": "error",
|
|
64
|
+
"effectSucceedWithUndefined": "error",
|
|
64
65
|
"effectSucceedWithVoid": "error",
|
|
66
|
+
"effectTryWithoutCatch": "error",
|
|
65
67
|
"errorPayloadShadowsName": "error",
|
|
66
68
|
"experimentalApiUsage": "off",
|
|
67
69
|
"extendsNativeError": "off",
|
|
@@ -81,6 +83,8 @@
|
|
|
81
83
|
"globalErrorInEffectFailure": "error",
|
|
82
84
|
"globalFetch": "error",
|
|
83
85
|
"globalFetchInEffect": "error",
|
|
86
|
+
"globalJson": "error",
|
|
87
|
+
"globalJsonInEffect": "error",
|
|
84
88
|
"globalRandom": "error",
|
|
85
89
|
"globalRandomInEffect": "error",
|
|
86
90
|
"globalTimers": "error",
|
|
@@ -93,7 +97,9 @@
|
|
|
93
97
|
"manualMetricTapToTrack": "error",
|
|
94
98
|
"mapConstToAs": "error",
|
|
95
99
|
"mapMapErrorToMapBoth": "error",
|
|
100
|
+
"mapSomeCatchNoSuchElement": "error",
|
|
96
101
|
"mapSomeToAsSome": "error",
|
|
102
|
+
"matchBooleanToIsSuccess": "error",
|
|
97
103
|
"matchEffectToMapBoth": "error",
|
|
98
104
|
"matchEffectToMatch": "error",
|
|
99
105
|
"missedPipeableOpportunity": "off",
|
|
@@ -119,7 +125,6 @@
|
|
|
119
125
|
"preferEffectRecord": "error",
|
|
120
126
|
"preferEffectString": "error",
|
|
121
127
|
"preferNamespaceImport": "off",
|
|
122
|
-
"preferSchemaOverJson": "error",
|
|
123
128
|
"preferSchemaTaggedError": "off",
|
|
124
129
|
"preferSchemaTypeProperty": "error",
|
|
125
130
|
"preferSucceedSomeOrNone": "error",
|
|
@@ -129,10 +134,12 @@
|
|
|
129
134
|
"processEnvInEffect": "error",
|
|
130
135
|
"promiseInEffectSuccess": "error",
|
|
131
136
|
"provideLayerSucceedToProvideService": "error",
|
|
137
|
+
"provideMergeAllToArray": "error",
|
|
132
138
|
"raceFirstWithSleepToTimeout": "error",
|
|
133
139
|
"redundantMapError": "error",
|
|
134
140
|
"redundantOrDie": "error",
|
|
135
141
|
"redundantSchemaTagIdentifier": "error",
|
|
142
|
+
"resultMatchToFromResult": "error",
|
|
136
143
|
"returnEffectInGen": "error",
|
|
137
144
|
"runEffectInsideEffect": "off",
|
|
138
145
|
"runOfExitToRunExit": "error",
|
|
@@ -147,9 +154,11 @@
|
|
|
147
154
|
"serviceNotAsClass": "error",
|
|
148
155
|
"strictBooleanExpressions": "error",
|
|
149
156
|
"strictEffectProvide": "error",
|
|
157
|
+
"suspendFailToFailSync": "error",
|
|
150
158
|
"syncToSucceed": "error",
|
|
151
159
|
"timeoutCatchTagToTimeoutOrElse": "error",
|
|
152
160
|
"tryCatchInEffectGen": "error",
|
|
161
|
+
"typeUnionToSchemaUnion": "error",
|
|
153
162
|
"unknownInEffectCatch": "off",
|
|
154
163
|
"unnecessaryArrowBlock": "off",
|
|
155
164
|
"unnecessaryEffectGen": "error",
|
|
@@ -159,7 +168,9 @@
|
|
|
159
168
|
"unnecessaryTypeofType": "error",
|
|
160
169
|
"unsafeEffectTypeAssertion": "error",
|
|
161
170
|
"unstableApiUsage": "off",
|
|
162
|
-
"unusedDirective": "error"
|
|
171
|
+
"unusedDirective": "error",
|
|
172
|
+
// no-single-use-value inlines a single-use yield into its call instead.
|
|
173
|
+
"yieldInCallArgument": "off"
|
|
163
174
|
},
|
|
164
175
|
"ignoreEffectErrorsInTscExitCode": false,
|
|
165
176
|
"ignoreEffectWarningsInTscExitCode": false,
|