HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/api-storage/node_modules/eslint/lib/rules/no-spaced-func.js
/**
 * @fileoverview Rule to check that spaced function application
 * @author Matt DuVall <http://www.mattduvall.com>
 * @deprecated in ESLint v3.3.0
 */

"use strict";

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

/** @type {import('../types').Rule.RuleModule} */
module.exports = {
	meta: {
		type: "layout",

		docs: {
			description:
				"Disallow spacing between function identifiers and their applications (deprecated)",
			recommended: false,
			url: "https://eslint.org/docs/latest/rules/no-spaced-func",
		},

		deprecated: {
			message: "Formatting rules are being moved out of ESLint core.",
			url: "https://eslint.org/blog/2016/08/eslint-v3.3.0-released/#deprecated-rules",
			deprecatedSince: "3.3.0",
			availableUntil: "10.0.0",
			replacedBy: [
				{
					message:
						"ESLint Stylistic now maintains deprecated stylistic core rules.",
					url: "https://eslint.style/guide/migration",
					plugin: {
						name: "@stylistic/eslint-plugin-js",
						url: "https://eslint.style/packages/js",
					},
					rule: {
						name: "function-call-spacing",
						url: "https://eslint.style/rules/js/function-call-spacing",
					},
				},
			],
		},

		fixable: "whitespace",
		schema: [],

		messages: {
			noSpacedFunction:
				"Unexpected space between function name and paren.",
		},
	},

	create(context) {
		const sourceCode = context.sourceCode;

		/**
		 * Check if open space is present in a function name
		 * @param {ASTNode} node node to evaluate
		 * @returns {void}
		 * @private
		 */
		function detectOpenSpaces(node) {
			const lastCalleeToken = sourceCode.getLastToken(node.callee);
			let prevToken = lastCalleeToken,
				parenToken = sourceCode.getTokenAfter(lastCalleeToken);

			// advances to an open parenthesis.
			while (
				parenToken &&
				parenToken.range[1] < node.range[1] &&
				parenToken.value !== "("
			) {
				prevToken = parenToken;
				parenToken = sourceCode.getTokenAfter(parenToken);
			}

			// look for a space between the callee and the open paren
			if (
				parenToken &&
				parenToken.range[1] < node.range[1] &&
				sourceCode.isSpaceBetweenTokens(prevToken, parenToken)
			) {
				context.report({
					node,
					loc: lastCalleeToken.loc.start,
					messageId: "noSpacedFunction",
					fix(fixer) {
						return fixer.removeRange([
							prevToken.range[1],
							parenToken.range[0],
						]);
					},
				});
			}
		}

		return {
			CallExpression: detectOpenSpaces,
			NewExpression: detectOpenSpaces,
		};
	},
};