@tanstack/eslint-plugin-router 1.161.4 → 1.161.6
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/cjs/index.cjs +22 -27
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/rules/create-route-property-order/constants.cjs +23 -36
- package/dist/cjs/rules/create-route-property-order/constants.cjs.map +1 -1
- package/dist/cjs/rules/create-route-property-order/create-route-property-order.rule.cjs +68 -98
- package/dist/cjs/rules/create-route-property-order/create-route-property-order.rule.cjs.map +1 -1
- package/dist/cjs/rules/create-route-property-order/create-route-property-order.utils.cjs +33 -44
- package/dist/cjs/rules/create-route-property-order/create-route-property-order.utils.cjs.map +1 -1
- package/dist/cjs/rules/route-param-names/constants.cjs +24 -9
- package/dist/cjs/rules/route-param-names/constants.cjs.map +1 -1
- package/dist/cjs/rules/route-param-names/route-param-names.rule.cjs +75 -95
- package/dist/cjs/rules/route-param-names/route-param-names.rule.cjs.map +1 -1
- package/dist/cjs/rules/route-param-names/route-param-names.utils.cjs +65 -54
- package/dist/cjs/rules/route-param-names/route-param-names.utils.cjs.map +1 -1
- package/dist/cjs/rules.cjs +9 -8
- package/dist/cjs/rules.cjs.map +1 -1
- package/dist/cjs/utils/detect-router-imports.cjs +35 -51
- package/dist/cjs/utils/detect-router-imports.cjs.map +1 -1
- package/dist/cjs/utils/get-docs-url.cjs +5 -4
- package/dist/cjs/utils/get-docs-url.cjs.map +1 -1
- package/dist/esm/index.js +23 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/rules/create-route-property-order/constants.js +22 -37
- package/dist/esm/rules/create-route-property-order/constants.js.map +1 -1
- package/dist/esm/rules/create-route-property-order/create-route-property-order.rule.js +65 -96
- package/dist/esm/rules/create-route-property-order/create-route-property-order.rule.js.map +1 -1
- package/dist/esm/rules/create-route-property-order/create-route-property-order.utils.js +34 -46
- package/dist/esm/rules/create-route-property-order/create-route-property-order.utils.js.map +1 -1
- package/dist/esm/rules/route-param-names/constants.js +25 -12
- package/dist/esm/rules/route-param-names/constants.js.map +1 -1
- package/dist/esm/rules/route-param-names/route-param-names.rule.js +73 -94
- package/dist/esm/rules/route-param-names/route-param-names.rule.js.map +1 -1
- package/dist/esm/rules/route-param-names/route-param-names.utils.js +65 -54
- package/dist/esm/rules/route-param-names/route-param-names.utils.js.map +1 -1
- package/dist/esm/rules.js +10 -9
- package/dist/esm/rules.js.map +1 -1
- package/dist/esm/utils/detect-router-imports.js +35 -51
- package/dist/esm/utils/detect-router-imports.js.map +1 -1
- package/dist/esm/utils/get-docs-url.js +6 -5
- package/dist/esm/utils/get-docs-url.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,31 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
},
|
|
7
|
-
configs: {},
|
|
8
|
-
rules: rules.rules
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
var plugin = {
|
|
3
|
+
meta: { name: "@tanstack/eslint-plugin-router" },
|
|
4
|
+
configs: {},
|
|
5
|
+
rules: require("./rules.cjs").rules
|
|
9
6
|
};
|
|
10
7
|
Object.assign(plugin.configs, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"@tanstack/router/route-param-names": "error"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
]
|
|
8
|
+
recommended: {
|
|
9
|
+
plugins: ["@tanstack/eslint-plugin-router"],
|
|
10
|
+
rules: {
|
|
11
|
+
"@tanstack/router/create-route-property-order": "warn",
|
|
12
|
+
"@tanstack/router/route-param-names": "error"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"flat/recommended": [{
|
|
16
|
+
plugins: { "@tanstack/router": plugin },
|
|
17
|
+
rules: {
|
|
18
|
+
"@tanstack/router/create-route-property-order": "warn",
|
|
19
|
+
"@tanstack/router/route-param-names": "error"
|
|
20
|
+
}
|
|
21
|
+
}]
|
|
29
22
|
});
|
|
23
|
+
//#endregion
|
|
30
24
|
module.exports = plugin;
|
|
31
|
-
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\ninterface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: {\n recommended: ESLint.ConfigData\n 'flat/recommended': Array<Linter.FlatConfig>\n }\n}\n\nconst plugin: Plugin = {\n meta: {\n name: '@tanstack/eslint-plugin-router',\n },\n configs: {} as Plugin['configs'],\n rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-router'],\n rules: {\n '@tanstack/router/create-route-property-order': 'warn',\n '@tanstack/router/route-param-names': 'error',\n },\n },\n 'flat/recommended': [\n {\n plugins: {\n '@tanstack/router': plugin,\n },\n rules: {\n '@tanstack/router/create-route-property-order': 'warn',\n '@tanstack/router/route-param-names': 'error',\n },\n },\n ],\n})\n\nexport default plugin\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\ninterface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: {\n recommended: ESLint.ConfigData\n 'flat/recommended': Array<Linter.FlatConfig>\n }\n}\n\nconst plugin: Plugin = {\n meta: {\n name: '@tanstack/eslint-plugin-router',\n },\n configs: {} as Plugin['configs'],\n rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-router'],\n rules: {\n '@tanstack/router/create-route-property-order': 'warn',\n '@tanstack/router/route-param-names': 'error',\n },\n },\n 'flat/recommended': [\n {\n plugins: {\n '@tanstack/router': plugin,\n },\n rules: {\n '@tanstack/router/create-route-property-order': 'warn',\n '@tanstack/router/route-param-names': 'error',\n },\n },\n ],\n})\n\nexport default plugin\n"],"mappings":";AAcA,IAAM,SAAiB;CACrB,MAAM,EACJ,MAAM,kCACP;CACD,SAAS,EAAE;CACX,8BAAA;CACD;AAGD,OAAO,OAAO,OAAO,SAAS;CAC5B,aAAa;EACX,SAAS,CAAC,iCAAiC;EAC3C,OAAO;GACL,gDAAgD;GAChD,sCAAsC;GACvC;EACF;CACD,oBAAoB,CAClB;EACE,SAAS,EACP,oBAAoB,QACrB;EACD,OAAO;GACL,gDAAgD;GAChD,sCAAsC;GACvC;EACF,CACF;CACF,CAAC"}
|
|
@@ -1,40 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const require_create_route_property_order_utils = require("./create-route-property-order.utils.cjs");
|
|
2
|
+
//#region src/rules/create-route-property-order/constants.ts
|
|
3
|
+
var createRouteFunctionsIndirect = ["createFileRoute", "createRootRouteWithContext"];
|
|
4
|
+
var createRouteFunctions = [...["createRootRoute", "createRoute"], ...createRouteFunctionsIndirect];
|
|
5
|
+
var sortRules = [
|
|
6
|
+
[["params", "validateSearch"], ["search"]],
|
|
7
|
+
[["search"], ["loaderDeps", "ssr"]],
|
|
8
|
+
[["loaderDeps"], ["context"]],
|
|
9
|
+
[["context"], ["beforeLoad"]],
|
|
10
|
+
[["beforeLoad"], ["loader"]],
|
|
11
|
+
[["loader"], [
|
|
12
|
+
"onEnter",
|
|
13
|
+
"onStay",
|
|
14
|
+
"onLeave",
|
|
15
|
+
"head",
|
|
16
|
+
"scripts",
|
|
17
|
+
"headers",
|
|
18
|
+
"remountDeps"
|
|
19
|
+
]]
|
|
7
20
|
];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"createRoute"
|
|
11
|
-
];
|
|
12
|
-
const createRouteFunctions = [
|
|
13
|
-
...createRouteFunctionsDirect,
|
|
14
|
-
...createRouteFunctionsIndirect
|
|
15
|
-
];
|
|
16
|
-
const sortRules = [
|
|
17
|
-
[["params", "validateSearch"], ["search"]],
|
|
18
|
-
[["search"], ["loaderDeps", "ssr"]],
|
|
19
|
-
[["loaderDeps"], ["context"]],
|
|
20
|
-
[["context"], ["beforeLoad"]],
|
|
21
|
-
[["beforeLoad"], ["loader"]],
|
|
22
|
-
[
|
|
23
|
-
["loader"],
|
|
24
|
-
[
|
|
25
|
-
"onEnter",
|
|
26
|
-
"onStay",
|
|
27
|
-
"onLeave",
|
|
28
|
-
"head",
|
|
29
|
-
"scripts",
|
|
30
|
-
"headers",
|
|
31
|
-
"remountDeps"
|
|
32
|
-
]
|
|
33
|
-
]
|
|
34
|
-
];
|
|
35
|
-
createRoutePropertyOrder_utils.getCheckedProperties(sortRules);
|
|
21
|
+
require_create_route_property_order_utils.getCheckedProperties(sortRules);
|
|
22
|
+
//#endregion
|
|
36
23
|
exports.createRouteFunctions = createRouteFunctions;
|
|
37
|
-
exports.createRouteFunctionsDirect = createRouteFunctionsDirect;
|
|
38
24
|
exports.createRouteFunctionsIndirect = createRouteFunctionsIndirect;
|
|
39
25
|
exports.sortRules = sortRules;
|
|
40
|
-
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../../../../src/rules/create-route-property-order/constants.ts"],"sourcesContent":["import { getCheckedProperties } from './create-route-property-order.utils'\n\nexport const createRouteFunctionsIndirect = [\n 'createFileRoute',\n 'createRootRouteWithContext',\n] as const\nexport const createRouteFunctionsDirect = [\n 'createRootRoute',\n 'createRoute',\n] as const\n\nexport const createRouteFunctions = [\n ...createRouteFunctionsDirect,\n ...createRouteFunctionsIndirect,\n] as const\n\nexport type CreateRouteFunction = (typeof createRouteFunctions)[number]\n\nexport const sortRules = [\n [['params', 'validateSearch'], ['search']],\n [['search'], ['loaderDeps', 'ssr']],\n [['loaderDeps'], ['context']],\n [['context'], ['beforeLoad']],\n [['beforeLoad'], ['loader']],\n [\n ['loader'],\n [\n 'onEnter',\n 'onStay',\n 'onLeave',\n 'head',\n 'scripts',\n 'headers',\n 'remountDeps',\n ],\n ],\n] as const\n\nexport type CheckedProperties = (typeof sortRules)[number][number][number]\nexport const checkedProperties = getCheckedProperties(sortRules)\n"],"
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../../../../src/rules/create-route-property-order/constants.ts"],"sourcesContent":["import { getCheckedProperties } from './create-route-property-order.utils'\n\nexport const createRouteFunctionsIndirect = [\n 'createFileRoute',\n 'createRootRouteWithContext',\n] as const\nexport const createRouteFunctionsDirect = [\n 'createRootRoute',\n 'createRoute',\n] as const\n\nexport const createRouteFunctions = [\n ...createRouteFunctionsDirect,\n ...createRouteFunctionsIndirect,\n] as const\n\nexport type CreateRouteFunction = (typeof createRouteFunctions)[number]\n\nexport const sortRules = [\n [['params', 'validateSearch'], ['search']],\n [['search'], ['loaderDeps', 'ssr']],\n [['loaderDeps'], ['context']],\n [['context'], ['beforeLoad']],\n [['beforeLoad'], ['loader']],\n [\n ['loader'],\n [\n 'onEnter',\n 'onStay',\n 'onLeave',\n 'head',\n 'scripts',\n 'headers',\n 'remountDeps',\n ],\n ],\n] as const\n\nexport type CheckedProperties = (typeof sortRules)[number][number][number]\nexport const checkedProperties = getCheckedProperties(sortRules)\n"],"mappings":";;AAEA,IAAa,+BAA+B,CAC1C,mBACA,6BACD;AAMD,IAAa,uBAAuB,CAClC,GANwC,CACxC,mBACA,cACD,EAIC,GAAG,6BACJ;AAID,IAAa,YAAY;CACvB,CAAC,CAAC,UAAU,iBAAiB,EAAE,CAAC,SAAS,CAAC;CAC1C,CAAC,CAAC,SAAS,EAAE,CAAC,cAAc,MAAM,CAAC;CACnC,CAAC,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC;CAC7B,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC;CAC7B,CAAC,CAAC,aAAa,EAAE,CAAC,SAAS,CAAC;CAC5B,CACE,CAAC,SAAS,EACV;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;CACF;AAGgC,0CAAA,qBAAqB,UAAU"}
|
|
@@ -1,103 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const createRouteFunctionSet = new Set(constants.createRouteFunctions);
|
|
1
|
+
const require_get_docs_url = require("../../utils/get-docs-url.cjs");
|
|
2
|
+
const require_detect_router_imports = require("../../utils/detect-router-imports.cjs");
|
|
3
|
+
const require_create_route_property_order_utils = require("./create-route-property-order.utils.cjs");
|
|
4
|
+
const require_constants = require("./constants.cjs");
|
|
5
|
+
let _typescript_eslint_utils = require("@typescript-eslint/utils");
|
|
6
|
+
//#region src/rules/create-route-property-order/create-route-property-order.rule.ts
|
|
7
|
+
var createRule = _typescript_eslint_utils.ESLintUtils.RuleCreator(require_get_docs_url.getDocsUrl);
|
|
8
|
+
var createRouteFunctionSet = new Set(require_constants.createRouteFunctions);
|
|
10
9
|
function isCreateRouteFunction(node) {
|
|
11
|
-
|
|
10
|
+
return createRouteFunctionSet.has(node);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (sortedProperties === null) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
context.report({
|
|
73
|
-
node: argument,
|
|
74
|
-
data: { function: node.callee.name },
|
|
75
|
-
messageId: "invalidOrder",
|
|
76
|
-
fix(fixer) {
|
|
77
|
-
const sourceCode = context.sourceCode;
|
|
78
|
-
const text = sortedProperties.reduce(
|
|
79
|
-
(sourceText, specifier, index) => {
|
|
80
|
-
let text2 = "";
|
|
81
|
-
if (index < allProperties.length - 1) {
|
|
82
|
-
text2 = sourceCode.getText().slice(
|
|
83
|
-
allProperties[index].range[1],
|
|
84
|
-
allProperties[index + 1].range[0]
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return sourceText + sourceCode.getText(specifier.property) + text2;
|
|
88
|
-
},
|
|
89
|
-
""
|
|
90
|
-
);
|
|
91
|
-
return fixer.replaceTextRange(
|
|
92
|
-
[allProperties[0].range[0], allProperties.at(-1).range[1]],
|
|
93
|
-
text
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
})
|
|
12
|
+
var name = "create-route-property-order";
|
|
13
|
+
var rule = createRule({
|
|
14
|
+
name,
|
|
15
|
+
meta: {
|
|
16
|
+
type: "problem",
|
|
17
|
+
docs: {
|
|
18
|
+
description: "Ensure correct order of inference sensitive properties for createRoute functions",
|
|
19
|
+
recommended: "error"
|
|
20
|
+
},
|
|
21
|
+
messages: { invalidOrder: "Invalid order of properties for `{{function}}`." },
|
|
22
|
+
schema: [],
|
|
23
|
+
hasSuggestions: true,
|
|
24
|
+
fixable: "code"
|
|
25
|
+
},
|
|
26
|
+
defaultOptions: [],
|
|
27
|
+
create: require_detect_router_imports.detectTanstackRouterImports((context) => {
|
|
28
|
+
return { CallExpression(node) {
|
|
29
|
+
if (node.callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
|
|
30
|
+
const createRouteFunction = node.callee.name;
|
|
31
|
+
if (!isCreateRouteFunction(createRouteFunction)) return;
|
|
32
|
+
let args = node.arguments;
|
|
33
|
+
if (require_constants.createRouteFunctionsIndirect.includes(createRouteFunction)) if (node.parent.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) args = node.parent.arguments;
|
|
34
|
+
else return;
|
|
35
|
+
const argument = args[0];
|
|
36
|
+
if (argument === void 0 || argument.type !== "ObjectExpression") return;
|
|
37
|
+
const allProperties = argument.properties;
|
|
38
|
+
if (allProperties.length < 2) return;
|
|
39
|
+
const sortedProperties = require_create_route_property_order_utils.sortDataByOrder(allProperties.flatMap((p) => {
|
|
40
|
+
if (p.type === _typescript_eslint_utils.AST_NODE_TYPES.Property && p.key.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return {
|
|
41
|
+
name: p.key.name,
|
|
42
|
+
property: p
|
|
43
|
+
};
|
|
44
|
+
else if (p.type === _typescript_eslint_utils.AST_NODE_TYPES.SpreadElement) if (p.argument.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return {
|
|
45
|
+
name: p.argument.name,
|
|
46
|
+
property: p
|
|
47
|
+
};
|
|
48
|
+
else throw new Error("Unsupported spread element");
|
|
49
|
+
return [];
|
|
50
|
+
}), require_constants.sortRules, "name");
|
|
51
|
+
if (sortedProperties === null) return;
|
|
52
|
+
context.report({
|
|
53
|
+
node: argument,
|
|
54
|
+
data: { function: node.callee.name },
|
|
55
|
+
messageId: "invalidOrder",
|
|
56
|
+
fix(fixer) {
|
|
57
|
+
const sourceCode = context.sourceCode;
|
|
58
|
+
const text = sortedProperties.reduce((sourceText, specifier, index) => {
|
|
59
|
+
let text = "";
|
|
60
|
+
if (index < allProperties.length - 1) text = sourceCode.getText().slice(allProperties[index].range[1], allProperties[index + 1].range[0]);
|
|
61
|
+
return sourceText + sourceCode.getText(specifier.property) + text;
|
|
62
|
+
}, "");
|
|
63
|
+
return fixer.replaceTextRange([allProperties[0].range[0], allProperties.at(-1).range[1]], text);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
} };
|
|
67
|
+
})
|
|
100
68
|
});
|
|
69
|
+
//#endregion
|
|
101
70
|
exports.name = name;
|
|
102
71
|
exports.rule = rule;
|
|
103
|
-
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=create-route-property-order.rule.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-route-property-order.rule.cjs","sources":["../../../../src/rules/create-route-property-order/create-route-property-order.rule.ts"],"sourcesContent":["import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\n\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackRouterImports } from '../../utils/detect-router-imports'\nimport { sortDataByOrder } from './create-route-property-order.utils'\nimport {\n createRouteFunctions,\n createRouteFunctionsIndirect,\n sortRules,\n} from './constants'\nimport type { CreateRouteFunction } from './constants'\nimport type { ExtraRuleDocs } from '../../types'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nconst createRouteFunctionSet = new Set(createRouteFunctions)\nfunction isCreateRouteFunction(node: any): node is CreateRouteFunction {\n return createRouteFunctionSet.has(node)\n}\n\nexport const name = 'create-route-property-order'\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Ensure correct order of inference sensitive properties for createRoute functions',\n recommended: 'error',\n },\n messages: {\n invalidOrder: 'Invalid order of properties for `{{function}}`.',\n },\n schema: [],\n hasSuggestions: true,\n fixable: 'code',\n },\n defaultOptions: [],\n\n create: detectTanstackRouterImports((context) => {\n return {\n CallExpression(node) {\n if (node.callee.type !== AST_NODE_TYPES.Identifier) {\n return\n }\n const createRouteFunction = node.callee.name\n if (!isCreateRouteFunction(createRouteFunction)) {\n return\n }\n let args = node.arguments\n if (createRouteFunctionsIndirect.includes(createRouteFunction as any)) {\n if (node.parent.type === AST_NODE_TYPES.CallExpression) {\n args = node.parent.arguments\n } else {\n return\n }\n }\n\n const argument = args[0]\n if (argument === undefined || argument.type !== 'ObjectExpression') {\n return\n }\n\n const allProperties = argument.properties\n // no need to sort if there is at max 1 property\n if (allProperties.length < 2) {\n return\n }\n\n const properties = allProperties.flatMap((p) => {\n if (\n p.type === AST_NODE_TYPES.Property &&\n p.key.type === AST_NODE_TYPES.Identifier\n ) {\n return { name: p.key.name, property: p }\n } else if (p.type === AST_NODE_TYPES.SpreadElement) {\n if (p.argument.type === AST_NODE_TYPES.Identifier) {\n return { name: p.argument.name, property: p }\n } else {\n throw new Error('Unsupported spread element')\n }\n }\n return []\n })\n\n const sortedProperties = sortDataByOrder(properties, sortRules, 'name')\n if (sortedProperties === null) {\n return\n }\n context.report({\n node: argument,\n data: { function: node.callee.name },\n messageId: 'invalidOrder',\n fix(fixer) {\n const sourceCode = context.sourceCode\n\n const text = sortedProperties.reduce(\n (sourceText, specifier, index) => {\n let text = ''\n if (index < allProperties.length - 1) {\n text = sourceCode\n .getText()\n .slice(\n allProperties[index]!.range[1],\n allProperties[index + 1]!.range[0],\n )\n }\n return (\n sourceText + sourceCode.getText(specifier.property) + text\n )\n },\n '',\n )\n return fixer.replaceTextRange(\n [allProperties[0]!.range[0], allProperties.at(-1)!.range[1]],\n text,\n )\n },\n })\n },\n }\n }),\n})\n"],"
|
|
1
|
+
{"version":3,"file":"create-route-property-order.rule.cjs","names":[],"sources":["../../../../src/rules/create-route-property-order/create-route-property-order.rule.ts"],"sourcesContent":["import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\n\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackRouterImports } from '../../utils/detect-router-imports'\nimport { sortDataByOrder } from './create-route-property-order.utils'\nimport {\n createRouteFunctions,\n createRouteFunctionsIndirect,\n sortRules,\n} from './constants'\nimport type { CreateRouteFunction } from './constants'\nimport type { ExtraRuleDocs } from '../../types'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nconst createRouteFunctionSet = new Set(createRouteFunctions)\nfunction isCreateRouteFunction(node: any): node is CreateRouteFunction {\n return createRouteFunctionSet.has(node)\n}\n\nexport const name = 'create-route-property-order'\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Ensure correct order of inference sensitive properties for createRoute functions',\n recommended: 'error',\n },\n messages: {\n invalidOrder: 'Invalid order of properties for `{{function}}`.',\n },\n schema: [],\n hasSuggestions: true,\n fixable: 'code',\n },\n defaultOptions: [],\n\n create: detectTanstackRouterImports((context) => {\n return {\n CallExpression(node) {\n if (node.callee.type !== AST_NODE_TYPES.Identifier) {\n return\n }\n const createRouteFunction = node.callee.name\n if (!isCreateRouteFunction(createRouteFunction)) {\n return\n }\n let args = node.arguments\n if (createRouteFunctionsIndirect.includes(createRouteFunction as any)) {\n if (node.parent.type === AST_NODE_TYPES.CallExpression) {\n args = node.parent.arguments\n } else {\n return\n }\n }\n\n const argument = args[0]\n if (argument === undefined || argument.type !== 'ObjectExpression') {\n return\n }\n\n const allProperties = argument.properties\n // no need to sort if there is at max 1 property\n if (allProperties.length < 2) {\n return\n }\n\n const properties = allProperties.flatMap((p) => {\n if (\n p.type === AST_NODE_TYPES.Property &&\n p.key.type === AST_NODE_TYPES.Identifier\n ) {\n return { name: p.key.name, property: p }\n } else if (p.type === AST_NODE_TYPES.SpreadElement) {\n if (p.argument.type === AST_NODE_TYPES.Identifier) {\n return { name: p.argument.name, property: p }\n } else {\n throw new Error('Unsupported spread element')\n }\n }\n return []\n })\n\n const sortedProperties = sortDataByOrder(properties, sortRules, 'name')\n if (sortedProperties === null) {\n return\n }\n context.report({\n node: argument,\n data: { function: node.callee.name },\n messageId: 'invalidOrder',\n fix(fixer) {\n const sourceCode = context.sourceCode\n\n const text = sortedProperties.reduce(\n (sourceText, specifier, index) => {\n let text = ''\n if (index < allProperties.length - 1) {\n text = sourceCode\n .getText()\n .slice(\n allProperties[index]!.range[1],\n allProperties[index + 1]!.range[0],\n )\n }\n return (\n sourceText + sourceCode.getText(specifier.property) + text\n )\n },\n '',\n )\n return fixer.replaceTextRange(\n [allProperties[0]!.range[0], allProperties.at(-1)!.range[1]],\n text,\n )\n },\n })\n },\n }\n }),\n})\n"],"mappings":";;;;;;AAaA,IAAM,aAAa,yBAAA,YAAY,YAA2B,qBAAA,WAAW;AAErE,IAAM,yBAAyB,IAAI,IAAI,kBAAA,qBAAqB;AAC5D,SAAS,sBAAsB,MAAwC;AACrE,QAAO,uBAAuB,IAAI,KAAK;;AAGzC,IAAa,OAAO;AAEpB,IAAa,OAAO,WAAW;CAC7B;CACA,MAAM;EACJ,MAAM;EACN,MAAM;GACJ,aACE;GACF,aAAa;GACd;EACD,UAAU,EACR,cAAc,mDACf;EACD,QAAQ,EAAE;EACV,gBAAgB;EAChB,SAAS;EACV;CACD,gBAAgB,EAAE;CAElB,QAAQ,8BAAA,6BAA6B,YAAY;AAC/C,SAAO,EACL,eAAe,MAAM;AACnB,OAAI,KAAK,OAAO,SAAS,yBAAA,eAAe,WACtC;GAEF,MAAM,sBAAsB,KAAK,OAAO;AACxC,OAAI,CAAC,sBAAsB,oBAAoB,CAC7C;GAEF,IAAI,OAAO,KAAK;AAChB,OAAI,kBAAA,6BAA6B,SAAS,oBAA2B,CACnE,KAAI,KAAK,OAAO,SAAS,yBAAA,eAAe,eACtC,QAAO,KAAK,OAAO;OAEnB;GAIJ,MAAM,WAAW,KAAK;AACtB,OAAI,aAAa,KAAA,KAAa,SAAS,SAAS,mBAC9C;GAGF,MAAM,gBAAgB,SAAS;AAE/B,OAAI,cAAc,SAAS,EACzB;GAmBF,MAAM,mBAAmB,0CAAA,gBAhBN,cAAc,SAAS,MAAM;AAC9C,QACE,EAAE,SAAS,yBAAA,eAAe,YAC1B,EAAE,IAAI,SAAS,yBAAA,eAAe,WAE9B,QAAO;KAAE,MAAM,EAAE,IAAI;KAAM,UAAU;KAAG;aAC/B,EAAE,SAAS,yBAAA,eAAe,cACnC,KAAI,EAAE,SAAS,SAAS,yBAAA,eAAe,WACrC,QAAO;KAAE,MAAM,EAAE,SAAS;KAAM,UAAU;KAAG;QAE7C,OAAM,IAAI,MAAM,6BAA6B;AAGjD,WAAO,EAAE;KACT,EAEmD,kBAAA,WAAW,OAAO;AACvE,OAAI,qBAAqB,KACvB;AAEF,WAAQ,OAAO;IACb,MAAM;IACN,MAAM,EAAE,UAAU,KAAK,OAAO,MAAM;IACpC,WAAW;IACX,IAAI,OAAO;KACT,MAAM,aAAa,QAAQ;KAE3B,MAAM,OAAO,iBAAiB,QAC3B,YAAY,WAAW,UAAU;MAChC,IAAI,OAAO;AACX,UAAI,QAAQ,cAAc,SAAS,EACjC,QAAO,WACJ,SAAS,CACT,MACC,cAAc,OAAQ,MAAM,IAC5B,cAAc,QAAQ,GAAI,MAAM,GACjC;AAEL,aACE,aAAa,WAAW,QAAQ,UAAU,SAAS,GAAG;QAG1D,GACD;AACD,YAAO,MAAM,iBACX,CAAC,cAAc,GAAI,MAAM,IAAI,cAAc,GAAG,GAAG,CAAE,MAAM,GAAG,EAC5D,KACD;;IAEJ,CAAC;KAEL;GACD;CACH,CAAC"}
|
|
@@ -1,50 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
|
+
//#region src/rules/create-route-property-order/create-route-property-order.utils.ts
|
|
3
2
|
function sortDataByOrder(data, orderRules, key) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const sortedItem = inOrderIterator.next().value;
|
|
33
|
-
if (sortedItem[key] !== item[key]) {
|
|
34
|
-
wasResorted = true;
|
|
35
|
-
}
|
|
36
|
-
return sortedItem;
|
|
37
|
-
}
|
|
38
|
-
return item;
|
|
39
|
-
});
|
|
40
|
-
if (!wasResorted) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
3
|
+
const getSubsetIndex = (item, subsets) => {
|
|
4
|
+
for (let i = 0; i < subsets.length; i++) if (subsets[i]?.includes(item)) return i;
|
|
5
|
+
return null;
|
|
6
|
+
};
|
|
7
|
+
const orderSets = orderRules.reduce((sets, [A, B]) => [
|
|
8
|
+
...sets,
|
|
9
|
+
A,
|
|
10
|
+
B
|
|
11
|
+
], []);
|
|
12
|
+
const inOrderArray = data.filter((item) => getSubsetIndex(item[key], orderSets) !== null);
|
|
13
|
+
let wasResorted = false;
|
|
14
|
+
const inOrderIterator = inOrderArray.sort((a, b) => {
|
|
15
|
+
const aKey = a[key], bKey = b[key];
|
|
16
|
+
const aSubsetIndex = getSubsetIndex(aKey, orderSets);
|
|
17
|
+
const bSubsetIndex = getSubsetIndex(bKey, orderSets);
|
|
18
|
+
if (aSubsetIndex !== null && bSubsetIndex !== null && aSubsetIndex !== bSubsetIndex) return aSubsetIndex - bSubsetIndex;
|
|
19
|
+
return 0;
|
|
20
|
+
}).values();
|
|
21
|
+
const result = data.map((item) => {
|
|
22
|
+
if (getSubsetIndex(item[key], orderSets) !== null) {
|
|
23
|
+
const sortedItem = inOrderIterator.next().value;
|
|
24
|
+
if (sortedItem[key] !== item[key]) wasResorted = true;
|
|
25
|
+
return sortedItem;
|
|
26
|
+
}
|
|
27
|
+
return item;
|
|
28
|
+
});
|
|
29
|
+
if (!wasResorted) return null;
|
|
30
|
+
return result;
|
|
44
31
|
}
|
|
45
32
|
function getCheckedProperties(orderRules) {
|
|
46
|
-
|
|
33
|
+
return [...new Set(orderRules.flat(2))];
|
|
47
34
|
}
|
|
35
|
+
//#endregion
|
|
48
36
|
exports.getCheckedProperties = getCheckedProperties;
|
|
49
37
|
exports.sortDataByOrder = sortDataByOrder;
|
|
50
|
-
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=create-route-property-order.utils.cjs.map
|
package/dist/cjs/rules/create-route-property-order/create-route-property-order.utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-route-property-order.utils.cjs","sources":["../../../../src/rules/create-route-property-order/create-route-property-order.utils.ts"],"sourcesContent":["export function sortDataByOrder<T, TKey extends keyof T>(\n data: Array<T> | ReadonlyArray<T>,\n orderRules: ReadonlyArray<\n Readonly<[ReadonlyArray<T[TKey]>, ReadonlyArray<T[TKey]>]>\n >,\n key: TKey,\n): Array<T> | null {\n const getSubsetIndex = (\n item: T[TKey],\n subsets: ReadonlyArray<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n ): number | null => {\n for (let i = 0; i < subsets.length; i++) {\n if (subsets[i]?.includes(item)) {\n return i\n }\n }\n return null\n }\n\n const orderSets = orderRules.reduce(\n (sets, [A, B]) => [...sets, A, B],\n [] as Array<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n )\n\n const inOrderArray = data.filter(\n (item) => getSubsetIndex(item[key], orderSets) !== null,\n )\n\n let wasResorted = false as boolean\n\n // Sort by the relative order defined by the rules\n const sortedArray = inOrderArray.sort((a, b) => {\n const aKey = a[key],\n bKey = b[key]\n const aSubsetIndex = getSubsetIndex(aKey, orderSets)\n const bSubsetIndex = getSubsetIndex(bKey, orderSets)\n\n // If both items belong to different subsets, sort by their subset order\n if (\n aSubsetIndex !== null &&\n bSubsetIndex !== null &&\n aSubsetIndex !== bSubsetIndex\n ) {\n return aSubsetIndex - bSubsetIndex\n }\n\n // If both items belong to the same subset or neither is in the subset, keep their relative order\n return 0\n })\n\n const inOrderIterator = sortedArray.values()\n const result = data.map((item) => {\n if (getSubsetIndex(item[key], orderSets) !== null) {\n const sortedItem = inOrderIterator.next().value!\n if (sortedItem[key] !== item[key]) {\n wasResorted = true\n }\n return sortedItem\n }\n return item\n })\n\n if (!wasResorted) {\n return null\n }\n return result\n}\n\nexport function getCheckedProperties<T>(\n orderRules: ReadonlyArray<ReadonlyArray<ReadonlyArray<T>>>,\n): ReadonlyArray<T> {\n return [...new Set<T>(orderRules.flat(2))]\n}\n"],"
|
|
1
|
+
{"version":3,"file":"create-route-property-order.utils.cjs","names":[],"sources":["../../../../src/rules/create-route-property-order/create-route-property-order.utils.ts"],"sourcesContent":["export function sortDataByOrder<T, TKey extends keyof T>(\n data: Array<T> | ReadonlyArray<T>,\n orderRules: ReadonlyArray<\n Readonly<[ReadonlyArray<T[TKey]>, ReadonlyArray<T[TKey]>]>\n >,\n key: TKey,\n): Array<T> | null {\n const getSubsetIndex = (\n item: T[TKey],\n subsets: ReadonlyArray<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n ): number | null => {\n for (let i = 0; i < subsets.length; i++) {\n if (subsets[i]?.includes(item)) {\n return i\n }\n }\n return null\n }\n\n const orderSets = orderRules.reduce(\n (sets, [A, B]) => [...sets, A, B],\n [] as Array<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n )\n\n const inOrderArray = data.filter(\n (item) => getSubsetIndex(item[key], orderSets) !== null,\n )\n\n let wasResorted = false as boolean\n\n // Sort by the relative order defined by the rules\n const sortedArray = inOrderArray.sort((a, b) => {\n const aKey = a[key],\n bKey = b[key]\n const aSubsetIndex = getSubsetIndex(aKey, orderSets)\n const bSubsetIndex = getSubsetIndex(bKey, orderSets)\n\n // If both items belong to different subsets, sort by their subset order\n if (\n aSubsetIndex !== null &&\n bSubsetIndex !== null &&\n aSubsetIndex !== bSubsetIndex\n ) {\n return aSubsetIndex - bSubsetIndex\n }\n\n // If both items belong to the same subset or neither is in the subset, keep their relative order\n return 0\n })\n\n const inOrderIterator = sortedArray.values()\n const result = data.map((item) => {\n if (getSubsetIndex(item[key], orderSets) !== null) {\n const sortedItem = inOrderIterator.next().value!\n if (sortedItem[key] !== item[key]) {\n wasResorted = true\n }\n return sortedItem\n }\n return item\n })\n\n if (!wasResorted) {\n return null\n }\n return result\n}\n\nexport function getCheckedProperties<T>(\n orderRules: ReadonlyArray<ReadonlyArray<ReadonlyArray<T>>>,\n): ReadonlyArray<T> {\n return [...new Set<T>(orderRules.flat(2))]\n}\n"],"mappings":";AAAA,SAAgB,gBACd,MACA,YAGA,KACiB;CACjB,MAAM,kBACJ,MACA,YACkB;AAClB,OAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,IAClC,KAAI,QAAQ,IAAI,SAAS,KAAK,CAC5B,QAAO;AAGX,SAAO;;CAGT,MAAM,YAAY,WAAW,QAC1B,MAAM,CAAC,GAAG,OAAO;EAAC,GAAG;EAAM;EAAG;EAAE,EACjC,EAAE,CACH;CAED,MAAM,eAAe,KAAK,QACvB,SAAS,eAAe,KAAK,MAAM,UAAU,KAAK,KACpD;CAED,IAAI,cAAc;CAsBlB,MAAM,kBAnBc,aAAa,MAAM,GAAG,MAAM;EAC9C,MAAM,OAAO,EAAE,MACb,OAAO,EAAE;EACX,MAAM,eAAe,eAAe,MAAM,UAAU;EACpD,MAAM,eAAe,eAAe,MAAM,UAAU;AAGpD,MACE,iBAAiB,QACjB,iBAAiB,QACjB,iBAAiB,aAEjB,QAAO,eAAe;AAIxB,SAAO;GACP,CAEkC,QAAQ;CAC5C,MAAM,SAAS,KAAK,KAAK,SAAS;AAChC,MAAI,eAAe,KAAK,MAAM,UAAU,KAAK,MAAM;GACjD,MAAM,aAAa,gBAAgB,MAAM,CAAC;AAC1C,OAAI,WAAW,SAAS,KAAK,KAC3B,eAAc;AAEhB,UAAO;;AAET,SAAO;GACP;AAEF,KAAI,CAAC,YACH,QAAO;AAET,QAAO;;AAGT,SAAgB,qBACd,YACkB;AAClB,QAAO,CAAC,GAAG,IAAI,IAAO,WAAW,KAAK,EAAE,CAAC,CAAC"}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/rules/route-param-names/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Functions where the path is passed as the first argument (string literal)
|
|
4
|
+
* e.g., createFileRoute('/path/$param')(...)
|
|
5
|
+
*/
|
|
6
|
+
var pathAsFirstArgFunctions = [
|
|
7
|
+
"createFileRoute",
|
|
8
|
+
"createLazyFileRoute",
|
|
9
|
+
"createLazyRoute"
|
|
7
10
|
];
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Functions where the path is a property in the options object
|
|
13
|
+
* e.g., createRoute({ path: '/path/$param' })
|
|
14
|
+
*/
|
|
15
|
+
var pathAsPropertyFunctions = ["createRoute"];
|
|
16
|
+
[...pathAsFirstArgFunctions, ...pathAsPropertyFunctions];
|
|
17
|
+
/**
|
|
18
|
+
* Regex for valid JavaScript identifier (param name)
|
|
19
|
+
* Must start with letter, underscore, or dollar sign
|
|
20
|
+
* Can contain letters, numbers, underscores, or dollar signs
|
|
21
|
+
*/
|
|
22
|
+
var VALID_PARAM_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
23
|
+
//#endregion
|
|
10
24
|
exports.VALID_PARAM_NAME_REGEX = VALID_PARAM_NAME_REGEX;
|
|
11
25
|
exports.pathAsFirstArgFunctions = pathAsFirstArgFunctions;
|
|
12
26
|
exports.pathAsPropertyFunctions = pathAsPropertyFunctions;
|
|
13
|
-
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../../../../src/rules/route-param-names/constants.ts"],"sourcesContent":["/**\n * Functions where the path is passed as the first argument (string literal)\n * e.g., createFileRoute('/path/$param')(...)\n */\nexport const pathAsFirstArgFunctions = [\n 'createFileRoute',\n 'createLazyFileRoute',\n 'createLazyRoute',\n] as const\n\nexport type PathAsFirstArgFunction = (typeof pathAsFirstArgFunctions)[number]\n\n/**\n * Functions where the path is a property in the options object\n * e.g., createRoute({ path: '/path/$param' })\n */\nexport const pathAsPropertyFunctions = ['createRoute'] as const\n\nexport type PathAsPropertyFunction = (typeof pathAsPropertyFunctions)[number]\n\n/**\n * All route functions that need param name validation\n */\nexport const allRouteFunctions = [\n ...pathAsFirstArgFunctions,\n ...pathAsPropertyFunctions,\n] as const\n\nexport type RouteFunction = (typeof allRouteFunctions)[number]\n\n/**\n * Regex for valid JavaScript identifier (param name)\n * Must start with letter, underscore, or dollar sign\n * Can contain letters, numbers, underscores, or dollar signs\n */\nexport const VALID_PARAM_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/\n"],"
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../../../../src/rules/route-param-names/constants.ts"],"sourcesContent":["/**\n * Functions where the path is passed as the first argument (string literal)\n * e.g., createFileRoute('/path/$param')(...)\n */\nexport const pathAsFirstArgFunctions = [\n 'createFileRoute',\n 'createLazyFileRoute',\n 'createLazyRoute',\n] as const\n\nexport type PathAsFirstArgFunction = (typeof pathAsFirstArgFunctions)[number]\n\n/**\n * Functions where the path is a property in the options object\n * e.g., createRoute({ path: '/path/$param' })\n */\nexport const pathAsPropertyFunctions = ['createRoute'] as const\n\nexport type PathAsPropertyFunction = (typeof pathAsPropertyFunctions)[number]\n\n/**\n * All route functions that need param name validation\n */\nexport const allRouteFunctions = [\n ...pathAsFirstArgFunctions,\n ...pathAsPropertyFunctions,\n] as const\n\nexport type RouteFunction = (typeof allRouteFunctions)[number]\n\n/**\n * Regex for valid JavaScript identifier (param name)\n * Must start with letter, underscore, or dollar sign\n * Can contain letters, numbers, underscores, or dollar signs\n */\nexport const VALID_PARAM_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/\n"],"mappings":";;;;;AAIA,IAAa,0BAA0B;CACrC;CACA;CACA;CACD;;;;;AAQD,IAAa,0BAA0B,CAAC,cAAc;AAOrB,CAC/B,GAAG,yBACH,GAAG,wBACJ;;;;;;AASD,IAAa,yBAAyB"}
|