@conorroberts/utils 0.0.113 → 0.0.116
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/db/migrate.mjs +1 -2
- package/dist/db/migrate.mjs.map +1 -1
- package/dist/db/validate-schema.mjs +1 -2
- package/dist/db/validate-schema.mjs.map +1 -1
- package/dist/env.d.mts +0 -1
- package/dist/env.mjs +2 -3
- package/dist/env.mjs.map +1 -1
- package/dist/images.mjs +1 -2
- package/dist/images.mjs.map +1 -1
- package/dist/oxlint/index.d.mts +2 -2
- package/dist/oxlint/index.mjs +65 -121
- package/dist/oxlint/index.mjs.map +1 -1
- package/dist/react.mjs +1 -6
- package/dist/react.mjs.map +1 -1
- package/dist/vscode/settings.json +47 -0
- package/package.json +14 -8
package/dist/oxlint/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { EMOJI_REGEX } from "valibot";
|
|
2
|
-
import { definePlugin, defineRule } from "oxlint/plugins";
|
|
3
|
-
|
|
2
|
+
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
4
3
|
//#region src/oxlint-plugins/jsx-component-pascal-case.js
|
|
5
4
|
/**
|
|
6
|
-
* @typedef {import("oxlint/plugins").Context} RuleContext
|
|
7
|
-
* @typedef {import("oxlint/plugins").ESTree.Node} ESTNode
|
|
8
|
-
* @typedef {import("oxlint/plugins").ESTree.Expression} ESTExpression
|
|
9
|
-
* @typedef {import("oxlint/plugins").ESTree.ReturnStatement} ReturnStatementNode
|
|
10
|
-
* @typedef {import("oxlint/plugins").ESTree.Function | import("oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
5
|
+
* @typedef {import("@oxlint/plugins").Context} RuleContext
|
|
6
|
+
* @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode
|
|
7
|
+
* @typedef {import("@oxlint/plugins").ESTree.Expression} ESTExpression
|
|
8
|
+
* @typedef {import("@oxlint/plugins").ESTree.ReturnStatement} ReturnStatementNode
|
|
9
|
+
* @typedef {import("@oxlint/plugins").ESTree.Function | import("@oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
11
10
|
*/
|
|
12
11
|
/**
|
|
13
12
|
* @typedef {object} FunctionContext
|
|
@@ -86,7 +85,7 @@ const expressionContainsJsx$2 = (root) => {
|
|
|
86
85
|
}
|
|
87
86
|
return false;
|
|
88
87
|
};
|
|
89
|
-
const
|
|
88
|
+
const jsxComponentPascalCaseRule = defineRule({
|
|
90
89
|
meta: {
|
|
91
90
|
type: "problem",
|
|
92
91
|
docs: {
|
|
@@ -149,11 +148,7 @@ const rule$15 = defineRule({
|
|
|
149
148
|
};
|
|
150
149
|
}
|
|
151
150
|
});
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
//#endregion
|
|
155
|
-
//#region src/oxlint-plugins/no-array-type.js
|
|
156
|
-
const rule$14 = defineRule({
|
|
151
|
+
const noArrayTypeRule = defineRule({
|
|
157
152
|
meta: {
|
|
158
153
|
type: "problem",
|
|
159
154
|
docs: {
|
|
@@ -172,16 +167,14 @@ const rule$14 = defineRule({
|
|
|
172
167
|
} };
|
|
173
168
|
}
|
|
174
169
|
});
|
|
175
|
-
const noArrayTypeRule = rule$14;
|
|
176
|
-
|
|
177
170
|
//#endregion
|
|
178
171
|
//#region src/oxlint-plugins/no-component-date-instantiation.js
|
|
179
172
|
/**
|
|
180
|
-
* @typedef {import("oxlint/plugins").Context} RuleContext
|
|
181
|
-
* @typedef {import("oxlint/plugins").ESTree.Node} ESTNode
|
|
182
|
-
* @typedef {import("oxlint/plugins").ESTree.NewExpression} NewExpressionNode
|
|
183
|
-
* @typedef {import("oxlint/plugins").ESTree.ReturnStatement} ReturnStatementNode
|
|
184
|
-
* @typedef {import("oxlint/plugins").ESTree.Function | import("oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
173
|
+
* @typedef {import("@oxlint/plugins").Context} RuleContext
|
|
174
|
+
* @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode
|
|
175
|
+
* @typedef {import("@oxlint/plugins").ESTree.NewExpression} NewExpressionNode
|
|
176
|
+
* @typedef {import("@oxlint/plugins").ESTree.ReturnStatement} ReturnStatementNode
|
|
177
|
+
* @typedef {import("@oxlint/plugins").ESTree.Function | import("@oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
185
178
|
*/
|
|
186
179
|
/**
|
|
187
180
|
* @typedef {object} FunctionContext
|
|
@@ -247,7 +240,7 @@ const isDateInstantiation = (node) => {
|
|
|
247
240
|
if (node.callee.type === "Identifier" && node.callee.name === "Date") return true;
|
|
248
241
|
return false;
|
|
249
242
|
};
|
|
250
|
-
const
|
|
243
|
+
const noComponentDateInstantiationRule = defineRule({
|
|
251
244
|
meta: {
|
|
252
245
|
type: "problem",
|
|
253
246
|
docs: {
|
|
@@ -324,19 +317,17 @@ const rule$13 = defineRule({
|
|
|
324
317
|
};
|
|
325
318
|
}
|
|
326
319
|
});
|
|
327
|
-
const noComponentDateInstantiationRule = rule$13;
|
|
328
|
-
|
|
329
320
|
//#endregion
|
|
330
321
|
//#region src/oxlint-plugins/no-inline-components.js
|
|
331
322
|
/**
|
|
332
|
-
* @typedef {import("oxlint/plugins").Context} RuleContext
|
|
333
|
-
* @typedef {import("oxlint/plugins").ESTree.Node} ESTNode
|
|
334
|
-
* @typedef {import("oxlint/plugins").ESTree.Expression} ESTExpression
|
|
335
|
-
* @typedef {import("oxlint/plugins").ESTree.Pattern} ESTPattern
|
|
336
|
-
* @typedef {import("oxlint/plugins").ESTree.ReturnStatement} ReturnStatementNode
|
|
337
|
-
* @typedef {import("oxlint/plugins").ESTree.VariableDeclarator} VariableDeclaratorNode
|
|
338
|
-
* @typedef {import("oxlint/plugins").ESTree.AssignmentExpression} AssignmentExpressionNode
|
|
339
|
-
* @typedef {import("oxlint/plugins").ESTree.Function | import("oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
323
|
+
* @typedef {import("@oxlint/plugins").Context} RuleContext
|
|
324
|
+
* @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode
|
|
325
|
+
* @typedef {import("@oxlint/plugins").ESTree.Expression} ESTExpression
|
|
326
|
+
* @typedef {import("@oxlint/plugins").ESTree.Pattern} ESTPattern
|
|
327
|
+
* @typedef {import("@oxlint/plugins").ESTree.ReturnStatement} ReturnStatementNode
|
|
328
|
+
* @typedef {import("@oxlint/plugins").ESTree.VariableDeclarator} VariableDeclaratorNode
|
|
329
|
+
* @typedef {import("@oxlint/plugins").ESTree.AssignmentExpression} AssignmentExpressionNode
|
|
330
|
+
* @typedef {import("@oxlint/plugins").ESTree.Function | import("@oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
340
331
|
*/
|
|
341
332
|
/**
|
|
342
333
|
* @typedef {object} RecordedAssignment
|
|
@@ -541,7 +532,7 @@ const createNestedFunctionMessage = (childName, parentName) => `JSX-returning ${
|
|
|
541
532
|
* @param {string} name
|
|
542
533
|
*/
|
|
543
534
|
const createIIFEMessage = (name) => `JSX-returning ${describeNested(name)} should not be declared as an immediately invoked function expression (IIFE). Extract it to a named function at module scope.`;
|
|
544
|
-
const
|
|
535
|
+
const noInlineComponentsRule = defineRule({
|
|
545
536
|
meta: {
|
|
546
537
|
type: "problem",
|
|
547
538
|
docs: {
|
|
@@ -689,15 +680,13 @@ const rule$12 = defineRule({
|
|
|
689
680
|
};
|
|
690
681
|
}
|
|
691
682
|
});
|
|
692
|
-
const noInlineComponentsRule = rule$12;
|
|
693
|
-
|
|
694
683
|
//#endregion
|
|
695
684
|
//#region src/oxlint-plugins/no-component-pure-functions.js
|
|
696
685
|
/**
|
|
697
|
-
* @typedef {import("oxlint/plugins").Context} RuleContext
|
|
698
|
-
* @typedef {import("oxlint/plugins").ESTree.Node} ESTNode
|
|
699
|
-
* @typedef {import("oxlint/plugins").ESTree.Function | import("oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
700
|
-
* @typedef {import("oxlint/plugins").ESTree.VariableDeclarator} VariableDeclaratorNode
|
|
686
|
+
* @typedef {import("@oxlint/plugins").Context} RuleContext
|
|
687
|
+
* @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode
|
|
688
|
+
* @typedef {import("@oxlint/plugins").ESTree.Function | import("@oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
689
|
+
* @typedef {import("@oxlint/plugins").ESTree.VariableDeclarator} VariableDeclaratorNode
|
|
701
690
|
*/
|
|
702
691
|
const FUNCTION_NODE_TYPES$2 = new Set([
|
|
703
692
|
"FunctionDeclaration",
|
|
@@ -933,7 +922,7 @@ const isPureFunction$1 = (node) => {
|
|
|
933
922
|
if (accessesEnclosingScope$1(node, collectLocalNames$1(node))) return false;
|
|
934
923
|
return true;
|
|
935
924
|
};
|
|
936
|
-
const
|
|
925
|
+
const noComponentPureFunctionsRule = defineRule({
|
|
937
926
|
meta: {
|
|
938
927
|
type: "suggestion",
|
|
939
928
|
docs: {
|
|
@@ -965,12 +954,7 @@ const rule$11 = defineRule({
|
|
|
965
954
|
} };
|
|
966
955
|
}
|
|
967
956
|
});
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
//#endregion
|
|
971
|
-
//#region src/oxlint-plugins/no-delete.js
|
|
972
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
973
|
-
const rule$10 = defineRule({
|
|
957
|
+
const noDeleteRule = defineRule({
|
|
974
958
|
meta: {
|
|
975
959
|
type: "problem",
|
|
976
960
|
docs: {
|
|
@@ -989,11 +973,9 @@ const rule$10 = defineRule({
|
|
|
989
973
|
} };
|
|
990
974
|
}
|
|
991
975
|
});
|
|
992
|
-
const noDeleteRule = rule$10;
|
|
993
|
-
|
|
994
976
|
//#endregion
|
|
995
977
|
//#region src/oxlint-plugins/no-emoji.js
|
|
996
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
978
|
+
/** @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode */
|
|
997
979
|
/**
|
|
998
980
|
* Regex pattern to match emojis within a string
|
|
999
981
|
* Based on valibot's EMOJI_REGEX but without anchors and with global flag
|
|
@@ -1019,7 +1001,7 @@ const getEmojiPreview = (text) => {
|
|
|
1019
1001
|
const preview = uniqueEmojis.slice(0, 3).join(" ");
|
|
1020
1002
|
return uniqueEmojis.length > 3 ? `${preview} ...` : preview;
|
|
1021
1003
|
};
|
|
1022
|
-
const
|
|
1004
|
+
const noEmojiRule = defineRule({
|
|
1023
1005
|
meta: {
|
|
1024
1006
|
type: "problem",
|
|
1025
1007
|
docs: {
|
|
@@ -1070,12 +1052,7 @@ const rule$9 = defineRule({
|
|
|
1070
1052
|
};
|
|
1071
1053
|
}
|
|
1072
1054
|
});
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
//#endregion
|
|
1076
|
-
//#region src/oxlint-plugins/no-finally.js
|
|
1077
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1078
|
-
const rule$8 = defineRule({
|
|
1055
|
+
const noFinallyRule = defineRule({
|
|
1079
1056
|
meta: {
|
|
1080
1057
|
type: "problem",
|
|
1081
1058
|
docs: {
|
|
@@ -1094,12 +1071,7 @@ const rule$8 = defineRule({
|
|
|
1094
1071
|
} };
|
|
1095
1072
|
}
|
|
1096
1073
|
});
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
//#endregion
|
|
1100
|
-
//#region src/oxlint-plugins/no-iife.js
|
|
1101
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1102
|
-
const rule$7 = defineRule({
|
|
1074
|
+
const noIifeRule = defineRule({
|
|
1103
1075
|
meta: {
|
|
1104
1076
|
type: "problem",
|
|
1105
1077
|
docs: {
|
|
@@ -1119,11 +1091,9 @@ const rule$7 = defineRule({
|
|
|
1119
1091
|
} };
|
|
1120
1092
|
}
|
|
1121
1093
|
});
|
|
1122
|
-
const noIifeRule = rule$7;
|
|
1123
|
-
|
|
1124
1094
|
//#endregion
|
|
1125
1095
|
//#region src/oxlint-plugins/no-nested-conditionals.js
|
|
1126
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1096
|
+
/** @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode */
|
|
1127
1097
|
const DEFAULT_MAX_DEPTH = 2;
|
|
1128
1098
|
/**
|
|
1129
1099
|
* @param {unknown} node
|
|
@@ -1258,14 +1228,13 @@ const noNestedConditionalsRule = defineRule({
|
|
|
1258
1228
|
};
|
|
1259
1229
|
}
|
|
1260
1230
|
});
|
|
1261
|
-
|
|
1262
1231
|
//#endregion
|
|
1263
1232
|
//#region src/oxlint-plugins/no-nested-pure-functions.js
|
|
1264
1233
|
/**
|
|
1265
|
-
* @typedef {import("oxlint/plugins").Context} RuleContext
|
|
1266
|
-
* @typedef {import("oxlint/plugins").ESTree.Node} ESTNode
|
|
1267
|
-
* @typedef {import("oxlint/plugins").ESTree.Function | import("oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
1268
|
-
* @typedef {import("oxlint/plugins").ESTree.VariableDeclarator} VariableDeclaratorNode
|
|
1234
|
+
* @typedef {import("@oxlint/plugins").Context} RuleContext
|
|
1235
|
+
* @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode
|
|
1236
|
+
* @typedef {import("@oxlint/plugins").ESTree.Function | import("@oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
1237
|
+
* @typedef {import("@oxlint/plugins").ESTree.VariableDeclarator} VariableDeclaratorNode
|
|
1269
1238
|
*/
|
|
1270
1239
|
const FUNCTION_NODE_TYPES$1 = new Set([
|
|
1271
1240
|
"FunctionDeclaration",
|
|
@@ -1492,7 +1461,7 @@ const isPureFunction = (node) => {
|
|
|
1492
1461
|
if (accessesEnclosingScope(node, collectLocalNames(node))) return false;
|
|
1493
1462
|
return true;
|
|
1494
1463
|
};
|
|
1495
|
-
const
|
|
1464
|
+
const noNestedPureFunctionsRule = defineRule({
|
|
1496
1465
|
meta: {
|
|
1497
1466
|
type: "suggestion",
|
|
1498
1467
|
docs: {
|
|
@@ -1524,12 +1493,7 @@ const rule$6 = defineRule({
|
|
|
1524
1493
|
} };
|
|
1525
1494
|
}
|
|
1526
1495
|
});
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
//#endregion
|
|
1530
|
-
//#region src/oxlint-plugins/no-promise-then.js
|
|
1531
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1532
|
-
const rule$5 = defineRule({
|
|
1496
|
+
const noPromiseThenRule = defineRule({
|
|
1533
1497
|
meta: {
|
|
1534
1498
|
type: "problem",
|
|
1535
1499
|
docs: {
|
|
@@ -1550,11 +1514,9 @@ const rule$5 = defineRule({
|
|
|
1550
1514
|
} };
|
|
1551
1515
|
}
|
|
1552
1516
|
});
|
|
1553
|
-
const noPromiseThenRule = rule$5;
|
|
1554
|
-
|
|
1555
1517
|
//#endregion
|
|
1556
1518
|
//#region src/oxlint-plugins/no-react-namespace.js
|
|
1557
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1519
|
+
/** @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode */
|
|
1558
1520
|
/**
|
|
1559
1521
|
* Check if a MemberExpression is accessing the React namespace
|
|
1560
1522
|
* @param {ESTNode} node
|
|
@@ -1595,7 +1557,7 @@ const isTypeContext = (node) => {
|
|
|
1595
1557
|
};
|
|
1596
1558
|
return checkParent(node.parent);
|
|
1597
1559
|
};
|
|
1598
|
-
const
|
|
1560
|
+
const noReactNamespaceRule = defineRule({
|
|
1599
1561
|
meta: {
|
|
1600
1562
|
type: "problem",
|
|
1601
1563
|
docs: {
|
|
@@ -1617,11 +1579,9 @@ const rule$4 = defineRule({
|
|
|
1617
1579
|
} };
|
|
1618
1580
|
}
|
|
1619
1581
|
});
|
|
1620
|
-
const noReactNamespaceRule = rule$4;
|
|
1621
|
-
|
|
1622
1582
|
//#endregion
|
|
1623
1583
|
//#region src/oxlint-plugins/no-switch-plugin.js
|
|
1624
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1584
|
+
/** @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode */
|
|
1625
1585
|
const noSwitchRule = defineRule({
|
|
1626
1586
|
meta: {
|
|
1627
1587
|
type: "problem",
|
|
@@ -1641,11 +1601,7 @@ const noSwitchRule = defineRule({
|
|
|
1641
1601
|
} };
|
|
1642
1602
|
}
|
|
1643
1603
|
});
|
|
1644
|
-
|
|
1645
|
-
//#endregion
|
|
1646
|
-
//#region src/oxlint-plugins/no-top-level-let.js
|
|
1647
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1648
|
-
const rule$3 = defineRule({
|
|
1604
|
+
const noTopLevelLetRule = defineRule({
|
|
1649
1605
|
meta: {
|
|
1650
1606
|
type: "problem",
|
|
1651
1607
|
docs: {
|
|
@@ -1665,14 +1621,14 @@ const rule$3 = defineRule({
|
|
|
1665
1621
|
* @param {unknown} node
|
|
1666
1622
|
* @returns {node is ESTNode & { type: string }}
|
|
1667
1623
|
*/
|
|
1668
|
-
const isNode
|
|
1624
|
+
const isNode = (node) => Boolean(node && typeof node === "object" && "type" in node);
|
|
1669
1625
|
/**
|
|
1670
1626
|
* @param {ESTNode} node
|
|
1671
1627
|
* @returns {boolean}
|
|
1672
1628
|
*/
|
|
1673
1629
|
const isTopLevelVariableDeclaration = (node) => {
|
|
1674
1630
|
const parent = node.parent;
|
|
1675
|
-
if (!parent || !isNode
|
|
1631
|
+
if (!parent || !isNode(parent)) return false;
|
|
1676
1632
|
if (parent.type === "Program") return true;
|
|
1677
1633
|
if (parent.type === "ExportNamedDeclaration" && parent.parent?.type === "Program") return true;
|
|
1678
1634
|
return false;
|
|
@@ -1682,7 +1638,7 @@ const rule$3 = defineRule({
|
|
|
1682
1638
|
* @returns {boolean}
|
|
1683
1639
|
*/
|
|
1684
1640
|
const isMutableObjectInit = (node) => {
|
|
1685
|
-
if (!node || !isNode
|
|
1641
|
+
if (!node || !isNode(node)) return false;
|
|
1686
1642
|
if (node.type === "ObjectExpression" || node.type === "ArrayExpression") return true;
|
|
1687
1643
|
if (node.type === "NewExpression" && node.callee?.type === "Identifier") return [
|
|
1688
1644
|
"Map",
|
|
@@ -1698,7 +1654,7 @@ const rule$3 = defineRule({
|
|
|
1698
1654
|
*/
|
|
1699
1655
|
const unwrapExpression = (node) => {
|
|
1700
1656
|
let current = node;
|
|
1701
|
-
while (current && isNode
|
|
1657
|
+
while (current && isNode(current)) {
|
|
1702
1658
|
if (current.type === "TSAsExpression" || current.type === "TSNonNullExpression") {
|
|
1703
1659
|
current = current.expression;
|
|
1704
1660
|
continue;
|
|
@@ -1713,7 +1669,7 @@ const rule$3 = defineRule({
|
|
|
1713
1669
|
*/
|
|
1714
1670
|
const getMemberRootName = (node) => {
|
|
1715
1671
|
let current = unwrapExpression(node);
|
|
1716
|
-
while (current && isNode
|
|
1672
|
+
while (current && isNode(current)) {
|
|
1717
1673
|
if (current.type === "MemberExpression") {
|
|
1718
1674
|
current = unwrapExpression(current.object);
|
|
1719
1675
|
continue;
|
|
@@ -1728,7 +1684,7 @@ const rule$3 = defineRule({
|
|
|
1728
1684
|
* @returns {string | null}
|
|
1729
1685
|
*/
|
|
1730
1686
|
const getMemberPropertyName = (node) => {
|
|
1731
|
-
if (!isNode
|
|
1687
|
+
if (!isNode(node) || node.type !== "MemberExpression") return null;
|
|
1732
1688
|
if (node.property?.type === "Identifier" && node.computed === false) return node.property.name;
|
|
1733
1689
|
if (node.property?.type === "Literal" && typeof node.property.value === "string") return node.property.value;
|
|
1734
1690
|
return null;
|
|
@@ -1768,7 +1724,7 @@ const rule$3 = defineRule({
|
|
|
1768
1724
|
if (rawNode.type !== "VariableDeclarator") return;
|
|
1769
1725
|
const declarator = rawNode;
|
|
1770
1726
|
const declaration = declarator.parent;
|
|
1771
|
-
if (!declaration || !isNode
|
|
1727
|
+
if (!declaration || !isNode(declaration) || declaration.type !== "VariableDeclaration") return;
|
|
1772
1728
|
if (declaration.kind !== "const") return;
|
|
1773
1729
|
if (!isTopLevelVariableDeclaration(declaration)) return;
|
|
1774
1730
|
if (!isMutableObjectInit(declarator.init)) return;
|
|
@@ -1778,7 +1734,7 @@ const rule$3 = defineRule({
|
|
|
1778
1734
|
AssignmentExpression(rawNode) {
|
|
1779
1735
|
if (rawNode.type !== "AssignmentExpression") return;
|
|
1780
1736
|
const left = rawNode.left;
|
|
1781
|
-
if (!left || !isNode
|
|
1737
|
+
if (!left || !isNode(left) || left.type !== "MemberExpression") return;
|
|
1782
1738
|
const rootName = getMemberRootName(left);
|
|
1783
1739
|
if (!rootName || !topLevelMutableBindings.has(rootName)) return;
|
|
1784
1740
|
context.report({
|
|
@@ -1790,7 +1746,7 @@ const rule$3 = defineRule({
|
|
|
1790
1746
|
UpdateExpression(rawNode) {
|
|
1791
1747
|
if (rawNode.type !== "UpdateExpression") return;
|
|
1792
1748
|
const argument = rawNode.argument;
|
|
1793
|
-
if (!argument || !isNode
|
|
1749
|
+
if (!argument || !isNode(argument) || argument.type !== "MemberExpression") return;
|
|
1794
1750
|
const rootName = getMemberRootName(argument);
|
|
1795
1751
|
if (!rootName || !topLevelMutableBindings.has(rootName)) return;
|
|
1796
1752
|
context.report({
|
|
@@ -1802,7 +1758,7 @@ const rule$3 = defineRule({
|
|
|
1802
1758
|
CallExpression(rawNode) {
|
|
1803
1759
|
if (rawNode.type !== "CallExpression") return;
|
|
1804
1760
|
const callee = rawNode.callee;
|
|
1805
|
-
if (!callee || !isNode
|
|
1761
|
+
if (!callee || !isNode(callee) || callee.type !== "MemberExpression") return;
|
|
1806
1762
|
const rootName = getMemberRootName(callee);
|
|
1807
1763
|
if (!rootName || !topLevelMutableBindings.has(rootName)) return;
|
|
1808
1764
|
const methodName = getMemberPropertyName(callee);
|
|
@@ -1816,12 +1772,7 @@ const rule$3 = defineRule({
|
|
|
1816
1772
|
};
|
|
1817
1773
|
}
|
|
1818
1774
|
});
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1821
|
-
//#endregion
|
|
1822
|
-
//#region src/oxlint-plugins/no-type-cast.js
|
|
1823
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1824
|
-
const rule$2 = defineRule({
|
|
1775
|
+
const noTypeCastRule = defineRule({
|
|
1825
1776
|
meta: {
|
|
1826
1777
|
type: "problem",
|
|
1827
1778
|
docs: {
|
|
@@ -1857,12 +1808,10 @@ const rule$2 = defineRule({
|
|
|
1857
1808
|
};
|
|
1858
1809
|
}
|
|
1859
1810
|
});
|
|
1860
|
-
const noTypeCastRule = rule$2;
|
|
1861
|
-
|
|
1862
1811
|
//#endregion
|
|
1863
1812
|
//#region src/oxlint-plugins/no-void.js
|
|
1864
|
-
/** @typedef {import("oxlint/plugins").ESTree.Node} ESTNode */
|
|
1865
|
-
/** @typedef {import("oxlint/plugins").ESTree.UnaryExpression} UnaryExpression */
|
|
1813
|
+
/** @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode */
|
|
1814
|
+
/** @typedef {import("@oxlint/plugins").ESTree.UnaryExpression} UnaryExpression */
|
|
1866
1815
|
/**
|
|
1867
1816
|
* The rule is only meant to block the JavaScript runtime `void` operator.
|
|
1868
1817
|
*
|
|
@@ -1873,7 +1822,7 @@ const noTypeCastRule = rule$2;
|
|
|
1873
1822
|
* @returns {node is UnaryExpression}
|
|
1874
1823
|
*/
|
|
1875
1824
|
const isRuntimeVoidOperator = (node) => node.type === "UnaryExpression" && node.operator === "void";
|
|
1876
|
-
const
|
|
1825
|
+
const noVoidRule = defineRule({
|
|
1877
1826
|
meta: {
|
|
1878
1827
|
type: "problem",
|
|
1879
1828
|
docs: {
|
|
@@ -1895,15 +1844,13 @@ const rule$1 = defineRule({
|
|
|
1895
1844
|
};
|
|
1896
1845
|
}
|
|
1897
1846
|
});
|
|
1898
|
-
const noVoidRule = rule$1;
|
|
1899
|
-
|
|
1900
1847
|
//#endregion
|
|
1901
1848
|
//#region src/oxlint-plugins/pretty-props.js
|
|
1902
1849
|
/**
|
|
1903
|
-
* @typedef {import("oxlint/plugins").Context} RuleContext
|
|
1904
|
-
* @typedef {import("oxlint/plugins").ESTree.Node} ESTNode
|
|
1905
|
-
* @typedef {import("oxlint/plugins").ESTree.Expression} ESTExpression
|
|
1906
|
-
* @typedef {import("oxlint/plugins").ESTree.Function | import("oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
1850
|
+
* @typedef {import("@oxlint/plugins").Context} RuleContext
|
|
1851
|
+
* @typedef {import("@oxlint/plugins").ESTree.Node} ESTNode
|
|
1852
|
+
* @typedef {import("@oxlint/plugins").ESTree.Expression} ESTExpression
|
|
1853
|
+
* @typedef {import("@oxlint/plugins").ESTree.Function | import("@oxlint/plugins").ESTree.ArrowFunctionExpression} FunctionLikeNode
|
|
1907
1854
|
*/
|
|
1908
1855
|
const JSX_NODE_TYPES = new Set(["JSXElement", "JSXFragment"]);
|
|
1909
1856
|
const FUNCTION_NODE_TYPES = new Set([
|
|
@@ -1972,7 +1919,7 @@ const functionReturnsJsx = (node) => {
|
|
|
1972
1919
|
}
|
|
1973
1920
|
return false;
|
|
1974
1921
|
};
|
|
1975
|
-
const
|
|
1922
|
+
const prettyPropsRule = defineRule({
|
|
1976
1923
|
meta: {
|
|
1977
1924
|
type: "problem",
|
|
1978
1925
|
docs: {
|
|
@@ -2060,8 +2007,6 @@ const rule = defineRule({
|
|
|
2060
2007
|
};
|
|
2061
2008
|
}
|
|
2062
2009
|
});
|
|
2063
|
-
const prettyPropsRule = rule;
|
|
2064
|
-
|
|
2065
2010
|
//#endregion
|
|
2066
2011
|
//#region src/oxlint-plugins/index.js
|
|
2067
2012
|
const plugin = definePlugin({
|
|
@@ -2087,8 +2032,7 @@ const plugin = definePlugin({
|
|
|
2087
2032
|
"pretty-props": prettyPropsRule
|
|
2088
2033
|
}
|
|
2089
2034
|
});
|
|
2090
|
-
var oxlint_plugins_default = plugin;
|
|
2091
|
-
|
|
2092
2035
|
//#endregion
|
|
2093
|
-
export {
|
|
2036
|
+
export { plugin as default };
|
|
2037
|
+
|
|
2094
2038
|
//# sourceMappingURL=index.mjs.map
|