oxlint-plugin-arch 0.5.0 → 0.6.0
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/CHANGELOG.md +10 -1
- package/README.md +79 -4
- package/dist/constants/test.constants.d.ts +1 -0
- package/dist/index.js +205 -83
- package/dist/presets/index.d.ts +1 -1
- package/dist/presets/index.js +57 -31
- package/dist/presets/tanstack-start-react-modules-preset.js +57 -31
- package/dist/rules/module-policy/index.js +321 -11
- package/dist/types/preset.types.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1252,9 +1252,130 @@ var chainNewline = defineRule2({
|
|
|
1252
1252
|
}
|
|
1253
1253
|
});
|
|
1254
1254
|
|
|
1255
|
-
// src/rules/
|
|
1255
|
+
// src/rules/component-props.ts
|
|
1256
1256
|
import { defineRule as defineRule3 } from "@oxlint/plugins";
|
|
1257
|
-
|
|
1257
|
+
function unwrapExport(statement) {
|
|
1258
|
+
return statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
1259
|
+
}
|
|
1260
|
+
function topLevelComponents(program) {
|
|
1261
|
+
return program.body.flatMap((statement, index) => {
|
|
1262
|
+
const declaration = unwrapExport(statement);
|
|
1263
|
+
if (declaration?.type === "FunctionDeclaration" && declaration.id) {
|
|
1264
|
+
return [{ candidate: { name: declaration.id.name, node: declaration, declaration }, index }];
|
|
1265
|
+
}
|
|
1266
|
+
if (declaration?.type !== "VariableDeclaration") {
|
|
1267
|
+
return [];
|
|
1268
|
+
}
|
|
1269
|
+
return declaration.declarations.flatMap((item) => item.id.type === "Identifier" ? [{ candidate: { name: item.id.name, node: item, declaration, initializer: item.init }, index }] : []);
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
function propsTarget(node) {
|
|
1273
|
+
if (node?.type === "FunctionDeclaration" || node?.type === "FunctionExpression" || node?.type === "ArrowFunctionExpression") {
|
|
1274
|
+
return { fn: node };
|
|
1275
|
+
}
|
|
1276
|
+
if (node?.type !== "CallExpression") {
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
const name = astCallName(node);
|
|
1280
|
+
const inner = name === "memo" || name === "forwardRef" ? propsTarget(node.arguments[0]) : undefined;
|
|
1281
|
+
const typeArgument = name === "forwardRef" ? node.typeArguments?.params[1] : undefined;
|
|
1282
|
+
return inner && typeArgument ? { ...inner, typeArgument } : inner;
|
|
1283
|
+
}
|
|
1284
|
+
function parameterType(parameter) {
|
|
1285
|
+
if (parameter?.type === "AssignmentPattern") {
|
|
1286
|
+
return parameterType(parameter.left);
|
|
1287
|
+
}
|
|
1288
|
+
return parameter && parameter.type !== "TSParameterProperty" ? parameter.typeAnnotation?.typeAnnotation : undefined;
|
|
1289
|
+
}
|
|
1290
|
+
function containsTypeLiteral(node) {
|
|
1291
|
+
let found = false;
|
|
1292
|
+
astVisit(node, [], (candidate) => {
|
|
1293
|
+
found ||= candidate.type === "TSTypeLiteral";
|
|
1294
|
+
});
|
|
1295
|
+
return found;
|
|
1296
|
+
}
|
|
1297
|
+
function isPassThrough(type) {
|
|
1298
|
+
if (type.type !== "TSTypeReference") {
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
const { typeName } = type;
|
|
1302
|
+
const name = typeName.type === "TSQualifiedName" ? typeName.right.name : typeName.type === "Identifier" ? typeName.name : "";
|
|
1303
|
+
const argument = type.typeArguments?.params.length === 1 ? type.typeArguments.params[0] : undefined;
|
|
1304
|
+
return name === "ComponentProps" && (argument?.type === "TSTypeQuery" || argument?.type === "TSLiteralType" && argument.literal.type === "Literal" && typeof argument.literal.value === "string");
|
|
1305
|
+
}
|
|
1306
|
+
var componentProps = defineRule3({
|
|
1307
|
+
meta: {
|
|
1308
|
+
type: "problem",
|
|
1309
|
+
schema: [
|
|
1310
|
+
{
|
|
1311
|
+
type: "object",
|
|
1312
|
+
additionalProperties: false,
|
|
1313
|
+
properties: {
|
|
1314
|
+
filePrefix: { type: "boolean" }
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
],
|
|
1318
|
+
messages: {
|
|
1319
|
+
inline: "'{{name}}' props are typed inline. Declare `interface {{expected}}` directly above it and use that.",
|
|
1320
|
+
name: "'{{name}}' props must use `interface {{expected}}` declared directly above it, not '{{actual}}'.",
|
|
1321
|
+
placement: "Move `interface {{expected}}` directly above '{{name}}', with only blank lines between them.",
|
|
1322
|
+
rename: "Local component '{{name}}' would need `interface {{expected}}`, which breaks the file prefix '{{prefix}}'. Rename the component to start with '{{prefix}}' (for example '{{prefix}}Item')."
|
|
1323
|
+
}
|
|
1324
|
+
},
|
|
1325
|
+
createOnce(context) {
|
|
1326
|
+
return {
|
|
1327
|
+
Program(program) {
|
|
1328
|
+
const { filePrefix = false } = optionsFirst(context, {});
|
|
1329
|
+
const stem = namingFileStem(namingFileBasename(context.filename).replace(/\.(tsx?|jsx?)$/, ""));
|
|
1330
|
+
const exported = new Set(exportsCollect(program).flatMap((binding) => binding.typeOnly ? [] : [binding.localName]));
|
|
1331
|
+
const interfaces = new Map(program.body.flatMap((statement, index) => {
|
|
1332
|
+
const declaration = unwrapExport(statement);
|
|
1333
|
+
return declaration?.type === "TSInterfaceDeclaration" ? [[declaration.id.name, index]] : [];
|
|
1334
|
+
}));
|
|
1335
|
+
for (const { candidate, index } of topLevelComponents(program)) {
|
|
1336
|
+
const target = propsTarget(candidate.initializer ?? candidate.declaration);
|
|
1337
|
+
const parameter = target?.fn.params[0];
|
|
1338
|
+
if (!target || !parameter || !reactComponentsIsLike(program, candidate)) {
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
const type = target.typeArgument ?? parameterType(parameter);
|
|
1342
|
+
const expected = `${candidate.name}Props`;
|
|
1343
|
+
const data = { name: candidate.name, expected };
|
|
1344
|
+
if (filePrefix && !exported.has(candidate.name) && !candidate.name.toLowerCase().startsWith(namingNormalized(stem, "remove-separators"))) {
|
|
1345
|
+
context.report({ node: candidate.node, messageId: "rename", data: { ...data, prefix: namingPascalCase(stem) } });
|
|
1346
|
+
continue;
|
|
1347
|
+
}
|
|
1348
|
+
if (type && containsTypeLiteral(type)) {
|
|
1349
|
+
context.report({ node: type, messageId: "inline", data });
|
|
1350
|
+
continue;
|
|
1351
|
+
}
|
|
1352
|
+
if (type && isPassThrough(type)) {
|
|
1353
|
+
continue;
|
|
1354
|
+
}
|
|
1355
|
+
const declared = interfaces.get(expected);
|
|
1356
|
+
if (declared === undefined || type?.type !== "TSTypeReference" || type.typeName.type !== "Identifier" || type.typeName.name !== expected) {
|
|
1357
|
+
context.report({
|
|
1358
|
+
node: type ?? parameter,
|
|
1359
|
+
messageId: "name",
|
|
1360
|
+
data: { ...data, actual: type ? context.sourceCode.getText(type) : "untyped" }
|
|
1361
|
+
});
|
|
1362
|
+
continue;
|
|
1363
|
+
}
|
|
1364
|
+
const previous = program.body[declared];
|
|
1365
|
+
const statement = program.body[index];
|
|
1366
|
+
const between = previous && statement ? context.sourceCode.text.slice(previous.range[1], statement.range[0]) : "";
|
|
1367
|
+
if (declared !== index - 1 || between.trim() !== "") {
|
|
1368
|
+
context.report({ node: type, messageId: "placement", data });
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
// src/rules/declaration-name.ts
|
|
1377
|
+
import { defineRule as defineRule4 } from "@oxlint/plugins";
|
|
1378
|
+
var declarationName = defineRule4({
|
|
1258
1379
|
meta: {
|
|
1259
1380
|
type: "problem",
|
|
1260
1381
|
schema: [
|
|
@@ -1331,8 +1452,8 @@ var declarationName = defineRule3({
|
|
|
1331
1452
|
});
|
|
1332
1453
|
|
|
1333
1454
|
// src/rules/export-file-prefix.ts
|
|
1334
|
-
import { defineRule as
|
|
1335
|
-
var exportFilePrefix =
|
|
1455
|
+
import { defineRule as defineRule5 } from "@oxlint/plugins";
|
|
1456
|
+
var exportFilePrefix = defineRule5({
|
|
1336
1457
|
meta: {
|
|
1337
1458
|
type: "problem",
|
|
1338
1459
|
schema: [
|
|
@@ -1397,8 +1518,8 @@ var exportFilePrefix = defineRule4({
|
|
|
1397
1518
|
});
|
|
1398
1519
|
|
|
1399
1520
|
// src/rules/export-name-pattern.ts
|
|
1400
|
-
import { defineRule as
|
|
1401
|
-
var exportNamePattern =
|
|
1521
|
+
import { defineRule as defineRule6 } from "@oxlint/plugins";
|
|
1522
|
+
var exportNamePattern = defineRule6({
|
|
1402
1523
|
meta: {
|
|
1403
1524
|
type: "problem",
|
|
1404
1525
|
schema: [
|
|
@@ -1451,8 +1572,8 @@ var exportNamePattern = defineRule5({
|
|
|
1451
1572
|
});
|
|
1452
1573
|
|
|
1453
1574
|
// src/rules/filename-export-name.ts
|
|
1454
|
-
import { defineRule as
|
|
1455
|
-
var filenameExportName =
|
|
1575
|
+
import { defineRule as defineRule7 } from "@oxlint/plugins";
|
|
1576
|
+
var filenameExportName = defineRule7({
|
|
1456
1577
|
meta: {
|
|
1457
1578
|
type: "problem",
|
|
1458
1579
|
schema: [
|
|
@@ -1517,8 +1638,8 @@ var filenameExportName = defineRule6({
|
|
|
1517
1638
|
});
|
|
1518
1639
|
|
|
1519
1640
|
// src/rules/filename-match.ts
|
|
1520
|
-
import { defineRule as
|
|
1521
|
-
var filenameMatch =
|
|
1641
|
+
import { defineRule as defineRule8 } from "@oxlint/plugins";
|
|
1642
|
+
var filenameMatch = defineRule8({
|
|
1522
1643
|
meta: {
|
|
1523
1644
|
type: "problem",
|
|
1524
1645
|
schema: [
|
|
@@ -1555,8 +1676,8 @@ var filenameMatch = defineRule7({
|
|
|
1555
1676
|
});
|
|
1556
1677
|
|
|
1557
1678
|
// src/rules/folder-prefix.ts
|
|
1558
|
-
import { defineRule as
|
|
1559
|
-
var folderPrefix =
|
|
1679
|
+
import { defineRule as defineRule9 } from "@oxlint/plugins";
|
|
1680
|
+
var folderPrefix = defineRule9({
|
|
1560
1681
|
meta: {
|
|
1561
1682
|
type: "problem",
|
|
1562
1683
|
schema: [
|
|
@@ -1614,7 +1735,7 @@ var folderPrefix = defineRule8({
|
|
|
1614
1735
|
});
|
|
1615
1736
|
|
|
1616
1737
|
// src/rules/jsx-attributes-multiline.ts
|
|
1617
|
-
import { defineRule as
|
|
1738
|
+
import { defineRule as defineRule10 } from "@oxlint/plugins";
|
|
1618
1739
|
function jsxAttributesMultilineEdits(node, text, attributeIndent, baseIndent, newline) {
|
|
1619
1740
|
const first = node.attributes[0];
|
|
1620
1741
|
const last = node.attributes.at(-1);
|
|
@@ -1645,7 +1766,7 @@ function jsxAttributesMultilineEdits(node, text, attributeIndent, baseIndent, ne
|
|
|
1645
1766
|
edits.push({ range: closingRange, text: `${newline}${baseIndent}` });
|
|
1646
1767
|
return edits;
|
|
1647
1768
|
}
|
|
1648
|
-
var jsxAttributesMultiline =
|
|
1769
|
+
var jsxAttributesMultiline = defineRule10({
|
|
1649
1770
|
meta: {
|
|
1650
1771
|
type: "layout",
|
|
1651
1772
|
fixable: "whitespace",
|
|
@@ -1694,8 +1815,8 @@ var jsxAttributesMultiline = defineRule9({
|
|
|
1694
1815
|
});
|
|
1695
1816
|
|
|
1696
1817
|
// src/rules/key-value-same-line.ts
|
|
1697
|
-
import { defineRule as
|
|
1698
|
-
var keyValueSameLine =
|
|
1818
|
+
import { defineRule as defineRule11 } from "@oxlint/plugins";
|
|
1819
|
+
var keyValueSameLine = defineRule11({
|
|
1699
1820
|
meta: {
|
|
1700
1821
|
type: "layout",
|
|
1701
1822
|
fixable: "whitespace",
|
|
@@ -1744,7 +1865,7 @@ var keyValueSameLine = defineRule10({
|
|
|
1744
1865
|
});
|
|
1745
1866
|
|
|
1746
1867
|
// src/rules/no-comments.ts
|
|
1747
|
-
import { defineRule as
|
|
1868
|
+
import { defineRule as defineRule12 } from "@oxlint/plugins";
|
|
1748
1869
|
var NO_COMMENTS_LINE_GAP = /^[\t \r\n\u2028\u2029]*$/;
|
|
1749
1870
|
var NO_COMMENTS_LINE_TERMINATOR = /\r\n|[\n\r\u2028\u2029]/;
|
|
1750
1871
|
var NO_COMMENTS_TRAILING_LINES = /^[\t ]*(?:\r\n|[\n\r\u2028\u2029])(?:[\t ]*(?:\r\n|[\n\r\u2028\u2029]))*/;
|
|
@@ -1836,7 +1957,7 @@ function noCommentsJsxEmptyContainer(containers, start, end) {
|
|
|
1836
1957
|
const container = containers[low - 1];
|
|
1837
1958
|
return container?.range[1] >= end ? container : undefined;
|
|
1838
1959
|
}
|
|
1839
|
-
var noComments =
|
|
1960
|
+
var noComments = defineRule12({
|
|
1840
1961
|
meta: {
|
|
1841
1962
|
type: "suggestion",
|
|
1842
1963
|
fixable: "code",
|
|
@@ -1968,8 +2089,8 @@ var noComments = defineRule11({
|
|
|
1968
2089
|
});
|
|
1969
2090
|
|
|
1970
2091
|
// src/rules/no-extra-exports.ts
|
|
1971
|
-
import { defineRule as
|
|
1972
|
-
var noExtraExports =
|
|
2092
|
+
import { defineRule as defineRule13 } from "@oxlint/plugins";
|
|
2093
|
+
var noExtraExports = defineRule13({
|
|
1973
2094
|
meta: {
|
|
1974
2095
|
type: "problem",
|
|
1975
2096
|
schema: [
|
|
@@ -2028,7 +2149,7 @@ var noExtraExports = defineRule12({
|
|
|
2028
2149
|
});
|
|
2029
2150
|
|
|
2030
2151
|
// src/rules/no-extra-factory-keys.ts
|
|
2031
|
-
import { defineRule as
|
|
2152
|
+
import { defineRule as defineRule14 } from "@oxlint/plugins";
|
|
2032
2153
|
function compileFactoryKeys(pattern, keys, requireKeys) {
|
|
2033
2154
|
const allowedList = keys.concat(requireKeys.filter((key) => !keys.includes(key)));
|
|
2034
2155
|
return {
|
|
@@ -2038,7 +2159,7 @@ function compileFactoryKeys(pattern, keys, requireKeys) {
|
|
|
2038
2159
|
requireKeys
|
|
2039
2160
|
};
|
|
2040
2161
|
}
|
|
2041
|
-
var noExtraFactoryKeys =
|
|
2162
|
+
var noExtraFactoryKeys = defineRule14({
|
|
2042
2163
|
meta: {
|
|
2043
2164
|
type: "problem",
|
|
2044
2165
|
schema: [
|
|
@@ -2142,8 +2263,8 @@ var noExtraFactoryKeys = defineRule13({
|
|
|
2142
2263
|
});
|
|
2143
2264
|
|
|
2144
2265
|
// src/rules/no-file-level-helpers.ts
|
|
2145
|
-
import { defineRule as
|
|
2146
|
-
var noFileLevelHelpers =
|
|
2266
|
+
import { defineRule as defineRule15 } from "@oxlint/plugins";
|
|
2267
|
+
var noFileLevelHelpers = defineRule15({
|
|
2147
2268
|
meta: {
|
|
2148
2269
|
type: "problem",
|
|
2149
2270
|
schema: [
|
|
@@ -2189,7 +2310,7 @@ var noFileLevelHelpers = defineRule14({
|
|
|
2189
2310
|
});
|
|
2190
2311
|
|
|
2191
2312
|
// src/rules/no-imported-type-alias.ts
|
|
2192
|
-
import { defineRule as
|
|
2313
|
+
import { defineRule as defineRule16 } from "@oxlint/plugins";
|
|
2193
2314
|
function importedAliasTarget(declaration, imports) {
|
|
2194
2315
|
if (declaration?.type !== "TSTypeAliasDeclaration" || declaration.typeAnnotation.type !== "TSTypeReference" || declaration.typeAnnotation.typeName.type !== "Identifier" || Boolean(declaration.typeAnnotation.typeArguments?.params.length) || !imports.has(declaration.typeAnnotation.typeName.name)) {
|
|
2195
2316
|
return;
|
|
@@ -2199,7 +2320,7 @@ function importedAliasTarget(declaration, imports) {
|
|
|
2199
2320
|
function specifierLocalName(specifier) {
|
|
2200
2321
|
return specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value;
|
|
2201
2322
|
}
|
|
2202
|
-
var noImportedTypeAlias =
|
|
2323
|
+
var noImportedTypeAlias = defineRule16({
|
|
2203
2324
|
meta: {
|
|
2204
2325
|
type: "problem",
|
|
2205
2326
|
schema: [],
|
|
@@ -2273,8 +2394,8 @@ var noImportedTypeAlias = defineRule15({
|
|
|
2273
2394
|
});
|
|
2274
2395
|
|
|
2275
2396
|
// src/rules/no-inline-schema-elements.ts
|
|
2276
|
-
import { defineRule as
|
|
2277
|
-
var noInlineSchemaElements =
|
|
2397
|
+
import { defineRule as defineRule17 } from "@oxlint/plugins";
|
|
2398
|
+
var noInlineSchemaElements = defineRule17({
|
|
2278
2399
|
meta: {
|
|
2279
2400
|
type: "problem",
|
|
2280
2401
|
schema: [
|
|
@@ -2335,7 +2456,7 @@ var noInlineSchemaElements = defineRule16({
|
|
|
2335
2456
|
});
|
|
2336
2457
|
|
|
2337
2458
|
// src/rules/no-inline-types.ts
|
|
2338
|
-
import { defineRule as
|
|
2459
|
+
import { defineRule as defineRule18 } from "@oxlint/plugins";
|
|
2339
2460
|
function parameterAnnotation(parameter) {
|
|
2340
2461
|
if (parameter.type === "TSParameterProperty") {
|
|
2341
2462
|
return parameterAnnotation(parameter.parameter);
|
|
@@ -2345,7 +2466,7 @@ function parameterAnnotation(parameter) {
|
|
|
2345
2466
|
}
|
|
2346
2467
|
return parameter.typeAnnotation;
|
|
2347
2468
|
}
|
|
2348
|
-
var noInlineTypes =
|
|
2469
|
+
var noInlineTypes = defineRule18({
|
|
2349
2470
|
meta: {
|
|
2350
2471
|
type: "problem",
|
|
2351
2472
|
schema: [
|
|
@@ -2415,7 +2536,7 @@ var noInlineTypes = defineRule17({
|
|
|
2415
2536
|
});
|
|
2416
2537
|
|
|
2417
2538
|
// src/rules/no-literal-in.ts
|
|
2418
|
-
import { defineRule as
|
|
2539
|
+
import { defineRule as defineRule19 } from "@oxlint/plugins";
|
|
2419
2540
|
function literalKey(node) {
|
|
2420
2541
|
if (node.type === "Literal" && typeof node.value === "string") {
|
|
2421
2542
|
return node.value;
|
|
@@ -2424,7 +2545,7 @@ function literalKey(node) {
|
|
|
2424
2545
|
return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw;
|
|
2425
2546
|
}
|
|
2426
2547
|
}
|
|
2427
|
-
var noLiteralIn =
|
|
2548
|
+
var noLiteralIn = defineRule19({
|
|
2428
2549
|
meta: {
|
|
2429
2550
|
type: "suggestion",
|
|
2430
2551
|
schema: [
|
|
@@ -2465,13 +2586,13 @@ var noLiteralIn = defineRule18({
|
|
|
2465
2586
|
});
|
|
2466
2587
|
|
|
2467
2588
|
// src/rules/no-local-schema-construction.ts
|
|
2468
|
-
import { defineRule as
|
|
2589
|
+
import { defineRule as defineRule20 } from "@oxlint/plugins";
|
|
2469
2590
|
var defaultRuntimeImportMessage = "Do not import runtime schema constructors from {{source}}; import a named schema instead.";
|
|
2470
2591
|
var defaultConstructionMessage = "Do not construct schemas locally; import a named schema instead.";
|
|
2471
2592
|
function formatMessage(template, data) {
|
|
2472
2593
|
return Object.entries(data).reduce((result, [key, value]) => result.replaceAll(`{{${key}}}`, value), template);
|
|
2473
2594
|
}
|
|
2474
|
-
var noLocalSchemaConstruction =
|
|
2595
|
+
var noLocalSchemaConstruction = defineRule20({
|
|
2475
2596
|
meta: {
|
|
2476
2597
|
type: "problem",
|
|
2477
2598
|
schema: [
|
|
@@ -2593,8 +2714,8 @@ var noLocalSchemaConstruction = defineRule19({
|
|
|
2593
2714
|
});
|
|
2594
2715
|
|
|
2595
2716
|
// src/rules/no-member-comments.ts
|
|
2596
|
-
import { defineRule as
|
|
2597
|
-
var noMemberComments =
|
|
2717
|
+
import { defineRule as defineRule21 } from "@oxlint/plugins";
|
|
2718
|
+
var noMemberComments = defineRule21({
|
|
2598
2719
|
meta: {
|
|
2599
2720
|
type: "suggestion",
|
|
2600
2721
|
fixable: "code",
|
|
@@ -2690,7 +2811,7 @@ var noMemberComments = defineRule20({
|
|
|
2690
2811
|
});
|
|
2691
2812
|
|
|
2692
2813
|
// src/rules/no-module-mutable-state.ts
|
|
2693
|
-
import { defineRule as
|
|
2814
|
+
import { defineRule as defineRule22 } from "@oxlint/plugins";
|
|
2694
2815
|
function moduleMutableStateBindings(pattern) {
|
|
2695
2816
|
if (pattern.type === "Identifier") {
|
|
2696
2817
|
return [{ name: pattern.name, node: pattern }];
|
|
@@ -2729,7 +2850,7 @@ function moduleMutableStateInsideAmbient(node) {
|
|
|
2729
2850
|
}
|
|
2730
2851
|
return false;
|
|
2731
2852
|
}
|
|
2732
|
-
var noModuleMutableState =
|
|
2853
|
+
var noModuleMutableState = defineRule22({
|
|
2733
2854
|
meta: {
|
|
2734
2855
|
type: "problem",
|
|
2735
2856
|
schema: [
|
|
@@ -2781,7 +2902,7 @@ var noModuleMutableState = defineRule21({
|
|
|
2781
2902
|
});
|
|
2782
2903
|
|
|
2783
2904
|
// src/rules/no-promise-all-mutation.ts
|
|
2784
|
-
import { defineRule as
|
|
2905
|
+
import { defineRule as defineRule23 } from "@oxlint/plugins";
|
|
2785
2906
|
function mutationBinding(node) {
|
|
2786
2907
|
if (node.type === "Identifier") {
|
|
2787
2908
|
return node;
|
|
@@ -2809,7 +2930,7 @@ function mutationBindings(node) {
|
|
|
2809
2930
|
}
|
|
2810
2931
|
}
|
|
2811
2932
|
}
|
|
2812
|
-
var noPromiseAllMutation =
|
|
2933
|
+
var noPromiseAllMutation = defineRule23({
|
|
2813
2934
|
meta: {
|
|
2814
2935
|
type: "problem",
|
|
2815
2936
|
schema: [
|
|
@@ -2909,8 +3030,8 @@ var noPromiseAllMutation = defineRule22({
|
|
|
2909
3030
|
});
|
|
2910
3031
|
|
|
2911
3032
|
// src/rules/no-rederive-schema.ts
|
|
2912
|
-
import { defineRule as
|
|
2913
|
-
var noRederiveSchema =
|
|
3033
|
+
import { defineRule as defineRule24 } from "@oxlint/plugins";
|
|
3034
|
+
var noRederiveSchema = defineRule24({
|
|
2914
3035
|
meta: {
|
|
2915
3036
|
type: "problem",
|
|
2916
3037
|
schema: [
|
|
@@ -2954,7 +3075,7 @@ var noRederiveSchema = defineRule23({
|
|
|
2954
3075
|
});
|
|
2955
3076
|
|
|
2956
3077
|
// src/rules/no-restricted-constructor.ts
|
|
2957
|
-
import { defineRule as
|
|
3078
|
+
import { defineRule as defineRule25 } from "@oxlint/plugins";
|
|
2958
3079
|
function restrictedConstructorEntries(constructors) {
|
|
2959
3080
|
const entries = new Map;
|
|
2960
3081
|
for (const item of constructors) {
|
|
@@ -2970,7 +3091,7 @@ function restrictedConstructorEntries(constructors) {
|
|
|
2970
3091
|
}
|
|
2971
3092
|
return entries;
|
|
2972
3093
|
}
|
|
2973
|
-
var noRestrictedConstructor =
|
|
3094
|
+
var noRestrictedConstructor = defineRule25({
|
|
2974
3095
|
meta: {
|
|
2975
3096
|
type: "problem",
|
|
2976
3097
|
schema: [
|
|
@@ -3045,8 +3166,8 @@ var noRestrictedConstructor = defineRule24({
|
|
|
3045
3166
|
});
|
|
3046
3167
|
|
|
3047
3168
|
// src/rules/no-restricted-files.ts
|
|
3048
|
-
import { defineRule as
|
|
3049
|
-
var noRestrictedFiles =
|
|
3169
|
+
import { defineRule as defineRule26 } from "@oxlint/plugins";
|
|
3170
|
+
var noRestrictedFiles = defineRule26({
|
|
3050
3171
|
meta: {
|
|
3051
3172
|
type: "problem",
|
|
3052
3173
|
schema: [
|
|
@@ -3078,7 +3199,7 @@ var noRestrictedFiles = defineRule25({
|
|
|
3078
3199
|
});
|
|
3079
3200
|
|
|
3080
3201
|
// src/rules/no-restricted-token.ts
|
|
3081
|
-
import { defineRule as
|
|
3202
|
+
import { defineRule as defineRule27 } from "@oxlint/plugins";
|
|
3082
3203
|
function tokenIsTypeOnlyImport(node) {
|
|
3083
3204
|
const parent = node.parent;
|
|
3084
3205
|
if (parent?.type === "ImportSpecifier") {
|
|
@@ -3089,7 +3210,7 @@ function tokenIsTypeOnlyImport(node) {
|
|
|
3089
3210
|
function memberMatches(node, restriction) {
|
|
3090
3211
|
return restriction.startsWith("*.") ? astStaticMemberName(node) === restriction.slice(2) : astDottedName(node) === restriction;
|
|
3091
3212
|
}
|
|
3092
|
-
var noRestrictedToken =
|
|
3213
|
+
var noRestrictedToken = defineRule27({
|
|
3093
3214
|
meta: {
|
|
3094
3215
|
type: "problem",
|
|
3095
3216
|
schema: [
|
|
@@ -3186,7 +3307,7 @@ var noRestrictedToken = defineRule26({
|
|
|
3186
3307
|
});
|
|
3187
3308
|
|
|
3188
3309
|
// src/rules/no-runtime-in-types.ts
|
|
3189
|
-
import { defineRule as
|
|
3310
|
+
import { defineRule as defineRule28 } from "@oxlint/plugins";
|
|
3190
3311
|
function isTypeOnlyImport(statement) {
|
|
3191
3312
|
return statement.importKind === "type" || statement.specifiers.length > 0 && statement.specifiers.every((specifier) => specifier.type === "ImportSpecifier" && specifier.importKind === "type");
|
|
3192
3313
|
}
|
|
@@ -3403,7 +3524,7 @@ function isRuntimeReExport(statement, runtimeImportLocals, valueNames, isAmbient
|
|
|
3403
3524
|
}
|
|
3404
3525
|
return statement.specifiers.some((specifier) => specifier.exportKind !== "type" && runtimeImportLocals.has(exportLocalName(specifier)));
|
|
3405
3526
|
}
|
|
3406
|
-
var noRuntimeInTypes =
|
|
3527
|
+
var noRuntimeInTypes = defineRule28({
|
|
3407
3528
|
meta: {
|
|
3408
3529
|
type: "problem",
|
|
3409
3530
|
schema: [
|
|
@@ -3547,7 +3668,7 @@ var noRuntimeInTypes = defineRule27({
|
|
|
3547
3668
|
});
|
|
3548
3669
|
|
|
3549
3670
|
// src/rules/no-single-use-scalar-schema.ts
|
|
3550
|
-
import { defineRule as
|
|
3671
|
+
import { defineRule as defineRule29 } from "@oxlint/plugins";
|
|
3551
3672
|
function isScalarSchema(node, namespaces, structuralMethods) {
|
|
3552
3673
|
if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression") {
|
|
3553
3674
|
return false;
|
|
@@ -3581,7 +3702,7 @@ function isAllowedStructuralElement(identifier, initializer, ancestors, options,
|
|
|
3581
3702
|
const method = call.callee.type === "MemberExpression" ? astStaticMemberName(call.callee) : undefined;
|
|
3582
3703
|
return Boolean(method && options.methods.includes(method) && schemasElements(call).includes(identifier));
|
|
3583
3704
|
}
|
|
3584
|
-
var noSingleUseScalarSchema =
|
|
3705
|
+
var noSingleUseScalarSchema = defineRule29({
|
|
3585
3706
|
meta: {
|
|
3586
3707
|
type: "suggestion",
|
|
3587
3708
|
schema: [
|
|
@@ -3666,8 +3787,8 @@ var noSingleUseScalarSchema = defineRule28({
|
|
|
3666
3787
|
});
|
|
3667
3788
|
|
|
3668
3789
|
// src/rules/no-top-level-functions.ts
|
|
3669
|
-
import { defineRule as
|
|
3670
|
-
var noTopLevelFunctions =
|
|
3790
|
+
import { defineRule as defineRule30 } from "@oxlint/plugins";
|
|
3791
|
+
var noTopLevelFunctions = defineRule30({
|
|
3671
3792
|
meta: {
|
|
3672
3793
|
type: "problem",
|
|
3673
3794
|
schema: [
|
|
@@ -3726,7 +3847,7 @@ var noTopLevelFunctions = defineRule29({
|
|
|
3726
3847
|
});
|
|
3727
3848
|
|
|
3728
3849
|
// src/rules/no-trivial-functions.ts
|
|
3729
|
-
import { defineRule as
|
|
3850
|
+
import { defineRule as defineRule31 } from "@oxlint/plugins";
|
|
3730
3851
|
|
|
3731
3852
|
// src/constants/trivial.constants.ts
|
|
3732
3853
|
var trivialBannedNames = [
|
|
@@ -3742,7 +3863,7 @@ var trivialBannedNames = [
|
|
|
3742
3863
|
];
|
|
3743
3864
|
|
|
3744
3865
|
// src/rules/no-trivial-functions.ts
|
|
3745
|
-
var noTrivialFunctions =
|
|
3866
|
+
var noTrivialFunctions = defineRule31({
|
|
3746
3867
|
meta: {
|
|
3747
3868
|
type: "problem",
|
|
3748
3869
|
schema: [
|
|
@@ -3859,8 +3980,8 @@ var noTrivialFunctions = defineRule30({
|
|
|
3859
3980
|
});
|
|
3860
3981
|
|
|
3861
3982
|
// src/rules/no-type-declarations.ts
|
|
3862
|
-
import { defineRule as
|
|
3863
|
-
var noTypeDeclarations =
|
|
3983
|
+
import { defineRule as defineRule32 } from "@oxlint/plugins";
|
|
3984
|
+
var noTypeDeclarations = defineRule32({
|
|
3864
3985
|
meta: {
|
|
3865
3986
|
type: "problem",
|
|
3866
3987
|
schema: [
|
|
@@ -3905,8 +4026,8 @@ var noTypeDeclarations = defineRule31({
|
|
|
3905
4026
|
});
|
|
3906
4027
|
|
|
3907
4028
|
// src/rules/no-unescaped-like.ts
|
|
3908
|
-
import { defineRule as
|
|
3909
|
-
var noUnescapedLike =
|
|
4029
|
+
import { defineRule as defineRule33 } from "@oxlint/plugins";
|
|
4030
|
+
var noUnescapedLike = defineRule33({
|
|
3910
4031
|
meta: {
|
|
3911
4032
|
type: "problem",
|
|
3912
4033
|
schema: [
|
|
@@ -3957,7 +4078,7 @@ var noUnescapedLike = defineRule32({
|
|
|
3957
4078
|
});
|
|
3958
4079
|
|
|
3959
4080
|
// src/rules/object-multiline.ts
|
|
3960
|
-
import { defineRule as
|
|
4081
|
+
import { defineRule as defineRule34 } from "@oxlint/plugins";
|
|
3961
4082
|
function objectMultilineIsCallArg(node) {
|
|
3962
4083
|
const parent = node.parent;
|
|
3963
4084
|
return (parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node);
|
|
@@ -3994,7 +4115,7 @@ function objectMultilineGaps(text, node) {
|
|
|
3994
4115
|
}
|
|
3995
4116
|
return gaps;
|
|
3996
4117
|
}
|
|
3997
|
-
var objectMultiline =
|
|
4118
|
+
var objectMultiline = defineRule34({
|
|
3998
4119
|
meta: {
|
|
3999
4120
|
type: "layout",
|
|
4000
4121
|
fixable: "whitespace",
|
|
@@ -4056,8 +4177,8 @@ var objectMultiline = defineRule33({
|
|
|
4056
4177
|
});
|
|
4057
4178
|
|
|
4058
4179
|
// src/rules/only-export-components.ts
|
|
4059
|
-
import { defineRule as
|
|
4060
|
-
var onlyExportComponents =
|
|
4180
|
+
import { defineRule as defineRule35 } from "@oxlint/plugins";
|
|
4181
|
+
var onlyExportComponents = defineRule35({
|
|
4061
4182
|
meta: {
|
|
4062
4183
|
type: "problem",
|
|
4063
4184
|
schema: [
|
|
@@ -4137,7 +4258,7 @@ var onlyExportComponents = defineRule34({
|
|
|
4137
4258
|
});
|
|
4138
4259
|
|
|
4139
4260
|
// src/rules/only-export-constants.ts
|
|
4140
|
-
import { defineRule as
|
|
4261
|
+
import { defineRule as defineRule36 } from "@oxlint/plugins";
|
|
4141
4262
|
function bindingNames(pattern) {
|
|
4142
4263
|
switch (pattern.type) {
|
|
4143
4264
|
case "Identifier":
|
|
@@ -4192,7 +4313,7 @@ function collectBindings(program) {
|
|
|
4192
4313
|
}
|
|
4193
4314
|
return bindings;
|
|
4194
4315
|
}
|
|
4195
|
-
var onlyExportConstants =
|
|
4316
|
+
var onlyExportConstants = defineRule36({
|
|
4196
4317
|
meta: {
|
|
4197
4318
|
type: "problem",
|
|
4198
4319
|
schema: [
|
|
@@ -4280,7 +4401,7 @@ var onlyExportConstants = defineRule35({
|
|
|
4280
4401
|
});
|
|
4281
4402
|
|
|
4282
4403
|
// src/rules/padding-between-statements.ts
|
|
4283
|
-
import { defineRule as
|
|
4404
|
+
import { defineRule as defineRule37 } from "@oxlint/plugins";
|
|
4284
4405
|
function paddingKind(node) {
|
|
4285
4406
|
if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
|
|
4286
4407
|
return node.declaration ? paddingKind(node.declaration) : "other";
|
|
@@ -4332,7 +4453,7 @@ function paddingBlankLineFix(sourceText, comments, prev, curr, newline) {
|
|
|
4332
4453
|
}
|
|
4333
4454
|
return { newlineEnd, newline };
|
|
4334
4455
|
}
|
|
4335
|
-
var paddingBetweenStatements =
|
|
4456
|
+
var paddingBetweenStatements = defineRule37({
|
|
4336
4457
|
meta: {
|
|
4337
4458
|
type: "layout",
|
|
4338
4459
|
fixable: "whitespace",
|
|
@@ -4406,7 +4527,7 @@ var paddingBetweenStatements = defineRule36({
|
|
|
4406
4527
|
});
|
|
4407
4528
|
|
|
4408
4529
|
// src/rules/prefer-namespace-type-import.ts
|
|
4409
|
-
import { defineRule as
|
|
4530
|
+
import { defineRule as defineRule38 } from "@oxlint/plugins";
|
|
4410
4531
|
var bindingName = /^[A-Za-z_$][\w$]*$/;
|
|
4411
4532
|
var reservedNames = new Set("await break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield implements interface let package private protected public static arguments eval".split(" "));
|
|
4412
4533
|
function namespaceName(source, names) {
|
|
@@ -4430,7 +4551,7 @@ function safeReference(node) {
|
|
|
4430
4551
|
}
|
|
4431
4552
|
return parent?.type === "TSTypeReference" && parent.typeName === current || parent?.type === "TSTypeQuery" && parent.exprName === current || (parent?.type === "TSInterfaceHeritage" || parent?.type === "TSClassImplements") && parent.expression === current;
|
|
4432
4553
|
}
|
|
4433
|
-
var preferNamespaceTypeImport =
|
|
4554
|
+
var preferNamespaceTypeImport = defineRule38({
|
|
4434
4555
|
meta: {
|
|
4435
4556
|
type: "suggestion",
|
|
4436
4557
|
fixable: "code",
|
|
@@ -4547,8 +4668,8 @@ var preferNamespaceTypeImport = defineRule37({
|
|
|
4547
4668
|
});
|
|
4548
4669
|
|
|
4549
4670
|
// src/rules/require-file-factory.ts
|
|
4550
|
-
import { defineRule as
|
|
4551
|
-
var requireFileFactory =
|
|
4671
|
+
import { defineRule as defineRule39 } from "@oxlint/plugins";
|
|
4672
|
+
var requireFileFactory = defineRule39({
|
|
4552
4673
|
meta: {
|
|
4553
4674
|
type: "problem",
|
|
4554
4675
|
schema: [
|
|
@@ -4596,8 +4717,8 @@ var requireFileFactory = defineRule38({
|
|
|
4596
4717
|
});
|
|
4597
4718
|
|
|
4598
4719
|
// src/rules/require-object-params.ts
|
|
4599
|
-
import { defineRule as
|
|
4600
|
-
var requireObjectParams =
|
|
4720
|
+
import { defineRule as defineRule40 } from "@oxlint/plugins";
|
|
4721
|
+
var requireObjectParams = defineRule40({
|
|
4601
4722
|
meta: {
|
|
4602
4723
|
type: "problem",
|
|
4603
4724
|
schema: [
|
|
@@ -4655,8 +4776,8 @@ var requireObjectParams = defineRule39({
|
|
|
4655
4776
|
});
|
|
4656
4777
|
|
|
4657
4778
|
// src/rules/require-orpc-output.ts
|
|
4658
|
-
import { defineRule as
|
|
4659
|
-
var requireOrpcOutput =
|
|
4779
|
+
import { defineRule as defineRule41 } from "@oxlint/plugins";
|
|
4780
|
+
var requireOrpcOutput = defineRule41({
|
|
4660
4781
|
meta: {
|
|
4661
4782
|
type: "problem",
|
|
4662
4783
|
schema: [
|
|
@@ -4704,8 +4825,8 @@ var requireOrpcOutput = defineRule40({
|
|
|
4704
4825
|
});
|
|
4705
4826
|
|
|
4706
4827
|
// src/rules/require-paired-call.ts
|
|
4707
|
-
import { defineRule as
|
|
4708
|
-
var requirePairedCall =
|
|
4828
|
+
import { defineRule as defineRule42 } from "@oxlint/plugins";
|
|
4829
|
+
var requirePairedCall = defineRule42({
|
|
4709
4830
|
meta: {
|
|
4710
4831
|
type: "problem",
|
|
4711
4832
|
schema: [
|
|
@@ -4779,8 +4900,8 @@ var requirePairedCall = defineRule41({
|
|
|
4779
4900
|
});
|
|
4780
4901
|
|
|
4781
4902
|
// src/rules/route-surface.ts
|
|
4782
|
-
import { defineRule as
|
|
4783
|
-
var routeSurface =
|
|
4903
|
+
import { defineRule as defineRule43 } from "@oxlint/plugins";
|
|
4904
|
+
var routeSurface = defineRule43({
|
|
4784
4905
|
meta: {
|
|
4785
4906
|
type: "problem",
|
|
4786
4907
|
schema: [
|
|
@@ -4826,8 +4947,8 @@ var routeSurface = defineRule42({
|
|
|
4826
4947
|
});
|
|
4827
4948
|
|
|
4828
4949
|
// src/rules/test-title-pattern.ts
|
|
4829
|
-
import { defineRule as
|
|
4830
|
-
var TEST_MODIFIERS = new Set(["only", "skip", "concurrent", "todo", "each"]);
|
|
4950
|
+
import { defineRule as defineRule44 } from "@oxlint/plugins";
|
|
4951
|
+
var TEST_MODIFIERS = new Set(["only", "skip", "concurrent", "sequential", "todo", "each", "for"]);
|
|
4831
4952
|
function isConfiguredName(name, callees) {
|
|
4832
4953
|
if (!name) {
|
|
4833
4954
|
return false;
|
|
@@ -4866,7 +4987,7 @@ function regexMatches(regex, value) {
|
|
|
4866
4987
|
function titlePatterns(pattern, flags) {
|
|
4867
4988
|
return pattern === undefined ? [] : [pattern].flat().map((source) => ({ regex: new RegExp(source, flags), pattern: source }));
|
|
4868
4989
|
}
|
|
4869
|
-
var testTitlePattern =
|
|
4990
|
+
var testTitlePattern = defineRule44({
|
|
4870
4991
|
meta: {
|
|
4871
4992
|
type: "suggestion",
|
|
4872
4993
|
schema: [
|
|
@@ -4947,6 +5068,7 @@ var src_default = eslintCompatPlugin({
|
|
|
4947
5068
|
rules: {
|
|
4948
5069
|
"call-array-multiline": callArrayMultiline,
|
|
4949
5070
|
"chain-newline": chainNewline,
|
|
5071
|
+
"component-props": componentProps,
|
|
4950
5072
|
"declaration-name": declarationName,
|
|
4951
5073
|
"export-file-prefix": exportFilePrefix,
|
|
4952
5074
|
"export-name-pattern": exportNamePattern,
|