@conorroberts/utils 0.0.49 → 0.0.51
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/oxlint/jsx-component-pascal-case.d.mts +8 -8
- package/dist/oxlint/no-component-date-instantiation.d.mts +8 -8
- package/dist/oxlint/no-emoji.d.mts +4 -4
- package/dist/oxlint/no-inline-components.d.mts +11 -11
- package/dist/oxlint/no-inline-components.mjs +28 -0
- package/dist/oxlint/no-inline-components.mjs.map +1 -1
- package/dist/oxlint/no-react-namespace.d.mts +4 -4
- package/dist/oxlint/no-switch-plugin.d.mts +3 -3
- package/dist/oxlint/no-top-level-let.d.mts +4 -4
- package/dist/oxlint/no-type-cast.d.mts +4 -4
- package/package.json +2 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint2 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/jsx-component-pascal-case.d.ts
|
|
4
|
-
declare const jsxComponentPascalCaseRule:
|
|
4
|
+
declare const jsxComponentPascalCaseRule: oxlint2.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"jsx-component-pascal-case":
|
|
10
|
+
"jsx-component-pascal-case": oxlint2.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type RuleContext =
|
|
14
|
-
type ESTNode =
|
|
15
|
-
type ESTExpression =
|
|
16
|
-
type ReturnStatementNode =
|
|
17
|
-
type FunctionLikeNode =
|
|
13
|
+
type RuleContext = oxlint2.Context;
|
|
14
|
+
type ESTNode = oxlint2.ESTree.Node;
|
|
15
|
+
type ESTExpression = oxlint2.ESTree.Expression;
|
|
16
|
+
type ReturnStatementNode = oxlint2.ESTree.ReturnStatement;
|
|
17
|
+
type FunctionLikeNode = oxlint2.ESTree.Function | oxlint2.ESTree.ArrowFunctionExpression;
|
|
18
18
|
type FunctionContext = {
|
|
19
19
|
node: FunctionLikeNode;
|
|
20
20
|
name: string;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint21 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-component-date-instantiation.d.ts
|
|
4
|
-
declare const noComponentDateInstantiationRule:
|
|
4
|
+
declare const noComponentDateInstantiationRule: oxlint21.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-component-date-instantiation":
|
|
10
|
+
"no-component-date-instantiation": oxlint21.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type RuleContext =
|
|
14
|
-
type ESTNode =
|
|
15
|
-
type NewExpressionNode =
|
|
16
|
-
type ReturnStatementNode =
|
|
17
|
-
type FunctionLikeNode =
|
|
13
|
+
type RuleContext = oxlint21.Context;
|
|
14
|
+
type ESTNode = oxlint21.ESTree.Node;
|
|
15
|
+
type NewExpressionNode = oxlint21.ESTree.NewExpression;
|
|
16
|
+
type ReturnStatementNode = oxlint21.ESTree.ReturnStatement;
|
|
17
|
+
type FunctionLikeNode = oxlint21.ESTree.Function | oxlint21.ESTree.ArrowFunctionExpression;
|
|
18
18
|
type FunctionContext = {
|
|
19
19
|
node: FunctionLikeNode;
|
|
20
20
|
parent: FunctionContext | null;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint18 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-emoji.d.ts
|
|
4
|
-
declare const noEmojiRule:
|
|
4
|
+
declare const noEmojiRule: oxlint18.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-emoji":
|
|
10
|
+
"no-emoji": oxlint18.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint18.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noEmojiRule };
|
|
16
16
|
//# sourceMappingURL=no-emoji.d.mts.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint32 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-inline-components.d.ts
|
|
4
4
|
declare function isComponentName(name: unknown): name is string;
|
|
5
5
|
declare function isHookName(name: unknown): name is string;
|
|
6
6
|
declare function getEnclosingFunction(node: ESTNode | null | undefined): FunctionLikeNode | null;
|
|
7
7
|
declare function getFunctionName(node: FunctionLikeNode): string;
|
|
8
|
-
declare const noInlineComponentsRule:
|
|
8
|
+
declare const noInlineComponentsRule: oxlint32.Rule;
|
|
9
9
|
declare namespace _default {
|
|
10
10
|
namespace meta {
|
|
11
11
|
let name: string;
|
|
12
12
|
}
|
|
13
13
|
let rules: {
|
|
14
|
-
"no-inline-components":
|
|
14
|
+
"no-inline-components": oxlint32.Rule;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
type RuleContext =
|
|
18
|
-
type ESTNode =
|
|
19
|
-
type ESTExpression =
|
|
20
|
-
type ESTPattern =
|
|
21
|
-
type ReturnStatementNode =
|
|
22
|
-
type VariableDeclaratorNode =
|
|
23
|
-
type AssignmentExpressionNode =
|
|
24
|
-
type FunctionLikeNode =
|
|
17
|
+
type RuleContext = oxlint32.Context;
|
|
18
|
+
type ESTNode = oxlint32.ESTree.Node;
|
|
19
|
+
type ESTExpression = oxlint32.ESTree.Expression;
|
|
20
|
+
type ESTPattern = oxlint32.ESTree.Pattern;
|
|
21
|
+
type ReturnStatementNode = oxlint32.ESTree.ReturnStatement;
|
|
22
|
+
type VariableDeclaratorNode = oxlint32.ESTree.VariableDeclarator;
|
|
23
|
+
type AssignmentExpressionNode = oxlint32.ESTree.AssignmentExpression;
|
|
24
|
+
type FunctionLikeNode = oxlint32.ESTree.Function | oxlint32.ESTree.ArrowFunctionExpression;
|
|
25
25
|
type RecordedAssignment = {
|
|
26
26
|
node: ESTExpression;
|
|
27
27
|
names: string[];
|
|
@@ -136,6 +136,8 @@ const expressionProducesJsx = (root, bindingNames) => {
|
|
|
136
136
|
if (type === "ParenthesizedExpression") return expressionProducesJsx(root.expression, bindingNames);
|
|
137
137
|
if (type === "AwaitExpression" || type === "UnaryExpression" || type === "UpdateExpression") return expressionProducesJsx(root.argument, bindingNames);
|
|
138
138
|
if (type === "TSAsExpression" || type === "TSTypeAssertion" || type === "TSNonNullExpression" || type === "ChainExpression") return expressionProducesJsx(root.expression, bindingNames);
|
|
139
|
+
if (type === "CallExpression") return expressionProducesJsx(root.callee, bindingNames);
|
|
140
|
+
if (type === "MemberExpression") return expressionProducesJsx(root.object, bindingNames);
|
|
139
141
|
return false;
|
|
140
142
|
};
|
|
141
143
|
/**
|
|
@@ -314,6 +316,29 @@ const rule = defineRule({
|
|
|
314
316
|
names
|
|
315
317
|
});
|
|
316
318
|
};
|
|
319
|
+
/**
|
|
320
|
+
* @param {import("oxlint").ESTree.CallExpression} node
|
|
321
|
+
*/
|
|
322
|
+
const handleCallExpression = (node) => {
|
|
323
|
+
const fnCtx = currentFunction();
|
|
324
|
+
if (!fnCtx) return;
|
|
325
|
+
if (node.callee && node.callee.type === "MemberExpression" && node.callee.property && node.callee.property.type === "Identifier" && node.callee.property.name === "push") {
|
|
326
|
+
const arrayObject = node.callee.object;
|
|
327
|
+
if (arrayObject && arrayObject.type === "Identifier") {
|
|
328
|
+
const arrayName = arrayObject.name;
|
|
329
|
+
if (node.arguments.some((arg) => {
|
|
330
|
+
if (!arg || arg.type === "SpreadElement") return false;
|
|
331
|
+
return expressionContainsJsx(arg);
|
|
332
|
+
})) {
|
|
333
|
+
fnCtx.jsxBindingNames.add(arrayName);
|
|
334
|
+
fnCtx.jsxAssignments.push({
|
|
335
|
+
node,
|
|
336
|
+
names: [arrayName]
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
};
|
|
317
342
|
return {
|
|
318
343
|
FunctionDeclaration(node) {
|
|
319
344
|
if (isFunctionLike(node)) enterFunction(node);
|
|
@@ -335,6 +360,9 @@ const rule = defineRule({
|
|
|
335
360
|
},
|
|
336
361
|
AssignmentExpression(node) {
|
|
337
362
|
if (node.type === "AssignmentExpression") handleAssignmentExpression(node);
|
|
363
|
+
},
|
|
364
|
+
CallExpression(node) {
|
|
365
|
+
if (node.type === "CallExpression") handleCallExpression(node);
|
|
338
366
|
}
|
|
339
367
|
};
|
|
340
368
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-inline-components.mjs","names":[],"sources":["../../src/oxlint-plugins/no-inline-components.js"],"sourcesContent":["import { defineRule } from \"oxlint\";\r\n\r\n/**\r\n * @typedef {import(\"oxlint\").Context} RuleContext\r\n * @typedef {import(\"oxlint\").ESTree.Node} ESTNode\r\n * @typedef {import(\"oxlint\").ESTree.Expression} ESTExpression\r\n * @typedef {import(\"oxlint\").ESTree.Pattern} ESTPattern\r\n * @typedef {import(\"oxlint\").ESTree.ReturnStatement} ReturnStatementNode\r\n * @typedef {import(\"oxlint\").ESTree.VariableDeclarator} VariableDeclaratorNode\r\n * @typedef {import(\"oxlint\").ESTree.AssignmentExpression} AssignmentExpressionNode\r\n * @typedef {import(\"oxlint\").ESTree.Function | import(\"oxlint\").ESTree.ArrowFunctionExpression} FunctionLikeNode\r\n */\r\n\r\n/**\r\n * @typedef {object} RecordedAssignment\r\n * @property {ESTExpression} node\r\n * @property {string[]} names\r\n */\r\n\r\n/**\r\n * @typedef {object} NestedFunctionRecord\r\n * @property {FunctionLikeNode} node\r\n * @property {string} name\r\n */\r\n\r\n/**\r\n * @typedef {object} FunctionContext\r\n * @property {FunctionLikeNode} node\r\n * @property {FunctionContext | null} parent\r\n * @property {string} name\r\n * @property {boolean} returnsJsx\r\n * @property {Set<string>} jsxBindingNames\r\n * @property {RecordedAssignment[]} jsxAssignments\r\n * @property {NestedFunctionRecord[]} nestedJsxChildren\r\n */\r\n\r\nconst JSX_NODE_TYPES = new Set([\"JSXElement\", \"JSXFragment\"]);\r\nconst FUNCTION_NODE_TYPES = new Set([\"FunctionDeclaration\", \"FunctionExpression\", \"ArrowFunctionExpression\"]);\r\n\r\n/**\r\n * @param {unknown} name\r\n * @returns {name is string}\r\n */\r\nexport const isComponentName = (name) => typeof name === \"string\" && /^[A-Z]/.test(name);\r\n\r\n/**\r\n * @param {unknown} name\r\n * @returns {name is string}\r\n */\r\nexport const isHookName = (name) => typeof name === \"string\" && name.startsWith(\"use\");\r\n\r\n/**\r\n * @param {unknown} node\r\n * @returns {node is ESTNode & { type: string }}\r\n */\r\nconst isNode = (node) => Boolean(node && typeof node === \"object\" && \"type\" in node);\r\n\r\n/**\r\n * @param {unknown} node\r\n * @returns {node is FunctionLikeNode}\r\n */\r\nconst isFunctionLike = (node) => isNode(node) && FUNCTION_NODE_TYPES.has(node.type);\r\n\r\n/**\r\n * @param {ESTNode | null | undefined} node\r\n * @returns {FunctionLikeNode | null}\r\n */\r\nexport const getEnclosingFunction = (node) => {\r\n const findFunction = (current) => {\r\n if (!current) return null;\r\n if (isFunctionLike(current)) {\r\n return current;\r\n }\r\n return findFunction(isNode(current) ? (current.parent ?? null) : null);\r\n };\r\n return findFunction(isNode(node) ? (node.parent ?? null) : null);\r\n};\r\n\r\n/**\r\n * @param {FunctionLikeNode} node\r\n */\r\nconst isFunctionUsedAsJsxProp = (node) => {\r\n const checkJsxProp = (current) => {\r\n if (!current) return false;\r\n if (current.type === \"JSXAttribute\") {\r\n return true;\r\n }\r\n if (isFunctionLike(current)) {\r\n return false;\r\n }\r\n return checkJsxProp(isNode(current) ? (current.parent ?? null) : null);\r\n };\r\n return checkJsxProp(isNode(node) ? (node.parent ?? null) : null);\r\n};\r\n\r\n/**\r\n * @param {FunctionLikeNode} node\r\n */\r\nconst isFunctionImmediatelyInvoked = (node) => {\r\n const parent = isNode(node) ? (node.parent ?? null) : null;\r\n if (!parent) return false;\r\n\r\n // Check if the function is the callee of a CallExpression (i.e., it's immediately invoked)\r\n if (parent.type === \"CallExpression\" && parent.callee === node) {\r\n return true;\r\n }\r\n\r\n return false;\r\n};\r\n\r\n/**\r\n * @param {ESTExpression | null | undefined} root\r\n */\r\nconst expressionContainsJsx = (root) => {\r\n if (!root || !isNode(root)) return false;\r\n\r\n const stack = [root];\r\n\r\n while (stack.length > 0) {\r\n const current = stack.pop();\r\n if (!current || !isNode(current)) continue;\r\n\r\n if (JSX_NODE_TYPES.has(current.type)) {\r\n return true;\r\n }\r\n\r\n if (FUNCTION_NODE_TYPES.has(current.type) && current !== root) {\r\n continue;\r\n }\r\n\r\n for (const key of Object.keys(current)) {\r\n if (key === \"parent\") continue;\r\n\r\n const value = current[key];\r\n if (!value) continue;\r\n\r\n if (Array.isArray(value)) {\r\n for (const element of value) {\r\n if (isNode(element)) {\r\n stack.push(element);\r\n }\r\n }\r\n } else if (isNode(value)) {\r\n stack.push(value);\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\n/**\r\n * @param {ESTExpression | null | undefined} root\r\n * @param {Set<string>} bindingNames\r\n */\r\nconst expressionProducesJsx = (root, bindingNames) => {\r\n if (!root) return false;\r\n if (expressionContainsJsx(root)) return true;\r\n\r\n if (!isNode(root)) return false;\r\n\r\n const type = root.type;\r\n\r\n if (type === \"Identifier\") {\r\n return bindingNames.has(root.name);\r\n }\r\n\r\n if (type === \"ConditionalExpression\") {\r\n return expressionProducesJsx(root.consequent, bindingNames) || expressionProducesJsx(root.alternate, bindingNames);\r\n }\r\n\r\n if (type === \"LogicalExpression\") {\r\n return expressionProducesJsx(root.left, bindingNames) || expressionProducesJsx(root.right, bindingNames);\r\n }\r\n\r\n if (type === \"SequenceExpression\") {\r\n const expressions = root.expressions ?? [];\r\n const last = expressions[expressions.length - 1] ?? null;\r\n return expressionProducesJsx(last, bindingNames);\r\n }\r\n\r\n if (type === \"ArrayExpression\") {\r\n return root.elements.some((element) => {\r\n if (!element) return false;\r\n if (element.type === \"SpreadElement\") {\r\n return expressionProducesJsx(element.argument, bindingNames);\r\n }\r\n return expressionProducesJsx(element, bindingNames);\r\n });\r\n }\r\n\r\n if (type === \"ParenthesizedExpression\") {\r\n return expressionProducesJsx(root.expression, bindingNames);\r\n }\r\n\r\n if (type === \"AwaitExpression\" || type === \"UnaryExpression\" || type === \"UpdateExpression\") {\r\n return expressionProducesJsx(root.argument, bindingNames);\r\n }\r\n\r\n if (\r\n type === \"TSAsExpression\" ||\r\n type === \"TSTypeAssertion\" ||\r\n type === \"TSNonNullExpression\" ||\r\n type === \"ChainExpression\"\r\n ) {\r\n return expressionProducesJsx(root.expression, bindingNames);\r\n }\r\n\r\n return false;\r\n};\r\n\r\n/**\r\n * @param {ESTPattern | null | undefined} pattern\r\n * @param {string[]} names\r\n */\r\nconst collectBindingNames = (pattern, names) => {\r\n if (!pattern || !isNode(pattern)) return;\r\n\r\n const type = pattern.type;\r\n\r\n if (type === \"Identifier\") {\r\n names.push(pattern.name);\r\n return;\r\n }\r\n\r\n if (type === \"ArrayPattern\") {\r\n for (const element of pattern.elements) {\r\n if (!element) continue;\r\n if (element.type === \"RestElement\") {\r\n collectBindingNames(element.argument, names);\r\n } else {\r\n collectBindingNames(element, names);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (type === \"ObjectPattern\") {\r\n for (const property of pattern.properties) {\r\n if (!property) continue;\r\n if (property.type === \"Property\") {\r\n collectBindingNames(property.value, names);\r\n } else if (property.type === \"RestElement\") {\r\n collectBindingNames(property.argument, names);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (type === \"AssignmentPattern\") {\r\n collectBindingNames(pattern.left, names);\r\n return;\r\n }\r\n\r\n if (type === \"RestElement\") {\r\n collectBindingNames(pattern.argument, names);\r\n }\r\n};\r\n\r\n/**\r\n * @param {FunctionLikeNode} node\r\n */\r\nexport const getFunctionName = (node) => {\r\n if (node.type === \"FunctionDeclaration\" && node.id && node.id.type === \"Identifier\") {\r\n return node.id.name;\r\n }\r\n\r\n if ((node.type === \"FunctionExpression\" || node.type === \"ArrowFunctionExpression\") && node.id) {\r\n if (node.id.type === \"Identifier\") return node.id.name;\r\n }\r\n\r\n const parent = node.parent;\r\n if (!parent || !isNode(parent)) return \"\";\r\n\r\n if (parent.type === \"VariableDeclarator\") {\r\n return parent.id && parent.id.type === \"Identifier\" ? parent.id.name : \"\";\r\n }\r\n\r\n if (parent.type === \"AssignmentExpression\") {\r\n return parent.left && parent.left.type === \"Identifier\" ? parent.left.name : \"\";\r\n }\r\n\r\n if (parent.type === \"Property\" || parent.type === \"MethodDefinition\") {\r\n return parent.key && parent.key.type === \"Identifier\" ? parent.key.name : \"\";\r\n }\r\n\r\n // Handle functions passed as arguments to calls (e.g., useCallback, useMemo)\r\n if (parent.type === \"CallExpression\") {\r\n const callParent = parent.parent;\r\n if (callParent && isNode(callParent)) {\r\n if (callParent.type === \"VariableDeclarator\") {\r\n return callParent.id && callParent.id.type === \"Identifier\" ? callParent.id.name : \"\";\r\n }\r\n if (callParent.type === \"AssignmentExpression\") {\r\n return callParent.left && callParent.left.type === \"Identifier\" ? callParent.left.name : \"\";\r\n }\r\n }\r\n }\r\n\r\n return \"\";\r\n};\r\n\r\n/**\r\n * @param {string} name\r\n */\r\nconst describeFunction = (name) => (name ? `function '${name}'` : \"this function\");\r\n\r\n/**\r\n * @param {string} name\r\n */\r\nconst describeNested = (name) => (name ? `function '${name}'` : \"an anonymous function\");\r\n\r\n/**\r\n * @param {string[]} names\r\n * @param {string} fnName\r\n */\r\nconst createAssignmentMessage = (names, fnName) => {\r\n const target =\r\n names.length === 0\r\n ? \"local variables\"\r\n : names.length === 1\r\n ? `local '${names[0]}'`\r\n : `locals ${names.map((name) => `'${name}'`).join(\", \")}`;\r\n\r\n return `Avoid storing JSX in ${target} inside ${describeFunction(fnName)}; return the JSX directly instead.`;\r\n};\r\n\r\n/**\r\n * @param {string} childName\r\n * @param {string} parentName\r\n */\r\nconst createNestedFunctionMessage = (childName, parentName) =>\r\n `JSX-returning ${describeNested(childName)} should not be declared inside ${describeFunction(parentName)}. Extract it to module scope.`;\r\n\r\n/**\r\n * @param {string} name\r\n */\r\nconst createIIFEMessage = (name) =>\r\n `JSX-returning ${describeNested(name)} should not be declared as an immediately invoked function expression (IIFE). Extract it to a named function at module scope.`;\r\n\r\nconst rule = defineRule({\r\n meta: {\r\n type: \"problem\",\r\n docs: {\r\n description:\r\n \"Disallow JSX-returning functions and JSX-valued assignments within other functions that also return JSX.\",\r\n recommended: false,\r\n },\r\n schema: [],\r\n },\r\n\r\n createOnce(context) {\r\n /** @type {FunctionContext[]} */\r\n const functionStack = [];\r\n\r\n const currentFunction = () => functionStack[functionStack.length - 1] ?? null;\r\n\r\n /**\r\n * @param {FunctionLikeNode} node\r\n */\r\n const enterFunction = (node) => {\r\n const parent = currentFunction();\r\n /** @type {FunctionContext} */\r\n const fnCtx = {\r\n node,\r\n parent,\r\n name: getFunctionName(node),\r\n returnsJsx: false,\r\n jsxBindingNames: new Set(),\r\n jsxAssignments: [],\r\n nestedJsxChildren: [],\r\n };\r\n\r\n functionStack.push(fnCtx);\r\n\r\n if (node.type === \"ArrowFunctionExpression\" && node.body && node.body.type !== \"BlockStatement\") {\r\n if (expressionProducesJsx(node.body, fnCtx.jsxBindingNames)) {\r\n fnCtx.returnsJsx = true;\r\n }\r\n }\r\n };\r\n\r\n const exitFunction = () => {\r\n const fnCtx = functionStack.pop();\r\n if (!fnCtx) return;\r\n\r\n if (fnCtx.returnsJsx && isFunctionImmediatelyInvoked(fnCtx.node)) {\r\n context.report({\r\n node: fnCtx.node,\r\n message: createIIFEMessage(fnCtx.name),\r\n });\r\n return;\r\n }\r\n\r\n if (fnCtx.parent && fnCtx.returnsJsx && fnCtx.name && !isFunctionUsedAsJsxProp(fnCtx.node)) {\r\n fnCtx.parent.nestedJsxChildren.push({ node: fnCtx.node, name: fnCtx.name });\r\n }\r\n\r\n if (!fnCtx.returnsJsx) return;\r\n\r\n for (const assignment of fnCtx.jsxAssignments) {\r\n context.report({\r\n node: assignment.node,\r\n message: createAssignmentMessage(assignment.names, fnCtx.name),\r\n });\r\n }\r\n\r\n for (const nested of fnCtx.nestedJsxChildren) {\r\n context.report({\r\n node: nested.node,\r\n message: createNestedFunctionMessage(nested.name, fnCtx.name),\r\n });\r\n }\r\n };\r\n\r\n /** @param {ReturnStatementNode} node */\r\n const handleReturnStatement = (node) => {\r\n const fnCtx = currentFunction();\r\n if (!fnCtx) return;\r\n\r\n const argument = node.argument;\r\n if (!argument || isFunctionLike(argument)) return;\r\n\r\n if (expressionProducesJsx(argument, fnCtx.jsxBindingNames)) {\r\n fnCtx.returnsJsx = true;\r\n }\r\n };\r\n\r\n /** @param {VariableDeclaratorNode} node */\r\n const handleVariableDeclarator = (node) => {\r\n const fnCtx = currentFunction();\r\n if (!fnCtx) return;\r\n\r\n const init = node.init;\r\n if (!init || isFunctionLike(init)) return;\r\n if (!expressionContainsJsx(init)) return;\r\n\r\n const names = [];\r\n collectBindingNames(node.id, names);\r\n for (const name of names) {\r\n fnCtx.jsxBindingNames.add(name);\r\n }\r\n\r\n fnCtx.jsxAssignments.push({ node: init, names });\r\n };\r\n\r\n /** @param {AssignmentExpressionNode} node */\r\n const handleAssignmentExpression = (node) => {\r\n if (node.operator !== \"=\") return;\r\n\r\n const fnCtx = currentFunction();\r\n if (!fnCtx) return;\r\n\r\n const right = node.right;\r\n if (!right || isFunctionLike(right)) return;\r\n if (!expressionContainsJsx(right)) return;\r\n\r\n const names = [];\r\n if (node.left && node.left.type === \"Identifier\") {\r\n names.push(node.left.name);\r\n fnCtx.jsxBindingNames.add(node.left.name);\r\n }\r\n\r\n fnCtx.jsxAssignments.push({ node: right, names });\r\n };\r\n\r\n return /** @type {import(\"oxlint\").VisitorWithHooks} */ ({\r\n FunctionDeclaration(node) {\r\n if (isFunctionLike(node)) enterFunction(node);\r\n },\r\n \"FunctionDeclaration:exit\": exitFunction,\r\n FunctionExpression(node) {\r\n if (isFunctionLike(node)) enterFunction(node);\r\n },\r\n \"FunctionExpression:exit\": exitFunction,\r\n ArrowFunctionExpression(node) {\r\n if (isFunctionLike(node)) enterFunction(node);\r\n },\r\n \"ArrowFunctionExpression:exit\": exitFunction,\r\n ReturnStatement(node) {\r\n if (node.type === \"ReturnStatement\") handleReturnStatement(node);\r\n },\r\n VariableDeclarator(node) {\r\n if (node.type === \"VariableDeclarator\") handleVariableDeclarator(node);\r\n },\r\n AssignmentExpression(node) {\r\n if (node.type === \"AssignmentExpression\") handleAssignmentExpression(node);\r\n },\r\n });\r\n },\r\n});\r\n\r\nexport const noInlineComponentsRule = rule;\r\n\r\nexport default {\r\n meta: { name: \"no-inline-components\" },\r\n rules: { \"no-inline-components\": rule },\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,iBAAiB,IAAI,IAAI,CAAC,cAAc,cAAc,CAAC;AAC7D,MAAM,sBAAsB,IAAI,IAAI;CAAC;CAAuB;CAAsB;CAA0B,CAAC;;;;;AAM7G,MAAa,mBAAmB,SAAS,OAAO,SAAS,YAAY,SAAS,KAAK,KAAK;;;;;AAMxF,MAAa,cAAc,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;;;;;AAMtF,MAAM,UAAU,SAAS,QAAQ,QAAQ,OAAO,SAAS,YAAY,UAAU,KAAK;;;;;AAMpF,MAAM,kBAAkB,SAAS,OAAO,KAAK,IAAI,oBAAoB,IAAI,KAAK,KAAK;;;;;AAMnF,MAAa,wBAAwB,SAAS;CAC5C,MAAM,gBAAgB,YAAY;AAChC,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,eAAe,QAAQ,CACzB,QAAO;AAET,SAAO,aAAa,OAAO,QAAQ,GAAI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ACnB,OAAI,CAAC,SAAS,eAAe,MAAM,CAAE;AACrC,OAAI,CAAC,sBAAsB,MAAM,CAAE;GAEnC,MAAM,QAAQ,EAAE;AAChB,OAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,cAAc;AAChD,UAAM,KAAK,KAAK,KAAK,KAAK;AAC1B,UAAM,gBAAgB,IAAI,KAAK,KAAK,KAAK;;AAG3C,SAAM,eAAe,KAAK;IAAE,MAAM;IAAO;IAAO,CAAC;;AAGnD,SAAyD;GACvD,oBAAoB,MAAM;AACxB,QAAI,eAAe,KAAK,CAAE,eAAc,KAAK;;GAE/C,4BAA4B;GAC5B,mBAAmB,MAAM;AACvB,QAAI,eAAe,KAAK,CAAE,eAAc,KAAK;;GAE/C,2BAA2B;GAC3B,wBAAwB,MAAM;AAC5B,QAAI,eAAe,KAAK,CAAE,eAAc,KAAK;;GAE/C,gCAAgC;GAChC,gBAAgB,MAAM;AACpB,QAAI,KAAK,SAAS,kBAAmB,uBAAsB,KAAK;;GAElE,mBAAmB,MAAM;AACvB,QAAI,KAAK,SAAS,qBAAsB,0BAAyB,KAAK;;GAExE,qBAAqB,MAAM;AACzB,QAAI,KAAK,SAAS,uBAAwB,4BAA2B,KAAK;;GAE7E;;CAEJ,CAAC;AAEF,MAAa,yBAAyB;AAEtC,mCAAe;CACb,MAAM,EAAE,MAAM,wBAAwB;CACtC,OAAO,EAAE,wBAAwB,MAAM;CACxC"}
|
|
1
|
+
{"version":3,"file":"no-inline-components.mjs","names":[],"sources":["../../src/oxlint-plugins/no-inline-components.js"],"sourcesContent":["import { defineRule } from \"oxlint\";\n\n/**\n * @typedef {import(\"oxlint\").Context} RuleContext\n * @typedef {import(\"oxlint\").ESTree.Node} ESTNode\n * @typedef {import(\"oxlint\").ESTree.Expression} ESTExpression\n * @typedef {import(\"oxlint\").ESTree.Pattern} ESTPattern\n * @typedef {import(\"oxlint\").ESTree.ReturnStatement} ReturnStatementNode\n * @typedef {import(\"oxlint\").ESTree.VariableDeclarator} VariableDeclaratorNode\n * @typedef {import(\"oxlint\").ESTree.AssignmentExpression} AssignmentExpressionNode\n * @typedef {import(\"oxlint\").ESTree.Function | import(\"oxlint\").ESTree.ArrowFunctionExpression} FunctionLikeNode\n */\n\n/**\n * @typedef {object} RecordedAssignment\n * @property {ESTExpression} node\n * @property {string[]} names\n */\n\n/**\n * @typedef {object} NestedFunctionRecord\n * @property {FunctionLikeNode} node\n * @property {string} name\n */\n\n/**\n * @typedef {object} FunctionContext\n * @property {FunctionLikeNode} node\n * @property {FunctionContext | null} parent\n * @property {string} name\n * @property {boolean} returnsJsx\n * @property {Set<string>} jsxBindingNames\n * @property {RecordedAssignment[]} jsxAssignments\n * @property {NestedFunctionRecord[]} nestedJsxChildren\n */\n\nconst JSX_NODE_TYPES = new Set([\"JSXElement\", \"JSXFragment\"]);\nconst FUNCTION_NODE_TYPES = new Set([\"FunctionDeclaration\", \"FunctionExpression\", \"ArrowFunctionExpression\"]);\n\n/**\n * @param {unknown} name\n * @returns {name is string}\n */\nexport const isComponentName = (name) => typeof name === \"string\" && /^[A-Z]/.test(name);\n\n/**\n * @param {unknown} name\n * @returns {name is string}\n */\nexport const isHookName = (name) => typeof name === \"string\" && name.startsWith(\"use\");\n\n/**\n * @param {unknown} node\n * @returns {node is ESTNode & { type: string }}\n */\nconst isNode = (node) => Boolean(node && typeof node === \"object\" && \"type\" in node);\n\n/**\n * @param {unknown} node\n * @returns {node is FunctionLikeNode}\n */\nconst isFunctionLike = (node) => isNode(node) && FUNCTION_NODE_TYPES.has(node.type);\n\n/**\n * @param {ESTNode | null | undefined} node\n * @returns {FunctionLikeNode | null}\n */\nexport const getEnclosingFunction = (node) => {\n const findFunction = (current) => {\n if (!current) return null;\n if (isFunctionLike(current)) {\n return current;\n }\n return findFunction(isNode(current) ? current.parent ?? null : null);\n };\n return findFunction(isNode(node) ? node.parent ?? null : null);\n};\n\n/**\n * @param {FunctionLikeNode} node\n */\nconst isFunctionUsedAsJsxProp = (node) => {\n const checkJsxProp = (current) => {\n if (!current) return false;\n if (current.type === \"JSXAttribute\") {\n return true;\n }\n if (isFunctionLike(current)) {\n return false;\n }\n return checkJsxProp(isNode(current) ? current.parent ?? null : null);\n };\n return checkJsxProp(isNode(node) ? node.parent ?? null : null);\n};\n\n/**\n * @param {FunctionLikeNode} node\n */\nconst isFunctionImmediatelyInvoked = (node) => {\n const parent = isNode(node) ? node.parent ?? null : null;\n if (!parent) return false;\n\n // Check if the function is the callee of a CallExpression (i.e., it's immediately invoked)\n if (parent.type === \"CallExpression\" && parent.callee === node) {\n return true;\n }\n\n return false;\n};\n\n/**\n * @param {ESTExpression | null | undefined} root\n */\nconst expressionContainsJsx = (root) => {\n if (!root || !isNode(root)) return false;\n\n const stack = [root];\n\n while (stack.length > 0) {\n const current = stack.pop();\n if (!current || !isNode(current)) continue;\n\n if (JSX_NODE_TYPES.has(current.type)) {\n return true;\n }\n\n if (FUNCTION_NODE_TYPES.has(current.type) && current !== root) {\n continue;\n }\n\n for (const key of Object.keys(current)) {\n if (key === \"parent\") continue;\n\n const value = current[key];\n if (!value) continue;\n\n if (Array.isArray(value)) {\n for (const element of value) {\n if (isNode(element)) {\n stack.push(element);\n }\n }\n } else if (isNode(value)) {\n stack.push(value);\n }\n }\n }\n\n return false;\n};\n\n/**\n * @param {ESTExpression | null | undefined} root\n * @param {Set<string>} bindingNames\n */\nconst expressionProducesJsx = (root, bindingNames) => {\n if (!root) return false;\n if (expressionContainsJsx(root)) return true;\n\n if (!isNode(root)) return false;\n\n const type = root.type;\n\n if (type === \"Identifier\") {\n return bindingNames.has(root.name);\n }\n\n if (type === \"ConditionalExpression\") {\n return expressionProducesJsx(root.consequent, bindingNames) || expressionProducesJsx(root.alternate, bindingNames);\n }\n\n if (type === \"LogicalExpression\") {\n return expressionProducesJsx(root.left, bindingNames) || expressionProducesJsx(root.right, bindingNames);\n }\n\n if (type === \"SequenceExpression\") {\n const expressions = root.expressions ?? [];\n const last = expressions[expressions.length - 1] ?? null;\n return expressionProducesJsx(last, bindingNames);\n }\n\n if (type === \"ArrayExpression\") {\n return root.elements.some((element) => {\n if (!element) return false;\n if (element.type === \"SpreadElement\") {\n return expressionProducesJsx(element.argument, bindingNames);\n }\n return expressionProducesJsx(element, bindingNames);\n });\n }\n\n if (type === \"ParenthesizedExpression\") {\n return expressionProducesJsx(root.expression, bindingNames);\n }\n\n if (type === \"AwaitExpression\" || type === \"UnaryExpression\" || type === \"UpdateExpression\") {\n return expressionProducesJsx(root.argument, bindingNames);\n }\n\n if (\n type === \"TSAsExpression\" ||\n type === \"TSTypeAssertion\" ||\n type === \"TSNonNullExpression\" ||\n type === \"ChainExpression\"\n ) {\n return expressionProducesJsx(root.expression, bindingNames);\n }\n\n if (type === \"CallExpression\") {\n return expressionProducesJsx(root.callee, bindingNames);\n }\n\n if (type === \"MemberExpression\") {\n return expressionProducesJsx(root.object, bindingNames);\n }\n\n return false;\n};\n\n/**\n * @param {ESTPattern | null | undefined} pattern\n * @param {string[]} names\n */\nconst collectBindingNames = (pattern, names) => {\n if (!pattern || !isNode(pattern)) return;\n\n const type = pattern.type;\n\n if (type === \"Identifier\") {\n names.push(pattern.name);\n return;\n }\n\n if (type === \"ArrayPattern\") {\n for (const element of pattern.elements) {\n if (!element) continue;\n if (element.type === \"RestElement\") {\n collectBindingNames(element.argument, names);\n } else {\n collectBindingNames(element, names);\n }\n }\n return;\n }\n\n if (type === \"ObjectPattern\") {\n for (const property of pattern.properties) {\n if (!property) continue;\n if (property.type === \"Property\") {\n collectBindingNames(property.value, names);\n } else if (property.type === \"RestElement\") {\n collectBindingNames(property.argument, names);\n }\n }\n return;\n }\n\n if (type === \"AssignmentPattern\") {\n collectBindingNames(pattern.left, names);\n return;\n }\n\n if (type === \"RestElement\") {\n collectBindingNames(pattern.argument, names);\n }\n};\n\n/**\n * @param {FunctionLikeNode} node\n */\nexport const getFunctionName = (node) => {\n if (node.type === \"FunctionDeclaration\" && node.id && node.id.type === \"Identifier\") {\n return node.id.name;\n }\n\n if ((node.type === \"FunctionExpression\" || node.type === \"ArrowFunctionExpression\") && node.id) {\n if (node.id.type === \"Identifier\") return node.id.name;\n }\n\n const parent = node.parent;\n if (!parent || !isNode(parent)) return \"\";\n\n if (parent.type === \"VariableDeclarator\") {\n return parent.id && parent.id.type === \"Identifier\" ? parent.id.name : \"\";\n }\n\n if (parent.type === \"AssignmentExpression\") {\n return parent.left && parent.left.type === \"Identifier\" ? parent.left.name : \"\";\n }\n\n if (parent.type === \"Property\" || parent.type === \"MethodDefinition\") {\n return parent.key && parent.key.type === \"Identifier\" ? parent.key.name : \"\";\n }\n\n // Handle functions passed as arguments to calls (e.g., useCallback, useMemo)\n if (parent.type === \"CallExpression\") {\n const callParent = parent.parent;\n if (callParent && isNode(callParent)) {\n if (callParent.type === \"VariableDeclarator\") {\n return callParent.id && callParent.id.type === \"Identifier\" ? callParent.id.name : \"\";\n }\n if (callParent.type === \"AssignmentExpression\") {\n return callParent.left && callParent.left.type === \"Identifier\" ? callParent.left.name : \"\";\n }\n }\n }\n\n return \"\";\n};\n\n/**\n * @param {string} name\n */\nconst describeFunction = (name) => (name ? `function '${name}'` : \"this function\");\n\n/**\n * @param {string} name\n */\nconst describeNested = (name) => (name ? `function '${name}'` : \"an anonymous function\");\n\n/**\n * @param {string[]} names\n * @param {string} fnName\n */\nconst createAssignmentMessage = (names, fnName) => {\n const target =\n names.length === 0\n ? \"local variables\"\n : names.length === 1\n ? `local '${names[0]}'`\n : `locals ${names.map((name) => `'${name}'`).join(\", \")}`;\n\n return `Avoid storing JSX in ${target} inside ${describeFunction(fnName)}; return the JSX directly instead.`;\n};\n\n/**\n * @param {string} childName\n * @param {string} parentName\n */\nconst createNestedFunctionMessage = (childName, parentName) =>\n `JSX-returning ${describeNested(childName)} should not be declared inside ${describeFunction(parentName)}. Extract it to module scope.`;\n\n/**\n * @param {string} name\n */\nconst createIIFEMessage = (name) =>\n `JSX-returning ${describeNested(name)} should not be declared as an immediately invoked function expression (IIFE). Extract it to a named function at module scope.`;\n\nconst rule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow JSX-returning functions and JSX-valued assignments within other functions that also return JSX.\",\n recommended: false,\n },\n schema: [],\n },\n\n createOnce(context) {\n /** @type {FunctionContext[]} */\n const functionStack = [];\n\n const currentFunction = () => functionStack[functionStack.length - 1] ?? null;\n\n /**\n * @param {FunctionLikeNode} node\n */\n const enterFunction = (node) => {\n const parent = currentFunction();\n /** @type {FunctionContext} */\n const fnCtx = {\n node,\n parent,\n name: getFunctionName(node),\n returnsJsx: false,\n jsxBindingNames: new Set(),\n jsxAssignments: [],\n nestedJsxChildren: [],\n };\n\n functionStack.push(fnCtx);\n\n if (node.type === \"ArrowFunctionExpression\" && node.body && node.body.type !== \"BlockStatement\") {\n if (expressionProducesJsx(node.body, fnCtx.jsxBindingNames)) {\n fnCtx.returnsJsx = true;\n }\n }\n };\n\n const exitFunction = () => {\n const fnCtx = functionStack.pop();\n if (!fnCtx) return;\n\n if (fnCtx.returnsJsx && isFunctionImmediatelyInvoked(fnCtx.node)) {\n context.report({\n node: fnCtx.node,\n message: createIIFEMessage(fnCtx.name),\n });\n return;\n }\n\n if (fnCtx.parent && fnCtx.returnsJsx && fnCtx.name && !isFunctionUsedAsJsxProp(fnCtx.node)) {\n fnCtx.parent.nestedJsxChildren.push({ node: fnCtx.node, name: fnCtx.name });\n }\n\n if (!fnCtx.returnsJsx) return;\n\n for (const assignment of fnCtx.jsxAssignments) {\n context.report({\n node: assignment.node,\n message: createAssignmentMessage(assignment.names, fnCtx.name),\n });\n }\n\n for (const nested of fnCtx.nestedJsxChildren) {\n context.report({\n node: nested.node,\n message: createNestedFunctionMessage(nested.name, fnCtx.name),\n });\n }\n };\n\n /** @param {ReturnStatementNode} node */\n const handleReturnStatement = (node) => {\n const fnCtx = currentFunction();\n if (!fnCtx) return;\n\n const argument = node.argument;\n if (!argument || isFunctionLike(argument)) return;\n\n if (expressionProducesJsx(argument, fnCtx.jsxBindingNames)) {\n fnCtx.returnsJsx = true;\n }\n };\n\n /** @param {VariableDeclaratorNode} node */\n const handleVariableDeclarator = (node) => {\n const fnCtx = currentFunction();\n if (!fnCtx) return;\n\n const init = node.init;\n if (!init || isFunctionLike(init)) return;\n if (!expressionContainsJsx(init)) return;\n\n const names = [];\n collectBindingNames(node.id, names);\n for (const name of names) {\n fnCtx.jsxBindingNames.add(name);\n }\n\n fnCtx.jsxAssignments.push({ node: init, names });\n };\n\n /** @param {AssignmentExpressionNode} node */\n const handleAssignmentExpression = (node) => {\n if (node.operator !== \"=\") return;\n\n const fnCtx = currentFunction();\n if (!fnCtx) return;\n\n const right = node.right;\n if (!right || isFunctionLike(right)) return;\n if (!expressionContainsJsx(right)) return;\n\n const names = [];\n if (node.left && node.left.type === \"Identifier\") {\n names.push(node.left.name);\n fnCtx.jsxBindingNames.add(node.left.name);\n }\n\n fnCtx.jsxAssignments.push({ node: right, names });\n };\n\n /**\n * @param {import(\"oxlint\").ESTree.CallExpression} node\n */\n const handleCallExpression = (node) => {\n const fnCtx = currentFunction();\n if (!fnCtx) return;\n\n // Check for array.push(<JSX>)\n if (\n node.callee &&\n node.callee.type === \"MemberExpression\" &&\n node.callee.property &&\n node.callee.property.type === \"Identifier\" &&\n node.callee.property.name === \"push\"\n ) {\n const arrayObject = node.callee.object;\n if (arrayObject && arrayObject.type === \"Identifier\") {\n const arrayName = arrayObject.name;\n\n // Check if any argument contains JSX\n const hasJsxArgument = node.arguments.some((arg) => {\n if (!arg || arg.type === \"SpreadElement\") return false;\n return expressionContainsJsx(arg);\n });\n\n if (hasJsxArgument) {\n fnCtx.jsxBindingNames.add(arrayName);\n fnCtx.jsxAssignments.push({ node: node, names: [arrayName] });\n }\n }\n }\n };\n\n return /** @type {import(\"oxlint\").VisitorWithHooks} */ ({\n FunctionDeclaration(node) {\n if (isFunctionLike(node)) enterFunction(node);\n },\n \"FunctionDeclaration:exit\": exitFunction,\n FunctionExpression(node) {\n if (isFunctionLike(node)) enterFunction(node);\n },\n \"FunctionExpression:exit\": exitFunction,\n ArrowFunctionExpression(node) {\n if (isFunctionLike(node)) enterFunction(node);\n },\n \"ArrowFunctionExpression:exit\": exitFunction,\n ReturnStatement(node) {\n if (node.type === \"ReturnStatement\") handleReturnStatement(node);\n },\n VariableDeclarator(node) {\n if (node.type === \"VariableDeclarator\") handleVariableDeclarator(node);\n },\n AssignmentExpression(node) {\n if (node.type === \"AssignmentExpression\") handleAssignmentExpression(node);\n },\n CallExpression(node) {\n if (node.type === \"CallExpression\") handleCallExpression(node);\n },\n });\n },\n});\n\nexport const noInlineComponentsRule = rule;\n\nexport default {\n meta: { name: \"no-inline-components\" },\n rules: { \"no-inline-components\": rule },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,iBAAiB,IAAI,IAAI,CAAC,cAAc,cAAc,CAAC;AAC7D,MAAM,sBAAsB,IAAI,IAAI;CAAC;CAAuB;CAAsB;CAA0B,CAAC;;;;;AAM7G,MAAa,mBAAmB,SAAS,OAAO,SAAS,YAAY,SAAS,KAAK,KAAK;;;;;AAMxF,MAAa,cAAc,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;;;;;AAMtF,MAAM,UAAU,SAAS,QAAQ,QAAQ,OAAO,SAAS,YAAY,UAAU,KAAK;;;;;AAMpF,MAAM,kBAAkB,SAAS,OAAO,KAAK,IAAI,oBAAoB,IAAI,KAAK,KAAK;;;;;AAMnF,MAAa,wBAAwB,SAAS;CAC5C,MAAM,gBAAgB,YAAY;AAChC,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,eAAe,QAAQ,CACzB,QAAO;AAET,SAAO,aAAa,OAAO,QAAQ,GAAG,QAAQ,UAAU,OAAO,KAAK;;AAEtE,QAAO,aAAa,OAAO,KAAK,GAAG,KAAK,UAAU,OAAO,KAAK;;;;;AAMhE,MAAM,2BAA2B,SAAS;CACxC,MAAM,gBAAgB,YAAY;AAChC,MAAI,CAAC,QAAS,QAA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;GAE5E,eAAe,MAAM;AACnB,QAAI,KAAK,SAAS,iBAAkB,sBAAqB,KAAK;;GAEjE;;CAEJ,CAAC;AAEF,MAAa,yBAAyB;AAEtC,mCAAe;CACb,MAAM,EAAE,MAAM,wBAAwB;CACtC,OAAO,EAAE,wBAAwB,MAAM;CACxC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint29 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-react-namespace.d.ts
|
|
4
|
-
declare const noReactNamespaceRule:
|
|
4
|
+
declare const noReactNamespaceRule: oxlint29.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-react-namespace":
|
|
10
|
+
"no-react-namespace": oxlint29.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint29.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noReactNamespaceRule };
|
|
16
16
|
//# sourceMappingURL=no-react-namespace.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint16 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-switch-plugin.d.ts
|
|
4
4
|
declare namespace _default {
|
|
@@ -6,10 +6,10 @@ declare namespace _default {
|
|
|
6
6
|
let name: string;
|
|
7
7
|
}
|
|
8
8
|
let rules: {
|
|
9
|
-
"no-switch":
|
|
9
|
+
"no-switch": oxlint16.Rule;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
type ESTNode =
|
|
12
|
+
type ESTNode = oxlint16.ESTree.Node;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ESTNode, _default as default };
|
|
15
15
|
//# sourceMappingURL=no-switch-plugin.d.mts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint13 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-top-level-let.d.ts
|
|
4
|
-
declare const noTopLevelLetRule:
|
|
4
|
+
declare const noTopLevelLetRule: oxlint13.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-top-level-let":
|
|
10
|
+
"no-top-level-let": oxlint13.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint13.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noTopLevelLetRule };
|
|
16
16
|
//# sourceMappingURL=no-top-level-let.d.mts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint0 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-type-cast.d.ts
|
|
4
|
-
declare const noTypeCastRule:
|
|
4
|
+
declare const noTypeCastRule: oxlint0.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-type-cast":
|
|
10
|
+
"no-type-cast": oxlint0.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint0.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noTypeCastRule };
|
|
16
16
|
//# sourceMappingURL=no-type-cast.d.mts.map
|
package/package.json
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"dayjs": "1.11.19",
|
|
64
64
|
"nanoid": "5.1.6",
|
|
65
65
|
"ofetch": "1.5.1",
|
|
66
|
-
"oxlint": "1.
|
|
66
|
+
"oxlint": "1.35.0",
|
|
67
67
|
"remeda": "2.32.0",
|
|
68
68
|
"valibot": "1.1.0"
|
|
69
69
|
},
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"typescript": "5.9.3",
|
|
83
83
|
"vitest": "4.0.15"
|
|
84
84
|
},
|
|
85
|
-
"version": "0.0.
|
|
85
|
+
"version": "0.0.51",
|
|
86
86
|
"scripts": {
|
|
87
87
|
"dev": "tsdown --watch",
|
|
88
88
|
"build": "tsc --noEmit && tsdown",
|