Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/rentals.picotech.app/public_html/node_modules/eslint/lib/rules/ drwxr-xr-x |
Viewing file: Select action/file-type: /** * @fileoverview enforce default parameters to be last * @author Chiawen Chen */ "use strict"; /** @type {import('../shared/types').Rule} */ module.exports = { meta: { type: "suggestion", docs: { description: "Enforce default parameters to be last", recommended: false, url: "https://eslint.org/docs/latest/rules/default-param-last" }, schema: [], messages: { shouldBeLast: "Default parameters should be last." } }, create(context) { /** * Handler for function contexts. * @param {ASTNode} node function node * @returns {void} */ function handleFunction(node) { let hasSeenPlainParam = false; for (let i = node.params.length - 1; i >= 0; i -= 1) { const param = node.params[i]; if ( param.type !== "AssignmentPattern" && param.type !== "RestElement" ) { hasSeenPlainParam = true; continue; } if (hasSeenPlainParam && param.type === "AssignmentPattern") { context.report({ node: param, messageId: "shouldBeLast" }); } } } return { FunctionDeclaration: handleFunction, FunctionExpression: handleFunction, ArrowFunctionExpression: handleFunction }; } }; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0041 ]-- |