pasika 0.10.40 → 0.10.41
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.
|
@@ -5171,21 +5171,20 @@ var pureFunctionExtractRule = {
|
|
|
5171
5171
|
schema: [],
|
|
5172
5172
|
type: "problem",
|
|
5173
5173
|
docs: {
|
|
5174
|
-
description: "Require pure functions
|
|
5174
|
+
description: "Require module-scope pure functions to be extracted to utils/."
|
|
5175
5175
|
}
|
|
5176
5176
|
},
|
|
5177
5177
|
create(context) {
|
|
5178
5178
|
const filename = context.filename;
|
|
5179
5179
|
const isRouteFile = path40.basename(filename) === "route.ts";
|
|
5180
|
-
|
|
5180
|
+
const isSourceFile = /\.(?:[cm]?[jt]sx?)$/.test(filename);
|
|
5181
|
+
if (!isSourceFile && !isRouteFile) return {};
|
|
5181
5182
|
const sourceRoot = sourceRootOf(context);
|
|
5182
5183
|
const relative = path40.relative(sourceRoot, filename);
|
|
5183
5184
|
if (relative.startsWith("..")) return {};
|
|
5184
5185
|
const segments = relative.split(path40.sep);
|
|
5185
|
-
if (segments
|
|
5186
|
+
if (segments.slice(0, -1).includes("utils")) return {};
|
|
5186
5187
|
if (segments[0] === "app" && !isRouteFile) return {};
|
|
5187
|
-
const supportFolders = /* @__PURE__ */ new Set(["hooks", "types", "schemas", "constants", "utils"]);
|
|
5188
|
-
if (segments.length >= 2 && supportFolders.has(segments[segments.length - 1] ?? "")) return {};
|
|
5189
5188
|
function report3(node, name) {
|
|
5190
5189
|
context.report({
|
|
5191
5190
|
node,
|