eslint-plugin-es icon indicating copy to clipboard operation
eslint-plugin-es copied to clipboard

New Rule Proposal: `no-array-prototype-at` and `no-string-prototype-at`

Open ota-meshi opened this issue 3 years ago • 0 comments

Please describe what the rule should do:

  • no-array-prototype-at ... Disallow Array.prototype.at and TypedArray .prototype.at method.
  • no-string-prototype-at ... Disallow String.prototype.at method.

These methods will be added in ES2022.

https://github.com/tc39/proposal-relative-indexing-method

Provide 2-3 code examples that this rule will warn about:

var e = array.at(-1);
var e = typedArray.at(-1);
var c = string.at(-1);

Do you think we should rename the rule and to check both arrays and strings?

ota-meshi avatar Sep 02 '21 08:09 ota-meshi