@deslop/coding-standards 0.1.1063 → 0.1.1064
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.
|
@@ -5666,6 +5666,32 @@ const some = /*#__PURE__*/ dual(2, (self, predicate) => self.some(predicate));
|
|
|
5666
5666
|
*/
|
|
5667
5667
|
const makeEquivalence = Array_;
|
|
5668
5668
|
/**
|
|
5669
|
+
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
5670
|
+
*
|
|
5671
|
+
* **When to use**
|
|
5672
|
+
*
|
|
5673
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
5674
|
+
* result is needed.
|
|
5675
|
+
*
|
|
5676
|
+
* **Example** (Iterating with side-effects)
|
|
5677
|
+
*
|
|
5678
|
+
* ```ts import.meta.vitest
|
|
5679
|
+
* import { Array } from "effect"
|
|
5680
|
+
*
|
|
5681
|
+
* const visited: Array<number> = []
|
|
5682
|
+
* Array.forEach([1, 2, 3], (n) => visited.push(n))
|
|
5683
|
+
*
|
|
5684
|
+
* visited // => [1, 2, 3]
|
|
5685
|
+
* ```
|
|
5686
|
+
*
|
|
5687
|
+
* @see {@link map} for transforming each element into a new array
|
|
5688
|
+
*
|
|
5689
|
+
* @stability stable
|
|
5690
|
+
* @category traversing
|
|
5691
|
+
* @since 2.0.0
|
|
5692
|
+
*/
|
|
5693
|
+
const forEach = /*#__PURE__*/ dual(2, (self, f) => fromIterable(self).forEach((a, i) => f(a, i)));
|
|
5694
|
+
/**
|
|
5669
5695
|
* Removes duplicates using `Equal.equivalence()`, preserving the order of the
|
|
5670
5696
|
* first occurrence.
|
|
5671
5697
|
*
|
|
@@ -5912,6 +5938,23 @@ globalThis.String;
|
|
|
5912
5938
|
*/
|
|
5913
5939
|
const Order = String$2;
|
|
5914
5940
|
/**
|
|
5941
|
+
* Removes whitespace from both ends of a string.
|
|
5942
|
+
*
|
|
5943
|
+
* **Example** (Trimming whitespace)
|
|
5944
|
+
*
|
|
5945
|
+
* ```ts import.meta.vitest
|
|
5946
|
+
* import { String } from "effect"
|
|
5947
|
+
*
|
|
5948
|
+
* String.trim(" a ") // => "a"
|
|
5949
|
+
* String.trim(" hello world ") // => "hello world"
|
|
5950
|
+
* ```
|
|
5951
|
+
*
|
|
5952
|
+
* @stability stable
|
|
5953
|
+
* @category transforming
|
|
5954
|
+
* @since 2.0.0
|
|
5955
|
+
*/
|
|
5956
|
+
const trim = (self) => self.trim();
|
|
5957
|
+
/**
|
|
5915
5958
|
* Removes whitespace from the end of a string.
|
|
5916
5959
|
*
|
|
5917
5960
|
* **Example** (Trimming trailing whitespace)
|
|
@@ -6208,4 +6251,4 @@ const set = /*#__PURE__*/ dual(2, (self, value) => {
|
|
|
6208
6251
|
*/
|
|
6209
6252
|
const update = /*#__PURE__*/ dual(2, (self, f) => set(self, f(get(self))));
|
|
6210
6253
|
//#endregion
|
|
6211
|
-
export {
|
|
6254
|
+
export { values as $, isFunction as $n, causeAnnotate as $t, fromIterable as A, NodeInspectSymbol as An, String$2 as At, makeEquivalence as B, symbol as Bn, CauseImpl as Bt, filterMap as C, makePrimitiveProto as Cn, pipe as Cr, none as Ct, flatMap as D, getStackTraceLimit as Dn, BigInt as Dt, findLast as E, internalCall as En, pipeArguments as Er, zipWith as Et, isArrayNonEmpty as F, formatPath as Fn, make$1 as Ft, reduce as G, optimize as Gn, Fail as Gt, match$1 as H, combine as Hn, Done as Ht, isCanonicalArrayIndex as I, formatPropertyKey as In, mapInput as It, take as J, structure as Jn, ReasonBase as Jt, some as K, random as Kn, InterruptorStackTrace as Kt, isReadonlyArrayNonEmpty as L, currentFiberTypeId as Ln, Tuple as Lt, getSomes as M, format as Mn, isGreaterThanOrEqualTo as Mt, head as N, formatDate as Nn, isLessThan as Nt, flatten as O, setStackTraceLimit as On, Date$1 as Ot, isArrayEmpty as P, formatJson as Pn, isLessThanOrEqualTo as Pt, remove as Q, isError as Qn, args as Qt, join as R, byReferenceUnsafe as Rn, make$2 as Rt, filter as S, makePrimitive as Sn, memoizeIdempotent as Sr, match$3 as St, findFirstIndex as T, assignProperty as Tn, Prototype as Tr, some$1 as Tt, of as U, hash as Un, Error$2 as Ut, map as V, array as Vn, Die as Vt, prepend as W, number as Wn, ExitTypeId as Wt, get$2 as X, hasProperty as Xn, TaggedError$1 as Xt, fromEntries as Y, symbol$1 as Yn, StackTraceKey as Yt, map$1 as Z, isBoolean as Zn, Yield as Zt, dedupe as _, isDone as _n, constVoid as _r, getOrUndefined as _t, includes as a, constEmptyAnnotations as an, isNumber as ar, succeed as at, ensure as b, isFailReason as bn, identity as br, liftThrowable as bt, startsWith as c, contE as cn, isPropertyKey as cr, contains$1 as ct, Error$1 as d, exitDie as dn, isTagged as dr, firstSomeOf as dt, causeCombine as en, isIterable as er, fail as et, TaggedError as f, exitFail as fn, isUndefined as fr, flatMap$1 as ft, contains as g, isDieReason as gn, constUndefined as gr, getOrElse as gt, appendAll as h, isCause as hn, constTrue as hr, fromUndefinedOr as ht, Order as i, causeFromReasons as in, isNullish as ir, match$2 as it, get$1 as j, toStringUnknown as jn, isGreaterThan as jt, forEach as k, BaseProto as kn, Number$1 as kt, trim as l, done as ln, isReadonlyObject as lr, exists as lt, append as m, exitSucceed as mn, constFalse as mr, fromNullishOr as mt, make as n, causeEmpty as nn, isNotNullish as nr, getOrThrow as nt, match as o, contA as on, isObject as or, normalize as ot, taggedEnum as p, exitFailCause as pn, isUnknown as pr, flatten$1 as pt, sort as q, string as qn, PipeInspectableProto as qt, update as r, causeFail as rn, isNotUndefined as rr, isFailure as rt, split as s, contAll as sn, isObjectKeyword as sr, all as st, get as t, causeDie as tn, isNotNull as tr, fromOption as tt, trimEnd as u, evaluate as un, isString as ur, filter$1 as ut, dropRight as v, isEffect as vn, constant as vr, isNone as vt, findFirst as w, withFiber as wn, Class$1 as wr, orElse as wt, every as x, isInterruptReason as xn, memoize as xr, map$2 as xt, empty as y, isExit as yn, dual as yr, isSome as yt, last as z, equals as zn, strictEqual as zt };
|
package/dist/install.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $n as
|
|
2
|
+
import { $n as isFunction, $t as causeAnnotate, A as fromIterable$1, An as NodeInspectSymbol, At as String$6, Bn as symbol, Bt as CauseImpl, Cn as makePrimitiveProto, Cr as pipe, Ct as none, Dn as getStackTraceLimit, E as findLast, En as internalCall, Er as pipeArguments, F as isArrayNonEmpty, Fn as formatPath, G as reduce, Gt as Fail, H as match$5, Hn as combine$1, Ht as Done$1, I as isCanonicalArrayIndex, In as formatPropertyKey, It as mapInput, Jn as structure, Jt as ReasonBase, K as some$1, Kn as random, Kt as InterruptorStackTrace, L as isReadonlyArrayNonEmpty, Ln as currentFiberTypeId, Mn as format$1, On as setStackTraceLimit, Pn as formatJson, Qn as isError, Qt as args, R as join$1, S as filter, Sn as makePrimitive$1, Sr as memoizeIdempotent, St as match$4, T as findFirstIndex, Tn as assignProperty, Tr as Prototype$1, Tt as some, U as of, Un as hash, Ut as Error$3, V as map$9, Vt as Die, Wn as number$1, Wt as ExitTypeId, Xn as hasProperty, Xt as TaggedError$2, Yn as symbol$1, Yt as StackTraceKey, Zn as isBoolean$1, Zt as Yield, _ as dedupe, _n as isDone$2, _r as constVoid, _t as getOrUndefined$1, an as constEmptyAnnotations, ar as isNumber, at as succeed$6, bn as isFailReason$1, br as identity, c as startsWith, cn as contE, d as Error$2, dn as exitDie, dr as isTagged, en as causeCombine, er as isIterable, et as fail$5, f as TaggedError$1, fn as exitFail, fr as isUndefined, ft as flatMap$3, g as contains, gn as isDieReason$1, gr as constUndefined, gt as getOrElse, hn as isCause, hr as constTrue, ht as fromUndefinedOr, in as causeFromReasons, ir as isNullish, it as match$3, jn as toStringUnknown, jt as isGreaterThan$1, kn as BaseProto, kt as Number$6, ln as done$1, lt as exists, m as append$1, mn as exitSucceed, mr as constFalse, mt as fromNullishOr, n as make$29, nn as causeEmpty, nr as isNotNullish, on as contA, or as isObject, ot as normalize$1, p as taggedEnum, pn as exitFailCause, pr as isUnknown, qn as string$1, qt as PipeInspectableProto, rn as causeFail, rr as isNotUndefined, rt as isFailure$1, sn as contAll, sr as isObjectKeyword, tn as causeDie, tr as isNotNull, u as trimEnd, un as evaluate, ur as isString, vn as isEffect$1, vr as constant, vt as isNone, w as findFirst, wn as withFiber$1, wr as Class, xn as isInterruptReason, xr as memoize, xt as map$10, y as empty$3, yn as isExit, yr as dual, yt as isSome, zn as equals$1 } from "./MutableRef-WrqsqeER.mjs";
|
|
3
3
|
import * as NodeChildProcess from "node:child_process";
|
|
4
4
|
import { PassThrough } from "node:stream";
|
|
5
5
|
import * as NodeCrypto from "node:crypto";
|
|
@@ -25233,7 +25233,7 @@ const runWith = (command, config) => {
|
|
|
25233
25233
|
};
|
|
25234
25234
|
//#endregion
|
|
25235
25235
|
//#region package.json
|
|
25236
|
-
var version = "0.1.
|
|
25236
|
+
var version = "0.1.1064";
|
|
25237
25237
|
//#endregion
|
|
25238
25238
|
//#region src/install.ts
|
|
25239
25239
|
const cli = pipe(make("deslop-coding-standards", {}, fnUntraced(function* () {
|
package/dist/oxlint.d.ts
CHANGED
|
@@ -4123,6 +4123,7 @@ export declare const oxlint: {
|
|
|
4123
4123
|
'@deslop/coding-standards/no-fake-ref-state': "error";
|
|
4124
4124
|
'@deslop/coding-standards/no-hand-written-guard': "error";
|
|
4125
4125
|
'@deslop/coding-standards/no-let': "error";
|
|
4126
|
+
'@deslop/coding-standards/no-multiline-comment': "error";
|
|
4126
4127
|
'@deslop/coding-standards/no-native-control': "error";
|
|
4127
4128
|
'@deslop/coding-standards/no-native-emptiness-check': "error";
|
|
4128
4129
|
'@deslop/coding-standards/no-native-method-call': "error";
|
package/dist/oxlint.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as values, An as NodeInspectSymbol, Bn as symbol, C as filterMap, Cr as pipe, Ct as none, D as flatMap$1, Er as pipeArguments, Et as zipWith, F as isArrayNonEmpty, Gn as optimize, Hn as combine, J as take, K as some$1, M as getSomes, N as head, O as flatten, P as isArrayEmpty, Q as remove, R as join, Rn as byReferenceUnsafe, S as filter$1, St as match$1, T as findFirstIndex, Tt as some, U as of, Un as hash, V as map$1, W as prepend, Wn as number, X as get$2, Xn as hasProperty, Y as fromEntries, Yn as symbol$1, Zn as isBoolean, _ as dedupe, a as includes, ar as isNumber, b as ensure, c as startsWith, ct as contains, dt as firstSomeOf, f as TaggedError, ft as flatMap, g as contains$1, gt as getOrElse, h as appendAll, ht as fromUndefinedOr, i as Order, ir as isNullish$1, j as get$1, k as forEach, l as trim, lr as isReadonlyObject, lt as exists, m as append, mt as fromNullishOr, n as make$2, nr as isNotNullish, o as match, pt as flatten$1, q as sort, qn as string, r as update, s as split, st as all, t as get$3, tr as isNotNull, tt as fromOption, ur as isString, ut as filter, v as dropRight, w as findFirst, wt as orElse, x as every, xt as map, y as empty, yr as dual, yt as isSome, z as last, zn as equals } from "./MutableRef-WrqsqeER.mjs";
|
|
2
2
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/graph.js
|
|
3
3
|
/** @internal */
|
|
4
4
|
const TypeId = "~effect/Graph";
|
|
@@ -1314,6 +1314,30 @@ const noLet = defineRule({
|
|
|
1314
1314
|
meta: { type: "problem" }
|
|
1315
1315
|
});
|
|
1316
1316
|
//#endregion
|
|
1317
|
+
//#region src/rules/no-multiline-comment.ts
|
|
1318
|
+
const directive = /^\s*(?:eslint|oxlint|@effect-diagnostics|@ts-|\/\s*<reference|#region|#endregion)/u;
|
|
1319
|
+
function adjacentLines(pair) {
|
|
1320
|
+
const first = pair.first;
|
|
1321
|
+
const second = pair.second;
|
|
1322
|
+
return first?.type === "Line" && second?.type === "Line" && second.loc.start.line === first.loc.end.line + 1;
|
|
1323
|
+
}
|
|
1324
|
+
const noMultilineComment = defineRule({
|
|
1325
|
+
create: (context) => ({ Program: () => {
|
|
1326
|
+
const comments = pipe(context.sourceCode.getAllComments(), filter$1((comment) => !directive.test(comment.value)));
|
|
1327
|
+
pipe(comments, filter$1((comment, index) => adjacentLines({
|
|
1328
|
+
first: comment,
|
|
1329
|
+
second: comments[index + 1]
|
|
1330
|
+
}) && !adjacentLines({
|
|
1331
|
+
first: comments[index - 1],
|
|
1332
|
+
second: comment
|
|
1333
|
+
}) || comment.type === "Block" && includes("\n")(trim(comment.value))), forEach((comment) => context.report({
|
|
1334
|
+
message: "A comment is one line that states an outside constraint; rename or split the code instead.",
|
|
1335
|
+
node: comment
|
|
1336
|
+
})));
|
|
1337
|
+
} }),
|
|
1338
|
+
meta: { type: "suggestion" }
|
|
1339
|
+
});
|
|
1340
|
+
//#endregion
|
|
1317
1341
|
//#region src/rules/no-native-control.ts
|
|
1318
1342
|
const primitives = {
|
|
1319
1343
|
button: "Button",
|
|
@@ -2142,6 +2166,9 @@ function redundantConstAlias(input) {
|
|
|
2142
2166
|
scope: input.context.sourceCode.getScope(input.node)
|
|
2143
2167
|
}), exists((alias) => filter$1(alias.references, (reference) => reference.isRead()).length === 1));
|
|
2144
2168
|
}
|
|
2169
|
+
function exportedAlias(input) {
|
|
2170
|
+
return input.node.parent.type === "VariableDeclaration" && input.node.parent.kind === "const" && input.node.parent.parent.type === "ExportNamedDeclaration" && input.node.id.type === "Identifier" && input.node.init?.type === "Identifier" && pipe(variableFor(input.context, input.node.init), exists((variable) => some$1(variable.defs, (definition) => definition.type === "ImportBinding" || definition.type === "FunctionName" || definition.type === "ClassName" || definition.node.type === "VariableDeclarator" && definition.node.parent.type === "VariableDeclaration" && definition.node.parent.kind === "const")));
|
|
2171
|
+
}
|
|
2145
2172
|
function singleUseLiteral(input) {
|
|
2146
2173
|
if (input.node.parent.type !== "VariableDeclaration" || input.node.parent.kind !== "const" || isExport(input.node.parent.parent) || input.node.id.type !== "Identifier" || input.node.id.typeAnnotation !== null || !(input.node.init?.type === "Literal" && !hasProperty(input.node.init, "regex") || input.node.init?.type === "TemplateLiteral" && isArrayEmpty(input.node.init.expressions))) return false;
|
|
2147
2174
|
return pipe(variableFromScope({
|
|
@@ -2220,6 +2247,13 @@ const noTrivialIndirection = defineRule({
|
|
|
2220
2247
|
});
|
|
2221
2248
|
},
|
|
2222
2249
|
VariableDeclarator: (node) => {
|
|
2250
|
+
if (exportedAlias({
|
|
2251
|
+
context,
|
|
2252
|
+
node
|
|
2253
|
+
})) context.report({
|
|
2254
|
+
message: "Export the value under one name; this second name is an alias.",
|
|
2255
|
+
node
|
|
2256
|
+
});
|
|
2223
2257
|
if (redundantConstAlias({
|
|
2224
2258
|
context,
|
|
2225
2259
|
node
|
|
@@ -2578,6 +2612,7 @@ const oxlint = defineConfig({
|
|
|
2578
2612
|
"@deslop/coding-standards/no-fake-ref-state": "error",
|
|
2579
2613
|
"@deslop/coding-standards/no-hand-written-guard": "error",
|
|
2580
2614
|
"@deslop/coding-standards/no-let": "error",
|
|
2615
|
+
"@deslop/coding-standards/no-multiline-comment": "error",
|
|
2581
2616
|
"@deslop/coding-standards/no-native-control": "error",
|
|
2582
2617
|
"@deslop/coding-standards/no-native-emptiness-check": "error",
|
|
2583
2618
|
"@deslop/coding-standards/no-native-method-call": "error",
|
|
@@ -3282,6 +3317,7 @@ var oxlint_default = definePlugin({
|
|
|
3282
3317
|
"no-fake-ref-state": noFakeRefState,
|
|
3283
3318
|
"no-hand-written-guard": noHandWrittenGuard,
|
|
3284
3319
|
"no-let": noLet,
|
|
3320
|
+
"no-multiline-comment": noMultilineComment,
|
|
3285
3321
|
"no-native-control": noNativeControl,
|
|
3286
3322
|
"no-native-emptiness-check": noNativeEmptinessCheck,
|
|
3287
3323
|
"no-native-method-call": noNativeMethodCall,
|