Skip to main content

js/noArguments

disallow the use of arguments

ESLint Equivalent: prefer-rest-params

Examples

Invalid

function f() {
	console.log(arguments);
}

 file.ts:2:13 lint/js/noArguments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Use the rest parameters instead of arguments.

    1function f() {
  > 2  console.log(arguments);
                   ^^^^^^^^^
    3}

  Arguments does not have Array.prototype methods and can be
    inconvenient to use.


(function () {
	console.log(arguments);
})();

 file.ts:2:13 lint/js/noArguments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Use the rest parameters instead of arguments.

    1(function () {
  > 2  console.log(arguments);
                   ^^^^^^^^^
    3})();

  Arguments does not have Array.prototype methods and can be
    inconvenient to use.


class C {
	fn() {
		console.log(arguments);
	}
}

 file.ts:3:14 lint/js/noArguments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Use the rest parameters instead of arguments.

    1class C {
    2  fn() {
  > 3    console.log(arguments);
                     ^^^^^^^^^
    4  }
    5}

  Arguments does not have Array.prototype methods and can be
    inconvenient to use.


const o = {
	fn() {
		console.log(arguments);
	},
};

 file.ts:3:14 lint/js/noArguments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Use the rest parameters instead of arguments.

    1const o = {
    2  fn() {
  > 3    console.log(arguments);
                     ^^^^^^^^^
    4  },
    5};

  Arguments does not have Array.prototype methods and can be
    inconvenient to use.